From: Arran Cudbard-Bell Date: Tue, 16 Oct 2018 19:47:26 +0000 (-0400) Subject: Fixup build system to create hierarchical header files from the protocols X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c23c0fdb9e26b09aec1bbb15aaa2eeea64cc7d8;p=thirdparty%2Ffreeradius-server.git Fixup build system to create hierarchical header files from the protocols Fixup dictionary directory arguments to test utilities Fix includes to use new paths --- diff --git a/Makefile b/Makefile index 1a0e967b890..1d8509418b6 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,8 @@ raddb/test.conf: # 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"; \ @@ -108,11 +109,11 @@ endif # 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*/*.?) diff --git a/configure b/configure index 093d3af2718..ca19724e5d6 100755 --- a/configure +++ b/configure @@ -5606,7 +5606,7 @@ fi { $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; } diff --git a/configure.ac b/configure.ac index 3998694f645..662c21894e3 100644 --- a/configure.ac +++ b/configure.ac @@ -515,7 +515,7 @@ AC_MSG_RESULT($raddbdir) 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] ], diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index 6b9cdad47e5..1e922abd1cc 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -40,6 +40,8 @@ RCSID("$Id$") #include +#include + #ifdef HAVE_GETOPT_H # include #endif @@ -960,11 +962,11 @@ int main(int argc, char *argv[]) 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; diff --git a/src/include/.gitignore b/src/include/.gitignore index 3462b5c45bc..899248e1302 100644 --- a/src/include/.gitignore +++ b/src/include/.gitignore @@ -3,18 +3,14 @@ autoconf.h 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 diff --git a/src/include/all.mk b/src/include/all.mk index 20a15e72128..0395c76bd2b 100644 --- a/src/include/all.mk +++ b/src/include/all.mk @@ -11,13 +11,13 @@ # # 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 ] # @@ -37,39 +37,38 @@ src/include/autoconf.sed: src/include/autoconf.h # 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. @@ -113,18 +112,45 @@ scan: $(BOOTSTRAP_BUILD) # 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 ]*\)>/#\1include /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 + diff --git a/src/lib/server/auth.c b/src/lib/server/auth.c index 09b5e90646d..3ba463b231e 100644 --- a/src/lib/server/auth.c +++ b/src/lib/server/auth.c @@ -37,7 +37,7 @@ RCSID("$Id$") #include -#include +#include #include diff --git a/src/lib/server/client.c b/src/lib/server/client.c index bdcfc74c92c..6701fcd26b2 100644 --- a/src/lib/server/client.c +++ b/src/lib/server/client.c @@ -33,7 +33,7 @@ RCSID("$Id$") #include #include -#include + #include #include diff --git a/src/lib/server/cond_tokenize.c b/src/lib/server/cond_tokenize.c index 072772035d4..a9fcb38e160 100644 --- a/src/lib/server/cond_tokenize.c +++ b/src/lib/server/cond_tokenize.c @@ -29,7 +29,7 @@ RCSID("$Id$") #include #include -#include + #include diff --git a/src/lib/server/exec.c b/src/lib/server/exec.c index 3e28dad248c..70b29dc1a11 100644 --- a/src/lib/server/exec.c +++ b/src/lib/server/exec.c @@ -34,7 +34,7 @@ RCSID("$Id$") #include #include -#include +#include #include diff --git a/src/lib/server/exfile.c b/src/lib/server/exfile.c index da7147d5506..25a20b1d9a4 100644 --- a/src/lib/server/exfile.c +++ b/src/lib/server/exfile.c @@ -29,7 +29,7 @@ #include -#include + #include #include diff --git a/src/lib/server/map.c b/src/lib/server/map.c index da99cdd1b51..1e6f34b50b8 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -36,8 +36,8 @@ RCSID("$Id$") #include #include -#include -#include +#include +#include #include diff --git a/src/lib/server/paircmp.c b/src/lib/server/paircmp.c index ebdb18f4858..58290cf0628 100644 --- a/src/lib/server/paircmp.c +++ b/src/lib/server/paircmp.c @@ -34,7 +34,7 @@ RCSID("$Id$") #include #include -#include +#include #include diff --git a/src/lib/server/pairmove.c b/src/lib/server/pairmove.c index c86457eae9b..18f50af6155 100644 --- a/src/lib/server/pairmove.c +++ b/src/lib/server/pairmove.c @@ -29,8 +29,8 @@ RCSID("$Id$") #include #include -#include -#include +#include +#include #include diff --git a/src/lib/server/snmp.c b/src/lib/server/snmp.c index 3e077fca66a..e654ea9ff8a 100644 --- a/src/lib/server/snmp.c +++ b/src/lib/server/snmp.c @@ -33,7 +33,7 @@ RCSID("$Id$") #include #include -#include +#include #define FR_FREERADIUS_SNMP_TYPE_OBJECT 0 diff --git a/src/lib/server/stats.c b/src/lib/server/stats.c index 39e707004c1..4f8df8df211 100644 --- a/src/lib/server/stats.c +++ b/src/lib/server/stats.c @@ -29,7 +29,7 @@ RCSID("$Id$") #include #include -#include + #ifdef WITH_STATS diff --git a/src/lib/server/trigger.c b/src/lib/server/trigger.c index 6f03d2e920e..a78586db5e7 100644 --- a/src/lib/server/trigger.c +++ b/src/lib/server/trigger.c @@ -29,7 +29,7 @@ RCSID("$Id$") #include #include -#include + static CONF_SECTION const *trigger_exec_main, *trigger_exec_subcs; static rbtree_t *trigger_last_fired_tree; diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index 71fe6d9922f..de5c3dadc3e 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -39,7 +39,7 @@ RCSID("$Id$") #include -#include + /* * Ordered by component diff --git a/src/lib/server/xlat_eval.c b/src/lib/server/xlat_eval.c index ba5dfc68fac..cdeb080dd7b 100644 --- a/src/lib/server/xlat_eval.c +++ b/src/lib/server/xlat_eval.c @@ -36,7 +36,7 @@ RCSID("$Id$") #include #include /* Remove when everything uses new xlat API */ -#include + #include #include "xlat_priv.h" diff --git a/src/lib/tls/session.c b/src/lib/tls/session.c index 9cbd5f85cd3..e99aa047617 100644 --- a/src/lib/tls/session.c +++ b/src/lib/tls/session.c @@ -32,7 +32,8 @@ #include #include -#include + +#include #include #include diff --git a/src/lib/util/dict.c b/src/lib/util/dict.c index 89d492227d8..6dbe9ba8509 100644 --- a/src/lib/util/dict.c +++ b/src/lib/util/dict.c @@ -29,7 +29,7 @@ RCSID("$Id$") #endif #include #include -#include +#include #include #include #include @@ -4502,11 +4502,10 @@ static int _dict_from_file(dict_from_file_ctx_t *ctx, 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; @@ -4522,7 +4521,7 @@ static int _dict_from_file(dict_from_file_ctx_t *ctx, 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; } @@ -4533,8 +4532,8 @@ static int _dict_from_file(dict_from_file_ctx_t *ctx, #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 @@ -5394,14 +5393,7 @@ int fr_dict_autoload(fr_dict_autoload_t const *to_load) 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; diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index acf9e3aaf1c..15ee3325230 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -22,10 +22,6 @@ */ RCSID("$Id$") -#include "pair.h" - -#include -#include #include #include #include @@ -33,8 +29,13 @@ RCSID("$Id$") #include #include +#include +#include + #include +#include "pair.h" + #ifndef NDEBUG # define FREE_MAGIC (0xF4EEF4EE) #endif diff --git a/src/modules/proto_dhcpv4/proto_dhcpv4_base.c b/src/modules/proto_dhcpv4/proto_dhcpv4_base.c index f3bf0abcf50..89de421dbdb 100644 --- a/src/modules/proto_dhcpv4/proto_dhcpv4_base.c +++ b/src/modules/proto_dhcpv4/proto_dhcpv4_base.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include static fr_dict_t *dict_dhcpv4; diff --git a/src/modules/proto_radius/proto_radius_auth.c b/src/modules/proto_radius/proto_radius_auth.c index 9bf9eb4af45..171dadddb77 100644 --- a/src/modules/proto_radius/proto_radius_auth.c +++ b/src/modules/proto_radius/proto_radius_auth.c @@ -30,6 +30,8 @@ #include #include +#include + #ifndef USEC #define USEC (1000000) #endif @@ -380,13 +382,13 @@ static fr_io_final_t mod_process(void const *instance, REQUEST *request, fr_io_a /* * 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; diff --git a/src/modules/proto_tacacs/proto_tacacs.c b/src/modules/proto_tacacs/proto_tacacs.c index b4f4ab742ac..b25f3d829db 100644 --- a/src/modules/proto_tacacs/proto_tacacs.c +++ b/src/modules/proto_tacacs/proto_tacacs.c @@ -30,6 +30,8 @@ #include +#include + typedef struct { uint32_t session_timeout; //!< Maximum time between rounds. uint32_t max_sessions; //!< Maximum ongoing sessions. @@ -337,13 +339,13 @@ stop_processing: /* * 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; diff --git a/src/modules/proto_vmps/proto_vmps.c b/src/modules/proto_vmps/proto_vmps.c index bccc8f1a7c7..47fbd784f8c 100644 --- a/src/modules/proto_vmps/proto_vmps.c +++ b/src/modules/proto_vmps/proto_vmps.c @@ -28,6 +28,9 @@ #include #include #include + +#include + #include "proto_vmps.h" extern fr_app_t proto_vmps; diff --git a/src/modules/proto_vmps/proto_vmps_all.c b/src/modules/proto_vmps/proto_vmps_all.c index 0b7c0b878f1..968907968e9 100644 --- a/src/modules/proto_vmps/proto_vmps_all.c +++ b/src/modules/proto_vmps/proto_vmps_all.c @@ -30,6 +30,8 @@ #include #include +#include + static fr_dict_t *dict_vmps; extern fr_dict_autoload_t proto_vmps_all_dict[]; diff --git a/src/modules/proto_vmps/proto_vmps_udp.c b/src/modules/proto_vmps/proto_vmps_udp.c index 7ec34bac4e9..bc127b849f1 100644 --- a/src/modules/proto_vmps/proto_vmps_udp.c +++ b/src/modules/proto_vmps/proto_vmps_udp.c @@ -33,6 +33,9 @@ #include #include #include + +#include + #include "proto_vmps.h" extern fr_app_io_t proto_vmps_udp; diff --git a/src/modules/rlm_eap/lib/sim/crypto.c b/src/modules/rlm_eap/lib/sim/crypto.c index d2752f5bdc8..ccee5d5d680 100644 --- a/src/modules/rlm_eap/lib/sim/crypto.c +++ b/src/modules/rlm_eap/lib/sim/crypto.c @@ -33,7 +33,7 @@ RCSID("$Id$") #include #include -#include +#include #include "eap_types.h" #include "sim_proto.h" diff --git a/src/modules/rlm_eap/lib/sim/eap_aka_common.h b/src/modules/rlm_eap/lib/sim/eap_aka_common.h index 917a88ff7fa..e149c2068cb 100644 --- a/src/modules/rlm_eap/lib/sim/eap_aka_common.h +++ b/src/modules/rlm_eap/lib/sim/eap_aka_common.h @@ -26,7 +26,7 @@ * * @copyright 2016 The FreeRADIUS server project */ -#include +#include #define EAP_AKA_AUTS_SIZE 14 //!< Server sequence number. SIM checks this //!< is within the correct range. diff --git a/src/modules/rlm_eap/lib/sim/eap_sim_common.h b/src/modules/rlm_eap/lib/sim/eap_sim_common.h index 8e0bd9697cd..1a988545d79 100644 --- a/src/modules/rlm_eap/lib/sim/eap_sim_common.h +++ b/src/modules/rlm_eap/lib/sim/eap_sim_common.h @@ -26,7 +26,7 @@ * * @copyright 2016 The FreeRADIUS server project */ -#include +#include #define EAP_SIM_VERSION 1 #define EAP_SIM_NONCE_MT_SIZE 16 //!< Length of challenge from SIM client. diff --git a/src/modules/rlm_eap/lib/sim/sim_attrs.h b/src/modules/rlm_eap/lib/sim/sim_attrs.h index e0a9a78bc6c..85181949311 100644 --- a/src/modules/rlm_eap/lib/sim/sim_attrs.h +++ b/src/modules/rlm_eap/lib/sim/sim_attrs.h @@ -22,8 +22,10 @@ */ #include #include -#include -#include +#include +#include +#include +#include /* * Sanity check on dictionaries... diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 5cada39f69e..259e5b40678 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -31,6 +31,8 @@ RCSID("$Id$") #include #include #include +#include +#include #include "rlm_eap.h" extern rad_module_t rlm_eap; diff --git a/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c b/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c index 0ddaa9fa105..62ce4a310f0 100644 --- a/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c +++ b/src/modules/rlm_eap/types/rlm_eap_aka/rlm_eap_aka.c @@ -32,6 +32,7 @@ RCSID("$Id$") #include "sim_proto.h" #include +#include #ifndef EAP_TLS_MPPE_KEY_LEN # define EAP_TLS_MPPE_KEY_LEN 32 diff --git a/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c b/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c index 4f8934f36ef..e3a9afa7640 100644 --- a/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c +++ b/src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c @@ -34,6 +34,7 @@ RCSID("$Id$") #include "sim_proto.h" #include +#include #ifndef EAP_TLS_MPPE_KEY_LEN # define EAP_TLS_MPPE_KEY_LEN 32 diff --git a/src/modules/rlm_sigtran/client.c b/src/modules/rlm_sigtran/client.c index 1b8462e5060..2e2d9d25ce0 100644 --- a/src/modules/rlm_sigtran/client.c +++ b/src/modules/rlm_sigtran/client.c @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include #include "sigtran.h" diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index b879037b1cf..f4a353a556c 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -29,6 +29,8 @@ RCSID("$Id$") #include #include +#include + /* * @todo - also get the statistics from the network side for * that, though, we need a way to find other network diff --git a/src/protocols/dhcpv4/decode.c b/src/protocols/dhcpv4/decode.c index ba24169e1af..8616b63c0be 100644 --- a/src/protocols/dhcpv4/decode.c +++ b/src/protocols/dhcpv4/decode.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include static ssize_t decode_tlv(TALLOC_CTX *ctx, fr_cursor_t *cursor, fr_dict_attr_t const *parent, diff --git a/src/protocols/dhcpv4/dhcpv4.h b/src/protocols/dhcpv4/dhcpv4.h index e1cab8ffdbc..8233420d0df 100644 --- a/src/protocols/dhcpv4/dhcpv4.h +++ b/src/protocols/dhcpv4/dhcpv4.h @@ -32,7 +32,7 @@ extern "C" { #include #include -#include +#include #define DHCP_CHADDR_LEN (16) #define DHCP_SNAME_LEN (64) diff --git a/src/protocols/dhcpv4/packet.c b/src/protocols/dhcpv4/packet.c index 247b4c4ce84..aad510ce256 100644 --- a/src/protocols/dhcpv4/packet.c +++ b/src/protocols/dhcpv4/packet.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "dhcpv4.h" #include "attrs.h" diff --git a/src/protocols/dhcpv6/dhcpv6.h b/src/protocols/dhcpv6/dhcpv6.h index 73312615a48..e1cc9ba6dd1 100644 --- a/src/protocols/dhcpv6/dhcpv6.h +++ b/src/protocols/dhcpv6/dhcpv6.h @@ -29,8 +29,8 @@ RCSIDH(dhcpv6_h, "$Id$") #include -#include -#include + +#include extern size_t const fr_dhcpv6_attr_sizes[FR_TYPE_MAX + 1][2]; extern fr_dict_attr_t const *dhcpv6_root; diff --git a/src/protocols/radius/defs.h b/src/protocols/radius/defs.h index eb49215bd03..68d50dcbb37 100644 --- a/src/protocols/radius/defs.h +++ b/src/protocols/radius/defs.h @@ -68,48 +68,44 @@ typedef enum { */ #define MAX_PACKET_LEN 4096 -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include -#include +#include +#include +#include -#include -#include +#include +#include #define FR_CUI FR_CHARGEABLE_USER_IDENTITY -#include -#include -#include +#include +#include +#include -#include -#include -#include +#include +#include +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include -#include -#include +#include +#include +#include +#include /* * All internal attributes are now defined in this file. */ -#include - -#include - -#include +#include #define FR_DIGEST_RESPONSE 206 #define FR_DIGEST_ATTRIBUTES 207 diff --git a/src/protocols/tacacs/base.c b/src/protocols/tacacs/base.c index f19a805f5ae..74924213d62 100644 --- a/src/protocols/tacacs/base.c +++ b/src/protocols/tacacs/base.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "tacacs.h" #include "attrs.h" diff --git a/src/protocols/tacacs/decode.c b/src/protocols/tacacs/decode.c index 965d4a7295c..13ddcd051b7 100644 --- a/src/protocols/tacacs/decode.c +++ b/src/protocols/tacacs/decode.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "tacacs.h" #include "attrs.h" diff --git a/src/protocols/tacacs/encode.c b/src/protocols/tacacs/encode.c index 3077bdeeaa9..5f90d9135b8 100644 --- a/src/protocols/tacacs/encode.c +++ b/src/protocols/tacacs/encode.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "tacacs.h" #include "attrs.h" diff --git a/src/protocols/vqp/vqp.c b/src/protocols/vqp/vqp.c index 37ac2fec55e..0550003fe15 100644 --- a/src/protocols/vqp/vqp.c +++ b/src/protocols/vqp/vqp.c @@ -27,7 +27,7 @@ RCSID("$Id$") #include #include -#include +#include #include "vqp.h" diff --git a/src/tests/.gitignore b/src/tests/.gitignore index 9b95b1cfe67..febd9e3cf94 100644 --- a/src/tests/.gitignore +++ b/src/tests/.gitignore @@ -3,7 +3,6 @@ .bar .request *.ok -dictionary test.conf radius.log radiusd.pid diff --git a/src/tests/Makefile b/src/tests/Makefile index cc63e9dcb9d..713ebe59652 100644 --- a/src/tests/Makefile +++ b/src/tests/Makefile @@ -25,7 +25,7 @@ PORT := 12340 # example.com stripped.example.com SECRET := testing123 -.PHONY: all eap dictionary clean +.PHONY: all eap clean # # Build the directory for testing the server @@ -33,14 +33,15 @@ SECRET := testing123 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." > $@ @@ -59,11 +60,10 @@ test.conf: dictionary @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"; \ @@ -104,5 +104,5 @@ radiusd.kill: 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 diff --git a/src/tests/auth/all.mk b/src/tests/auth/all.mk index 7bbac39b57b..1ad027bf9c5 100644 --- a/src/tests/auth/all.mk +++ b/src/tests/auth/all.mk @@ -84,11 +84,11 @@ AUTH_LIBS := $(addsuffix .la,$(addprefix rlm_,$(AUTH_MODULES))) # $(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/\].*//'); \ @@ -96,7 +96,7 @@ $(BUILD_DIR)/tests/auth/%: $(DIR)/% $(BUILD_DIR)/tests/auth/%.attrs $(TESTBINDIR 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 diff --git a/src/tests/daemon/all.mk b/src/tests/daemon/all.mk index f857abc0ef3..f8c2f12be04 100644 --- a/src/tests/daemon/all.mk +++ b/src/tests/daemon/all.mk @@ -68,7 +68,7 @@ $(BUILD_DIR)/tests/daemon/radiusd.version: $(TESTBINDIR)/radiusd # $(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 diff --git a/src/tests/dict/all.mk b/src/tests/dict/all.mk index 21f470dda82..4019caeac0c 100644 --- a/src/tests/dict/all.mk +++ b/src/tests/dict/all.mk @@ -2,7 +2,7 @@ # 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) @@ -17,6 +17,8 @@ $(BUILD_DIR)/tests/dict/%: $(DIR)/% $(BUILD_DIR)/bin/unit_test_attribute $(TESTB ${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; \ diff --git a/src/tests/eapol_test/all.mk b/src/tests/eapol_test/all.mk index 21c1dccfd13..fd5ddd78bcd 100644 --- a/src/tests/eapol_test/all.mk +++ b/src/tests/eapol_test/all.mk @@ -47,7 +47,7 @@ $(CONFIG_PATH)/methods-enabled: $(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 # @@ -83,16 +83,16 @@ radiusd.kill: | $(OUTPUT_DIR) 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." > $@ @@ -121,7 +121,7 @@ $(CONFIG_PATH)/radiusd.pid: $(CONFIG_PATH)/test.conf $(RADDB_PATH)/certs/server. ${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)):"; \ @@ -153,13 +153,13 @@ $(OUTPUT_DIR)/%.ok: $(DIR)/%.conf | radiusd.kill $(CONFIG_PATH)/radiusd.pid $(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;\ diff --git a/src/tests/keywords/all.mk b/src/tests/keywords/all.mk index fb2cd18889b..5cadf1cc05a 100644 --- a/src/tests/keywords/all.mk +++ b/src/tests/keywords/all.mk @@ -92,7 +92,7 @@ $(BUILD_DIR)/tests/keywords/%: $(DIR)/% $(BUILD_DIR)/tests/keywords/%.attrs $(TE 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/\].*//'); \ @@ -100,7 +100,7 @@ $(BUILD_DIR)/tests/keywords/%: $(DIR)/% $(BUILD_DIR)/tests/keywords/%.attrs $(TE 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 diff --git a/src/tests/map/all.mk b/src/tests/map/all.mk index ec9f5de8aa0..ead68180438 100644 --- a/src/tests/map/all.mk +++ b/src/tests/map/all.mk @@ -19,7 +19,7 @@ $(MAP_OUTPUT): $(MAP_UNIT_BIN) | $(BUILD_DIR)/tests/map/ # $(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 "# $@"; \ @@ -32,13 +32,13 @@ $(BUILD_DIR)/tests/map/%.out: $(top_srcdir)/src/tests/map/% 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 diff --git a/src/tests/runtests.sh b/src/tests/runtests.sh index cc403c6b0b6..bb653346590 100755 --- a/src/tests/runtests.sh +++ b/src/tests/runtests.sh @@ -28,11 +28,12 @@ do 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 diff --git a/src/tests/unit/all.mk b/src/tests/unit/all.mk index 76231571bc4..41f2b609a0c 100644 --- a/src/tests/unit/all.mk +++ b/src/tests/unit/all.mk @@ -47,7 +47,7 @@ $(BUILD_DIR)/share: # 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" >> $@; \ diff --git a/src/tests/xlat/all.mk b/src/tests/xlat/all.mk index 3fd83efeb57..7f070e3fa6b 100644 --- a/src/tests/xlat/all.mk +++ b/src/tests/xlat/all.mk @@ -34,9 +34,9 @@ $(BUILD_DIR)/tests/xlat: # $(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 $@