# Don't molest STDERR as this may be used to receive output from a debugger.
$(BUILD_DIR)/tests/radiusd-c: raddb/test.conf ${BUILD_DIR}/bin/radiusd $(GENERATED_CERT_FILES) | build.raddb
@printf "radiusd -C... "
- @if ! FR_LIBRARY_PATH=./build/lib/local/.libs/ ./build/make/jlibtool --mode=execute ./build/bin/local/radiusd -XCd ./raddb -n debug -D ./share -n test > $(BUILD_DIR)/tests/radiusd.config.log; then \
+ @if ! FR_LIBRARY_PATH=./build/lib/local/.libs/ ./build/make/jlibtool --mode=execute ./build/bin/local/radiusd -XCMd ./raddb -n debug -D ./share/dictionary -n test > $(BUILD_DIR)/tests/radiusd.config.log; then \
+ rm -f raddb/test.conf; \
cat $(BUILD_DIR)/tests/radiusd.config.log; \
echo "fail"; \
echo "FR_LIBRARY_PATH=./build/lib/local/.libs/ ./build/make/jlibtool --mode=execute ./build/bin/local/radiusd -XCd ./raddb -n debug -D ./share -n test"; \
#
export DESTDIR := $(R)
-DICTIONARIES := $(wildcard share/dictionary*)
-install.share: $(addprefix $(R)$(dictdir)/,$(notdir $(DICTIONARIES)))
+DICTIONARIES := $(shell find share/dictionary -type f -name dictionary*)
+install.share: $(addprefix $(R)$(dictdir)/,$(patsubst share/dictionary/%,%,$(DICTIONARIES)))
-$(R)$(dictdir)/%: share/%
- @echo INSTALL $(notdir $<)
+$(R)$(dictdir)/%: share/dictionary/%
+ @echo INSTALL $(patsubst share/dictionary/%,%,$<)
@$(INSTALL) -m 644 $< $@
MANFILES := $(wildcard man/man*/*.?)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $raddbdir" >&5
$as_echo "$raddbdir" >&6; }
-dictdir='${datarootdir}/freeradius'
+dictdir='${datarootdir}/freeradius/dictionary'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dictdir" >&5
$as_echo_n "checking dictdir... " >&6; }
dnl #
dnl # extra argument: --with-dictdir
dnl #
-dictdir='${datarootdir}/freeradius'
+dictdir='${datarootdir}/freeradius/dictionary'
AC_MSG_CHECKING(dictdir)
AC_ARG_WITH(dictdir,
[ --with-dictdir=DIR directory for dictionary files [DATAROOTDIR/freeradius] ],
#include <freeradius-devel/unlang/base.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
+
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
if (!vp) goto done;
switch (vp->vp_int32) {
- case FR_AUTH_TYPE_ACCEPT:
+ case FR_AUTH_TYPE_VALUE_ACCEPT:
request->reply->code = FR_CODE_ACCESS_ACCEPT;
goto done;
- case FR_AUTH_TYPE_REJECT:
+ case FR_AUTH_TYPE_VALUE_REJECT:
request->reply->code = FR_CODE_ACCESS_REJECT;
goto done;
autoconf.sed
# Dynamically generated headers
-attributes.h
features.h
-freeradius.h
-freeradius.snmp.h
missing.h
radpaths.h
-eap.sim.h
-eap.aka.h
-tacacs.h
-rfc*.h
tls.h
-vqp.h
+protocol/*
+
+# Symlinks
+util
# Build scripts
build-radpaths-h
#
# The rest of the headers are static.
#
-
-HEADERS_DY := attributes.h features.h missing.h radpaths.h
+HEADERS_DY := features.h missing.h radpaths.h
HEADERS = \
build.h \
$(HEADERS_DY)
+
#
# Solaris awk doesn't recognise [[:blank:]] hence [\t ]
#
# Create the header files from the dictionaries.
#
-RFC_DICTS := $(filter-out %~,$(wildcard share/dictionary.rfc*)) \
- share/dictionary.vqp share/dictionary.freeradius \
- share/dictionary.freeradius.snmp \
- share/dictionary.dhcpv4 \
- share/dictionary.dhcpv6 \
- share/dictionary.eap.aka \
- share/dictionary.eap.sim \
- share/dictionary.tacacs
+# Find the RFC dictionaries, and add them to the list to be converted
+DICT := $(shell find share/dictionary -type f -name *dictionary.rfc*)
-HEADERS_RFC := $(patsubst share/dictionary.%,src/include/%.h,$(RFC_DICTS))
-HEADERS += $(notdir ${HEADERS_RFC})
+# Find internal dictionaries and add them to the list to be converted
+DICT += $(shell find share/dictionary -type f -name *dictionary.freeradius*)
-.PRECIOUS: $(HEADERS_RFC)
+# These contain the protocol number definitions
+DICT += $(shell find share/dictionary -type f -name *dictionary)
-NORMALIZE := tr -- '[:lower:]/.-' '[:upper:]___' | sed 's/^/\#define /;s/241_//;'
-HEADER := "/* AUTO_GENERATED FILE. DO NOT EDIT */"
+# Add in protocol specific dictionaries (should be done in proto_* modules?)
+DICT += share/dictionary/vqp/dictionary.vqp
-src/include/attributes.h: share/dictionary.freeradius.internal
- ${Q}$(ECHO) HEADER $@
- ${Q}echo ${HEADER} > $@
- ${Q}echo "#pragma once" >> $@
- ${Q}grep ^ATTRIBUTE $< | awk '{print "FR_"$$2 " " $$3 }' | ${NORMALIZE} >> $@
- ${Q}echo " " >> $@
- ${Q}grep -- 'Auth-Type' $< | grep ^VALUE | awk '{print "FR_"$$2 "_" $$3 " " $$4 }' | ${NORMALIZE} >> $@
+NORMALIZE := tr -- '[:lower:]/.-+' '[:upper:]____' | sed 's/241_//;'
+HEADER := "/* AUTO_GENERATED FILE. DO NOT EDIT */"
-src/include/%.h: share/dictionary.% share/dictionary.vqp share/dictionary.freeradius.snmp
- ${Q}$(ECHO) HEADER $@
- ${Q}echo ${HEADER} > $@
- ${Q}echo "#pragma once" >> $@
- ${Q}grep ^ATTRIBUTE $< | awk '{print "FR_"$$2 " " $$3 }' | ${NORMALIZE} >> $@
- ${Q}grep ^VALUE $< | awk '{print "FR_"$$2"_VALUE_"$$3 " " $$4 }' | ${NORMALIZE} >> $@
+# Build targets dynamically
+define DICT_TO_HEADER
+HEADERS_DY += $(1)
+src/include/$(1): $(2)
+ ${Q}$$(ECHO) HEADER $$(patsubst src/include/%,%,$$@)
+ ${Q}test -e $$@ || mkdir -p $$(dir $$@)
+ ${Q}echo "#pragma once" >> $$@
+ ${Q}grep ^PROTOCOL $$< | ${NORMALIZE} | awk '{print "#define PROTOCOL_"$$$$2" " $$$$3 " //!< AUTOGENERATED PROTOCOL NUMBER DEFINITION"}' > $$@
+ ${Q}grep ^ATTRIBUTE $$< | ${NORMALIZE} | awk '{print "#define FR_"$$$$2 " " $$$$3 " //!< AUTOGENERATED ATTRIBUTE DEFINITION"}' >> $$@
+ ${Q}grep ^VALUE $$< | ${NORMALIZE} | awk '{print "#define FR_"$$$$2"_VALUE_"$$$$3 " " $$$$4 " //!< AUTOGENERATED VALUE DEFINITION"}' >> $$@
+endef
+$(foreach x,$(DICT),$(eval $(call DICT_TO_HEADER,$(addsuffix .h,$(subst dictionary.,,$(patsubst share/dictionary/%,protocol/%,$(x)))),$(x))))
+
+# Add our dynamic headers to the header manifest so they get
+# installed.
+#HEADERS += $(HEADERS_DY)
-#
# Build features.h by copying over WITH_* and RADIUSD_VERSION_*
# preprocessor macros from autoconf.h
# This means we don't need to include autoconf.h in installed headers.
# This is to that changes to the build rules (e.g. PW_FOO -> FR_FOO)
# result in the headers being rebuilt.
#
-$(BOOTSTRAP_BUILD): src/include/autoconf.h
+
+# define the installation directory
+SRC_INCLUDE_DIR := ${R}${includedir}/freeradius
+
+$(SRC_INCLUDE_DIR):
+ ${Q}$(INSTALL) -d -m 755 ${SRC_INCLUDE_DIR}
+
+#
+# install the headers by re-writing the local files
+#
+# install-sh function for creating directories gets confused
+# if there's a trailing slash, tries to create a directory
+# it already created, and fails...
+#
+${SRC_INCLUDE_DIR}/%.h: src/include/%.h | $(SRC_INCLUDE_DIR)
+ ${Q}echo INSTALL $(notdir $<)
+ ${Q}$(INSTALL) -d -m 755 `echo $(dir $@) | sed 's/\/$$//'`
+# Expression must deal with indentation after the hash and copy it to the substitution string.
+# Hash not anchored to allow substitution in function documentation.
+ ${Q}sed -e 's/#\([\\t ]*\)include <freeradius-devel\/\([^>]*\)>/#\1include <freeradius\/\2>/g' < $< > $@
+ ${Q}chmod 644 $@
+
+all: $(addprefix src/include/,$(HEADERS_DY))
+
+install.src.include: $(addprefix ${SRC_INCLUDE_DIR}/,${HEADERS})
+install: install.src.include
#
# Cleaning
#
.PHONY: clean.src.include distclean.src.include
clean.src.include:
- ${Q}rm -f $(addprefix src/include/,$(HEADERS_DY)) $(HEADERS_RFC)
+ ${Q}rm -rf $(addprefix src/include/,$(HEADERS_DY))
clean: clean.src.include
distclean.src.include: clean.src.include
${Q}rm -f autoconf.sed
+ ${Q}rm -rf src/include/protocol
distclean: distclean.src.include
+
#include <freeradius-devel/radius/defs.h>
-#include <freeradius-devel/attributes.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <ctype.h>
#include <freeradius-devel/util/trie.h>
#include <freeradius-devel/util/misc.h>
-#include <freeradius-devel/attributes.h>
+
#include <ctype.h>
#include <fcntl.h>
#include <freeradius-devel/server/parser.h>
#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/attributes.h>
+
#include <ctype.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/util/thread_local.h>
-#include <freeradius-devel/attributes.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <sys/file.h>
#include <freeradius-devel/util/misc.h>
-#include <freeradius-devel/attributes.h>
+
#include <sys/stat.h>
#include <fcntl.h>
#include <freeradius-devel/util/pair_cursor.h>
#include <freeradius-devel/util/misc.h>
-#include <freeradius-devel/rfc2865.h>
-#include <freeradius-devel/attributes.h>
+#include <freeradius-devel/protocol/radius/rfc2865.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <ctype.h>
#include <freeradius-devel/server/regex.h>
#include <freeradius-devel/server/request.h>
-#include <freeradius-devel/rfc2865.h>
+#include <freeradius-devel/protocol/radius/rfc2865.h>
#include <ctype.h>
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/server/pairmove.h>
-#include <freeradius-devel/rfc2865.h>
-#include <freeradius-devel/attributes.h>
+#include <freeradius-devel/protocol/radius/rfc2865.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <ctype.h>
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/proto.h>
-#include <freeradius-devel/freeradius.snmp.h>
+#include <freeradius-devel/protocol/snmp/freeradius.h>
#define FR_FREERADIUS_SNMP_TYPE_OBJECT 0
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/radius/defs.h>
-#include <freeradius-devel/attributes.h>
+
#ifdef WITH_STATS
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/attributes.h>
+
static CONF_SECTION const *trigger_exec_main, *trigger_exec_subcs;
static rbtree_t *trigger_last_fired_tree;
#include <freeradius-devel/unlang/base.h>
-#include <freeradius-devel/attributes.h>
+
/*
* Ordered by component
#include <freeradius-devel/unlang/base.h>
#include <freeradius-devel/unlang/unlang_priv.h> /* Remove when everything uses new xlat API */
-#include <freeradius-devel/attributes.h>
+
#include <ctype.h>
#include "xlat_priv.h"
#include <freeradius-devel/server/pair.h>
#include <freeradius-devel/util/misc.h>
-#include <freeradius-devel/attributes.h>
+
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <openssl/x509v3.h>
#include <ctype.h>
#endif
#include <freeradius-devel/radius/defs.h>
#include <freeradius-devel/radius/radius.h>
-#include <freeradius-devel/rfc2865.h>
+#include <freeradius-devel/protocol/radius/rfc2865.h>
#include <freeradius-devel/util/conf.h>
#include <freeradius-devel/util/hash.h>
#include <freeradius-devel/util/misc.h>
if ((fp = fopen(fn, "r")) == NULL) {
if (!src_file) {
- fr_strerror_printf_push("%s: Couldn't open dictionary '%s': %s",
- "Error reading dictionary", fn, fr_syserror(errno));
+ fr_strerror_printf_push("Couldn't open dictionary %s: %s", fr_syserror(errno), fn);
} else {
- fr_strerror_printf_push("%s: %s[%d]: Couldn't open dictionary '%s': %s",
- "Error reading dictionary", src_file, src_line, fn,
+ fr_strerror_printf_push("Error reading dictionary: %s[%d]: Couldn't open dictionary '%s': %s",
+ src_file, src_line, fn,
fr_syserror(errno));
}
return -2;
if (!S_ISREG(statbuf.st_mode)) {
fclose(fp);
- fr_strerror_printf_push("%s: Dictionary '%s' is not a regular file", "Error reading dictionary", fn);
+ fr_strerror_printf_push("Dictionary is not a regular file: %s", fn);
return -1;
}
#ifdef S_IWOTH
if ((statbuf.st_mode & S_IWOTH) != 0) {
fclose(fp);
- fr_strerror_printf_push("%s: Dictionary '%s' is globally writable. Refusing to start "
- "due to insecure configuration", "Error reading dictionary", fn);
+ fr_strerror_printf_push("Dictionary is globally writable: %s. "
+ "Refusing to start due to insecure configuration", fn);
return -1;
}
#endif
if (strcmp(p->proto, "freeradius") == 0) {
if (fr_dict_from_file(&dict, FR_DICTIONARY_FILE) < 0) return -1;
} else {
- /*
- * FIXME - Temporarily disabled
- */
-#if 0
if (fr_dict_protocol_afrom_file(&dict, p->proto) < 0) return -1;
-#else
- continue;
-#endif
}
if (p->out) *(p->out) = dict;
*/
RCSID("$Id$")
-#include "pair.h"
-
-#include <freeradius-devel/rfc2865.h>
-#include <freeradius-devel/attributes.h>
#include <freeradius-devel/util/regex.h>
#include <freeradius-devel/util/talloc.h>
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/print.h>
#include <freeradius-devel/util/pair_cursor.h>
+#include <freeradius-devel/protocol/radius/rfc2865.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
+
#include <ctype.h>
+#include "pair.h"
+
#ifndef NDEBUG
# define FREE_MAGIC (0xF4EEF4EE)
#endif
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/dhcpv4/dhcpv4.h>
-#include <freeradius-devel/dhcpv4.h>
+#include <freeradius-devel/protocol/dhcpv4/rfc2131.h>
static fr_dict_t *dict_dhcpv4;
#include <freeradius-devel/server/state.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
+
#ifndef USEC
#define USEC (1000000)
#endif
/*
* Handle hard-coded Accept and Reject.
*/
- if (auth_type->vp_uint32 == FR_AUTH_TYPE_ACCEPT) {
+ if (auth_type->vp_uint32 == FR_AUTH_TYPE_VALUE_ACCEPT) {
RDEBUG2("%pP, allowing user", auth_type);
request->reply->code = FR_CODE_ACCESS_ACCEPT;
goto setup_send;
}
- if (auth_type->vp_uint32 == FR_AUTH_TYPE_REJECT) {
+ if (auth_type->vp_uint32 == FR_AUTH_TYPE_VALUE_REJECT) {
RDEBUG2("%pP, rejecting user", auth_type);
request->reply->code = FR_CODE_ACCESS_REJECT;
goto setup_send;
#include <freeradius-devel/tacacs/tacacs.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
+
typedef struct {
uint32_t session_timeout; //!< Maximum time between rounds.
uint32_t max_sessions; //!< Maximum ongoing sessions.
/*
* Handle hard-coded Accept and Reject.
*/
- if (auth_type->vp_uint32 == FR_AUTH_TYPE_ACCEPT) {
+ if (auth_type->vp_uint32 == FR_AUTH_TYPE_VALUE_ACCEPT) {
RDEBUG2("Auth-Type = Accept, allowing user");
tacacs_status(request, RLM_MODULE_OK);
goto setup_send;
}
- if (auth_type->vp_uint32 == FR_AUTH_TYPE_REJECT) {
+ if (auth_type->vp_uint32 == FR_AUTH_TYPE_VALUE_REJECT) {
RDEBUG2("Auth-Type = Reject, rejecting user");
tacacs_status(request, RLM_MODULE_REJECT);
goto setup_send;
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/unlang/base.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/protocol/vqp/vqp.h>
+
#include "proto_vmps.h"
extern fr_app_t proto_vmps;
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/vqp/vqp.h>
+#include <freeradius-devel/protocol/vqp/vqp.h>
+
static fr_dict_t *dict_vmps;
extern fr_dict_autoload_t proto_vmps_all_dict[];
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/schedule.h>
#include <freeradius-devel/server/rad_assert.h>
+
+#include <freeradius-devel/protocol/vqp/vqp.h>
+
#include "proto_vmps.h"
extern fr_app_io_t proto_vmps_udp;
#include <stdio.h>
#include <stdlib.h>
-#include <freeradius-devel/eap.sim.h>
+#include <freeradius-devel/protocol/eap/sim/dictionary.h>
#include "eap_types.h"
#include "sim_proto.h"
*
* @copyright 2016 The FreeRADIUS server project
*/
-#include <freeradius-devel/eap.aka.h>
+#include <freeradius-devel/protocol/eap/aka/dictionary.h>
#define EAP_AKA_AUTS_SIZE 14 //!< Server sequence number. SIM checks this
//!< is within the correct range.
*
* @copyright 2016 The FreeRADIUS server project
*/
-#include <freeradius-devel/eap.sim.h>
+#include <freeradius-devel/protocol/eap/sim/dictionary.h>
#define EAP_SIM_VERSION 1
#define EAP_SIM_NONCE_MT_SIZE 16 //!< Length of challenge from SIM client.
*/
#include <freeradius-devel/server/rad_assert.h>
#include <freeradius-devel/util/dict.h>
-#include <freeradius-devel/eap.sim.h>
-#include <freeradius-devel/eap.aka.h>
+#include <freeradius-devel/protocol/eap/sim/dictionary.h>
+#include <freeradius-devel/protocol/eap/sim/rfc4187.h>
+#include <freeradius-devel/protocol/eap/aka/dictionary.h>
+#include <freeradius-devel/protocol/eap/aka/rfc4187.h>
/*
* Sanity check on dictionaries...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/dl.h>
+#include <freeradius-devel/server/dl.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include "rlm_eap.h"
extern rad_module_t rlm_eap;
#include "sim_proto.h"
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/protocol/eap/aka/rfc4187.h>
#ifndef EAP_TLS_MPPE_KEY_LEN
# define EAP_TLS_MPPE_KEY_LEN 32
#include "sim_proto.h"
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/protocol/eap/sim/rfc4187.h>
#ifndef EAP_TLS_MPPE_KEY_LEN
# define EAP_TLS_MPPE_KEY_LEN 32
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/eap.aka.h>
-#include <freeradius-devel/eap.sim.h>
+#include <freeradius-devel/protocol/eap/aka/dictionary.h>
+#include <freeradius-devel/protocol/eap/sim/dictionary.h>
#include <freeradius-devel/unlang/base.h>
#include <freeradius-devel/server/module.h>
#include "sigtran.h"
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/server/rad_assert.h>
+#include <freeradius-devel/protocol/radius/freeradius.h>
+
/*
* @todo - also get the statistics from the network side for
* that, though, we need a way to find other network
#include <freeradius-devel/util/types.h>
#include <freeradius-devel/util/proto.h>
#include <freeradius-devel/dhcpv4/dhcpv4.h>
-#include <freeradius-devel/rfc2865.h>
+#include <freeradius-devel/protocol/radius/rfc2865.h>
#include <freeradius-devel/io/test_point.h>
static ssize_t decode_tlv(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dict_attr_t const *parent,
#include <freeradius-devel/util/pcap.h>
#include <freeradius-devel/util/packet.h>
-#include <freeradius-devel/dhcpv4.h>
+#include <freeradius-devel/protocol/dhcpv4/rfc2131.h>
#define DHCP_CHADDR_LEN (16)
#define DHCP_SNAME_LEN (64)
#include <freeradius-devel/util/base.h>
#include <freeradius-devel/util/pair.h>
#include <freeradius-devel/util/types.h>
-#include <freeradius-devel/dhcpv4.h>
+#include <freeradius-devel/protocol/dhcpv4/rfc2131.h>
#include "dhcpv4.h"
#include "attrs.h"
RCSIDH(dhcpv6_h, "$Id$")
#include <freeradius-devel/util/dict.h>
-#include <freeradius-devel/attributes.h>
-#include <freeradius-devel/dhcpv6.h>
+
+#include <freeradius-devel/protocol/dhcpv6/dictionary.h>
extern size_t const fr_dhcpv6_attr_sizes[FR_TYPE_MAX + 1][2];
extern fr_dict_attr_t const *dhcpv6_root;
*/
#define MAX_PACKET_LEN 4096
-#include <freeradius-devel/rfc2865.h>
-#include <freeradius-devel/rfc2866.h>
-#include <freeradius-devel/rfc2867.h>
-#include <freeradius-devel/rfc2868.h>
-#include <freeradius-devel/rfc2869.h>
+#include <freeradius-devel/protocol/radius/rfc2865.h>
+#include <freeradius-devel/protocol/radius/rfc2866.h>
+#include <freeradius-devel/protocol/radius/rfc2867.h>
+#include <freeradius-devel/protocol/radius/rfc2868.h>
+#include <freeradius-devel/protocol/radius/rfc2869.h>
-#include <freeradius-devel/rfc3162.h>
-#include <freeradius-devel/rfc3576.h>
-#include <freeradius-devel/rfc3580.h>
+#include <freeradius-devel/protocol/radius/rfc3162.h>
+#include <freeradius-devel/protocol/radius/rfc3576.h>
+#include <freeradius-devel/protocol/radius/rfc3580.h>
-#include <freeradius-devel/rfc4072.h>
-#include <freeradius-devel/rfc4372.h>
+#include <freeradius-devel/protocol/radius/rfc4072.h>
+#include <freeradius-devel/protocol/radius/rfc4372.h>
#define FR_CUI FR_CHARGEABLE_USER_IDENTITY
-#include <freeradius-devel/rfc4675.h>
-#include <freeradius-devel/rfc4818.h>
-#include <freeradius-devel/rfc4849.h>
+#include <freeradius-devel/protocol/radius/rfc4675.h>
+#include <freeradius-devel/protocol/radius/rfc4818.h>
+#include <freeradius-devel/protocol/radius/rfc4849.h>
-#include <freeradius-devel/rfc5580.h>
-#include <freeradius-devel/rfc5607.h>
-#include <freeradius-devel/rfc5904.h>
+#include <freeradius-devel/protocol/radius/rfc5580.h>
+#include <freeradius-devel/protocol/radius/rfc5607.h>
+#include <freeradius-devel/protocol/radius/rfc5904.h>
-#include <freeradius-devel/rfc6572.h>
-#include <freeradius-devel/rfc6677.h>
-#include <freeradius-devel/rfc6911.h>
-#include <freeradius-devel/rfc6929.h>
-#include <freeradius-devel/rfc6930.h>
+#include <freeradius-devel/protocol/radius/rfc6572.h>
+#include <freeradius-devel/protocol/radius/rfc6677.h>
+#include <freeradius-devel/protocol/radius/rfc6911.h>
+#include <freeradius-devel/protocol/radius/rfc6929.h>
+#include <freeradius-devel/protocol/radius/rfc6930.h>
-#include <freeradius-devel/rfc7055.h>
-#include <freeradius-devel/rfc7155.h>
-#include <freeradius-devel/rfc7268.h>
-#include <freeradius-devel/rfc7930.h>
+#include <freeradius-devel/protocol/radius/rfc7055.h>
+#include <freeradius-devel/protocol/radius/rfc7155.h>
+#include <freeradius-devel/protocol/radius/rfc7268.h>
+#include <freeradius-devel/protocol/radius/rfc7930.h>
/*
* All internal attributes are now defined in this file.
*/
-#include <freeradius-devel/attributes.h>
-
-#include <freeradius-devel/freeradius.h>
-
-#include <freeradius-devel/vqp.h>
+#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#define FR_DIGEST_RESPONSE 206
#define FR_DIGEST_ATTRIBUTES 207
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/util/md5.h>
#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/tacacs.h>
+#include <freeradius-devel/protocol/tacacs/dictionary.h>
#include "tacacs.h"
#include "attrs.h"
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/tacacs.h>
+#include <freeradius-devel/protocol/tacacs/dictionary.h>
#include "tacacs.h"
#include "attrs.h"
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/server/rad_assert.h>
-#include <freeradius-devel/tacacs.h>
+#include <freeradius-devel/protocol/tacacs/dictionary.h>
#include "tacacs.h"
#include "attrs.h"
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/udp.h>
-#include <freeradius-devel/vqp.h>
+#include <freeradius-devel/protocol/vqp/vqp.h>
#include "vqp.h"
.bar
.request
*.ok
-dictionary
test.conf
radius.log
radiusd.pid
# example.com stripped.example.com
SECRET := testing123
-.PHONY: all eap dictionary clean
+.PHONY: all eap clean
#
# Build the directory for testing the server
all: parse tests
clean:
- @rm -f test.conf dictionary *.ok *.log
+ @rm -f test.conf *.ok *.log
dictionary:
- @echo "# test dictionary not install. Delete at any time." > dictionary
- @echo '$$INCLUDE ' $(top_builddir)/share/dictionary >> dictionary
- @echo '$$INCLUDE ' $(top_builddir)/src/tests/dictionary.test >> dictionary
- @echo '$$INCLUDE ' $(top_builddir)/share/dictionary.dhcpv4 >> dictionary
- @echo '$$INCLUDE ' $(top_builddir)/share/dictionary.vqp >> dictionary
+ ${Q}echo "# test dictionary not install. Delete at any time." > $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/freeradius/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/radius/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/dhcpv4/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/vqp/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/src/tests/dictionary.test >> $@
test.conf: dictionary
@echo "# test configuration file. Do not install. Delete at any time." > $@
@echo 'cadir = $${maindir}/certs' >> $@
@echo '$$INCLUDE $${testdir}/config/' >> $@
-
radiusd.pid: test.conf
@rm -f $(TEST_PATH)/gdb.log $(TEST_PATH)/radius.log
@printf "TEST-SERVER Starting server... "
- @if ! TEST_PORT=$(PORT) $(BIN_PATH)/radiusd -Pxxxxl $(TEST_PATH)/radius.log -d ${top_builddir}/src/tests -n test -D $(TEST_PATH); then\
+ @if ! TEST_PORT=$(PORT) $(BIN_PATH)/radiusd -Pxxxxl $(TEST_PATH)/radius.log -d ${top_builddir}/src/tests -n test -D "${top_builddir}/share/dictionary/"; then\
echo "failed"; \
echo "Last log entries were:"; \
tail -n 20 "$(TEST_PATH)/radius.log"; \
tests: test.conf | radiusd.kill radiusd.pid
@chmod a+x runtests.sh
@echo BIN_PATH="$(BIN_PATH)" PORT="$(PORT)" ./runtests.sh $(TESTS)
- @BIN_PATH="$(BIN_PATH)" PORT="$(PORT)" ./runtests.sh $(TESTS)
+ @BIN_PATH="$(BIN_PATH)" PORT="$(PORT)" TOP_BUILDDIR="${top_builddir}" ./runtests.sh $(TESTS)
@$(MAKE) radiusd.kill
#
$(BUILD_DIR)/tests/auth/%: $(DIR)/% $(BUILD_DIR)/tests/auth/%.attrs $(TESTBINDIR)/unit_test_module | $(BUILD_DIR)/tests/auth $(AUTH_RADDB) $(AUTH_LIBS) build.raddb
${Q}echo UNIT-TEST $(notdir $@)
- ${Q}if ! TESTDIR=$(notdir $@) $(TESTBIN)/unit_test_module -D share -d src/tests/auth/ -i $@.attrs -f $@.attrs -xx > $@.log 2>&1; then \
+ ${Q}if ! TESTDIR=$(notdir $@) $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/auth/ -i $@.attrs -f $@.attrs -xx > $@.log 2>&1; then \
if ! grep ERROR $< 2>&1 > /dev/null; then \
cat $@.log; \
echo "# $@.log"; \
- echo "TESTDIR=$(notdir $@) $(TESTBIN)/unit_test_module -D share -d src/tests/auth/ -i $@.attrs -f $@.attrs -xxx > $@.log 2>&1"; \
+ echo "TESTDIR=$(notdir $@) $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/auth/ -i $@.attrs -f $@.attrs -xxx > $@.log 2>&1"; \
exit 1; \
fi; \
FOUND=$$(grep ^$< $@.log | head -1 | sed 's/:.*//;s/.*\[//;s/\].*//'); \
if [ "$$EXPECTED" != "$$FOUND" ]; then \
cat $@.log; \
echo "# $@.log"; \
- echo "TESTDIR=$(notdir $@) $(TESTBIN)/unit_test_module -D share -d src/tests/auth/ -i $@.attrs -f $@.attrs -xxx > $@.log 2>&1"; \
+ echo "TESTDIR=$(notdir $@) $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/auth/ -i $@.attrs -f $@.attrs -xxx > $@.log 2>&1"; \
exit 1; \
fi \
fi
#
$(BUILD_DIR)/tests/daemon/radiusd.log: $(BUILD_DIR)/tests/daemon/radiusd.version
${Q}rm -f $@
- ${Q}tmux -L $(TMUX_KEY) new-session -d './$(TESTBIN)/radiusd -i 127.0.0.1 -p $(TMUX_PORT) -fxx -d ./raddb -D share -l $@'
+ ${Q}tmux -L $(TMUX_KEY) new-session -d './$(TESTBIN)/radiusd -i 127.0.0.1 -p $(TMUX_PORT) -fxx -d ./raddb -D share/dictionary -l $@'
radiusd.start: $(BUILD_DIR)/tests/daemon/radiusd.log
# Create the output directory
#
.PHONY: $(BUILD_DIR)/tests/dict
-$(BUILD_DIR)/tests/dict:
+$(BUILD_DIR)/tests/dict/radius:
${Q}mkdir -p $@
FILES := $(wildcard $(DIR)/*.dict)
${Q}echo UNIT-TEST $(notdir $@)
${Q}mkdir -p $@_dir
${Q}cp $< $@_dir/dictionary
+ ${Q}ln -sf ${top_srcdir}/share/dictionary/radius $@_dir/
+ ${Q}ln -sf ${top_srcdir}/share/dictionary/dhcp $@_dir/
${Q}if ! $(TESTBIN)/unit_test_attribute -D $@_dir $(dir $<)/empty.txt; then \
echo "$(TESTBIN)/unit_test_attribute -D $@_dir $(dir $<)/empty.txt"; \
exit 1; \
$(CONFIG_PATH)/methods-enabled/%: $(BUILD_DIR)/lib/rlm_eap_%.la | $(CONFIG_PATH)/methods-enabled
${Q}ln -sf $(CONFIG_PATH)/methods-available/$(notdir $@) $(CONFIG_PATH)/methods-enabled/
-.PHONY: eap dictionary clean clean.tests.eap
+.PHONY: eap clean clean.tests.eap
clean: clean.tests.eap
#
clean.tests.eap:
${Q}rm -f $(OUTPUT_DIR)/*.ok $(OUTPUT_DIR)/*.log $(OUTPUT_DIR)/eapol_test.skip
${Q}rm -f "$(CONFIG_PATH)/test.conf"
- ${Q}rm -f "$(CONFIG_PATH)/dictionary"
${Q}rm -rf "$(CONFIG_PATH)/methods-enabled"
ifneq "$(EAPOL_TEST)" ""
$(CONFIG_PATH)/dictionary:
${Q}echo "# test dictionary not install. Delete at any time." > $@
- ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/freeradius/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/radius/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/dhcpv4/dictionary >> $@
+ ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary/vqp/dictionary >> $@
${Q}echo '$$INCLUDE ' $(top_builddir)/src/tests/dictionary.test >> $@
- ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary.dhcpv4 >> $@
- ${Q}echo '$$INCLUDE ' $(top_builddir)/share/dictionary.vqp >> $@
$(CONFIG_PATH)/test.conf: $(CONFIG_PATH)/dictionary src/tests/eapol_test/all.mk
${Q}echo "# test configuration file. Do not install. Delete at any time." > $@
${Q}make -C src/tests/certs verify
${Q}rm -f $(GDB_LOG) $(RADIUS_LOG)
${Q}printf "Starting EAP test server... "
- ${Q}if ! TEST_PORT=$(PORT) $(JLIBTOOL) --mode=execute $(BIN_PATH)/radiusd -Pxxxl $(RADIUS_LOG) -d $(CONFIG_PATH) -n test -D $(CONFIG_PATH); then\
+ ${Q}if ! TEST_PORT=$(PORT) $(JLIBTOOL) --mode=execute $(BIN_PATH)/radiusd -Pxxxl $(RADIUS_LOG) -d $(CONFIG_PATH) -n test -D "${top_builddir}/share/dictionary/"; then\
echo "FAILED STARTING RADIUSD"; \
tail -n 40 "$(RADIUS_LOG)"; \
echo "Last entries in server log ($(RADIUS_LOG)):"; \
$(EAPOL_TEST) -t 2 -c $< -p $(PORT) -s $(SECRET) > $(patsubst %.conf,%.log,$@) 2>&1; then\
touch $@; \
else \
- echo "Last entries in supplicant log ($(patsubst %.conf,%.log,$<)):"; \
- tail -n 40 "$(patsubst %.conf,%.log,$<)"; \
+ echo "Last entries in supplicant log ($(patsubst %.conf,%.log,$@)):"; \
+ tail -n 40 "$(patsubst %.conf,%.log,$@)"; \
echo "--------------------------------------------------"; \
tail -n 40 "$(RADIUS_LOG)"; \
echo "Last entries in server log ($(RADIUS_LOG)):"; \
echo "--------------------------------------------------"; \
- echo "TEST_PORT=$(PORT) $(JLIBTOOL) --mode=execute $(BIN_PATH)/radiusd -PX -d \"$(CONFIG_PATH)\" -n test -D \"$(CONFIG_PATH)\""; \
+ echo "TEST_PORT=$(PORT) $(JLIBTOOL) --mode=execute $(BIN_PATH)/radiusd -PXxx -d \"$(CONFIG_PATH)\" -n test -D \"${top_builddir}/share/dictionary/\""; \
echo "$(EAPOL_TEST) -c \"$<\" -p $(PORT) -s $(SECRET)"; \
$(MAKE) radiusd.kill; \
exit 1;\
if ! grep ERROR $< 2>&1 > /dev/null; then \
cat $@.log; \
echo "# $@.log"; \
- echo KEYWORD=$(notdir $@) $(TESTBIN)/unit_test_module -D share -d src/tests/keywords/ -i $@.attrs -f $@.attrs -xx; \
+ echo KEYWORD=$(notdir $@) $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/keywords/ -i $@.attrs -f $@.attrs -xx; \
exit 1; \
fi; \
FOUND=$$(grep -E '^(Error : )?$<' $@.log | head -1 | sed 's/.*\[//;s/\].*//'); \
if [ "$$EXPECTED" != "$$FOUND" ]; then \
cat $@.log; \
echo "# $@.log"; \
- echo KEYWORD=$(notdir $@) $(TESTBIN)/unit_test_module -D share -d src/tests/keywords/ -i $@.attrs -f $@.attrs -xx; \
+ echo KEYWORD=$(notdir $@) $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/keywords/ -i $@.attrs -f $@.attrs -xx; \
exit 1; \
fi \
fi
#
$(BUILD_DIR)/tests/map/%.out: $(top_srcdir)/src/tests/map/%
${Q}echo MAP_TEST $(notdir $<)
- ${Q}if ! $(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share $< > $@ 2>&1; then \
+ ${Q}if ! $(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary $< > $@ 2>&1; then \
if ! grep ERROR $< 2>&1 > /dev/null; then \
cat $@; \
echo "# $@"; \
cat $@; \
echo "# $@"; \
echo "E $$EXPECTED F $$FOUND"; \
- echo UNEXPECTED ERROR: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share $<"; \
+ echo UNEXPECTED ERROR: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary $<"; \
exit 1; \
fi; \
else \
if ! diff $<.out $@; then \
echo FAILED: " diff $<.out $@"; \
- echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share $<"; \
+ echo FAILED: "$(MAP_UNIT) -d $(top_srcdir)/raddb -D $(top_srcdir)/share/dictionary $<"; \
exit 1; \
fi; \
fi
echo 'Test-Number = ' $NUMBER >> .request
rm ./radclient.log > /dev/null 2>&1
- $BIN_PATH/radclient -f .request -xF -D ./ 127.0.0.1:$PORT auth $SECRET 1> ./radclient.log
+ $BIN_PATH/radclient -f .request -xF -d "${TOP_BUILDDIR}/src/tests" -D "${TOP_BUILDDIR}/share/dictionary" 127.0.0.1:$PORT auth $SECRET 1> ./radclient.log
if [ "$?" = "0" ]; then
echo "${BASE}_${NUMBER} : Success"
else
echo "${BASE}_${NUMBER} : FAILED"
+ echo "$BIN_PATH/radclient -f .request -xF -d "${TOP_BUILDDIR}/src/tests" -D "${TOP_BUILDDIR}/share/dictionary" 127.0.0.1:$PORT auth $SECRET"
cat ./radclient.log
RCODE=1
fi
# We need $INCLUDE in the output file, so we pass 2 parameters to 'echo'
# No idea how portable that is...
#
-$(BUILD_DIR)/share/dictionary: $(top_srcdir)/share/dictionary $(top_srcdir)/share/dictionary.dhcpv4 $(top_srcdir)/src/tests/unit/dictionary.unit | $(BUILD_DIR)/share
+$(BUILD_DIR)/share/dictionary: $(top_srcdir)/share/dictionary $(top_srcdir)/share/dictionary/dhcpv4/dictionary $(top_srcdir)/src/tests/unit/dictionary.unit | $(BUILD_DIR)/share
${Q}rm -f $@
${Q}for x in $^; do \
echo '$$INCLUDE ' "$$x" >> $@; \
#
$(BUILD_DIR)/tests/xlat/%: $(DIR)/% $(TESTBINDIR)/unit_test_module | $(BUILD_DIR)/tests/xlat build.raddb
${Q}echo XLAT-TEST $(notdir $@)
- ${Q}if ! $(TESTBIN)/unit_test_module -D share -d src/tests/xlat/ -i $< -xx -O xlat_only > $@.log 2>&1; then \
+ ${Q}if ! $(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/xlat/ -i $< -xx -O xlat_only > $@.log 2>&1; then \
cat $@.log; \
- echo "./$(TESTBIN)/unit_test_module -D share -d src/tests/xlat/ -i $< -xx -O xlat_only"; \
+ echo "./$(TESTBIN)/unit_test_module -D share/dictionary -d src/tests/xlat/ -i $< -xx -O xlat_only"; \
exit 1; \
fi
${Q}touch $@