]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Added a few default variables with values
authorAlan T. DeKok <aland@freeradius.org>
Wed, 8 Dec 2010 11:23:30 +0000 (12:23 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 8 Dec 2010 11:36:53 +0000 (12:36 +0100)
So that the server can start up with minimal config file, and no
warnings

src/main/conffile.c
src/main/mainconfig.c

index 5157f140f09280887c746e7c495fe9eeffd0071e..a486ef8da39a1c2840188281d11f57cee8be84fc 100644 (file)
@@ -915,10 +915,13 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
                        /*
                         *      FIXME: sizeof(buffer)?
                         */
-                       value = cf_expand_variables("?",
+                       value = cf_expand_variables("<internal>",
                                                    &lineno,
                                                    cs, buffer, value);
-                       if (!value) return -1;
+                       if (!value) {
+                               cf_log_err(cf_sectiontoitem(cs),"Failed expanding variable %s", name);
+                               return -1;
+                       }
                }
 
                cf_log_info(cs, "\t%s = \"%s\"", name, value ? value : "(null)");
@@ -1019,9 +1022,17 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
        default:
                radlog(L_ERR, "type %d not supported yet", type);
                return -1;
-               break;
        } /* switch over variable type */
 
+       if (!cp) {
+               CONF_PAIR *cpn;
+
+               cpn = cf_pair_alloc(name, value, T_OP_SET, T_BARE_WORD, cs);
+               cpn->item.filename = "<internal>";
+               cpn->item.lineno = 0;
+               cf_item_add(cs, cf_pairtoitem(cpn));
+       }
+
        return rcode;
 }
 
index 7a7bf4b46bcfd1373b18cc3f0c783cfb2bc8e2d3..bd406c1ede635ba838ee177c5fd4adc4fe4d3302 100644 (file)
@@ -92,6 +92,9 @@ static const char *radlog_dest = NULL;
  */
 static const char *localstatedir = NULL;
 static const char *prefix = NULL;
+static const char *my_name = NULL;
+static const char *sbindir = NULL;
+static const char *run_dir = NULL;
 static char *syslog_facility = NULL;
 static const FR_NAME_NUMBER str2fac[] = {
 #ifdef LOG_KERN
@@ -210,9 +213,12 @@ static const CONF_PARSER server_config[] = {
         *      hard-coded defines for the locations of the various
         *      files.
         */
+       { "name",               PW_TYPE_STRING_PTR, 0, &my_name,          "radiusd"},
        { "prefix",             PW_TYPE_STRING_PTR, 0, &prefix,            "/usr/local"},
        { "localstatedir",      PW_TYPE_STRING_PTR, 0, &localstatedir,     "${prefix}/var"},
+       { "sbindir",            PW_TYPE_STRING_PTR, 0, &sbindir,            "${prefix}/sbin"},
        { "logdir",             PW_TYPE_STRING_PTR, 0, &radlog_dir,        "${localstatedir}/log"},
+       { "run_dir",            PW_TYPE_STRING_PTR, 0, &run_dir,           "${localstatedir}/run/${name}"},
        { "libdir",             PW_TYPE_STRING_PTR, 0, &radlib_dir,        "${prefix}/lib"},
        { "radacctdir",         PW_TYPE_STRING_PTR, 0, &radacct_dir,       "${logdir}/radacct" },
        { "hostname_lookups",   PW_TYPE_BOOLEAN,    0, &fr_dns_lookups,      "no" },