]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Added provisions for "site local" dictionaries
authorAlan T. DeKok <aland@freeradius.org>
Mon, 13 Feb 2012 20:10:16 +0000 (21:10 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 13 Feb 2012 20:10:16 +0000 (21:10 +0100)
raddb/dictionary.in
src/lib/dict.c

index 9e251f07a387f96c70df9071989e6db9774ce714..ef22be9fab490076d8eaf450044108a9c854beb6 100644 (file)
@@ -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$
 #
 
 $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
index 9c166b1fb0323f22fe2fa0d72d753d4b1574b020..9bf637cabcead9e58b0e5f99f7b83342397d5d77 100644 (file)
@@ -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) {