From: Alan T. DeKok Date: Mon, 13 Feb 2012 20:10:16 +0000 (+0100) Subject: Added provisions for "site local" dictionaries X-Git-Tag: release_3_0_0_beta0~314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c47141b2030ff834d382cae22fea212423c413f;p=thirdparty%2Ffreeradius-server.git Added provisions for "site local" dictionaries --- diff --git a/raddb/dictionary.in b/raddb/dictionary.in index 9e251f07a38..ef22be9fab4 100644 --- a/raddb/dictionary.in +++ b/raddb/dictionary.in @@ -5,6 +5,8 @@ # Any new/changed attributes MUST be placed in this file, as # the pre-defined dictionaries SHOULD NOT be edited. # +# See "man dictionary" for documentation on its format. +# # $Id$ # @@ -26,19 +28,38 @@ $INCLUDE @prefix@/share/freeradius/dictionary # -# Place additional attributes or $INCLUDEs here. They will -# over-ride the definitions in the pre-defined dictionaries. -# -# See the 'man' page for 'dictionary' for information on -# the format of the dictionary files. +# All additional attributes an $INCLUDE's should go into +# a file "dictionary.local". -# # If you want to add entries to the dictionary file, # which are NOT going to be placed in a RADIUS packet, -# add them here. The numbers you pick should be between -# 3000 and 4000. +# add them to the 'dictionary.local' file. +# +# The numbers you pick should be between 3000 and 4000. +# These attributes will NOT go into a RADIUS packet. +# +# If you want that, you will need to use VSAs. This means +# requesting allocation of a Private Enterprise Code from +# http://iana.org. We STRONGLY suggest doing that only if +# you are a vendor of RADIUS equipment. +# +# See RFC 6158 for more details. +# http://ietf.org/rfc/rfc6158.txt # +# +# These attributes are examples. Don't edit them here. +# Instead, create a "dictionary.local" file, and place +# them there. +# #ATTRIBUTE My-Local-String 3000 string #ATTRIBUTE My-Local-IPAddr 3001 ipaddr #ATTRIBUTE My-Local-Integer 3002 integer + +# +# Include dictionary.local, IF it exists. Otherwise, ignore it. +# +# This file WILL NOT EVER be created, edited, or modified +# by FreeRADIUS. +# +$INCLUDE- dictionary.local diff --git a/src/lib/dict.c b/src/lib/dict.c index 9c166b1fb03..9bf637cabce 100644 --- a/src/lib/dict.c +++ b/src/lib/dict.c @@ -1796,7 +1796,7 @@ static int my_dict_init(const char *dir, const char *fn, fr_strerror_printf("dict_init: %s[%d]: Couldn't open dictionary \"%s\": %s", src_file, src_line, fn, strerror(errno)); } - return -1; + return -2; } stat(fn, &statbuf); /* fopen() guarantees this will succeed */ @@ -1889,6 +1889,21 @@ static int my_dict_init(const char *dir, const char *fn, continue; } /* $INCLUDE */ + /* + * Optionally include a dictionary + */ + if (strcasecmp(argv[0], "$INCLUDE-") == 0) { + int rcode = my_dict_init(dir, argv[1], fn, line); + + if (rcode == -2) continue; + + if (rcode < 0) { + fclose(fp); + return -1; + } + continue; + } /* $INCLUDE- */ + if (strcasecmp(argv[0], "VALUE-ALIAS") == 0) { if (process_value_alias(fn, line, argv + 1, argc - 1) == -1) {