fixed bug with dynamicserver and default secret
authorvenaas <venaas>
Thu, 8 Jan 2009 08:15:15 +0000 (08:15 +0000)
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>
Thu, 8 Jan 2009 08:15:15 +0000 (08:15 +0000)
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@454 e88ac4ed-0b26-0410-9574-a7f39faa03bf

radsecproxy.c

index f1bcee5..325acbf 100644 (file)
@@ -2843,18 +2843,6 @@ int compileserverconfig(struct clsrvconf *conf, const char *block) {
     if (conf->confrewriteout)
        conf->rewriteout = getrewrite(conf->confrewriteout, NULL);
 
-    if (!conf->secret) {
-       if (!conf->pdef->secretdefault) {
-           debug(DBG_ERR, "error in block %s, secret must be specified for transport type %s", block, conf->pdef->name);
-           return 0;
-       }
-       conf->secret = stringcopy(conf->pdef->secretdefault, 0);
-       if (!conf->secret) {
-           debug(DBG_ERR, "malloc failed");
-           return 0;
-       }
-    }
-    
     if (!conf->dynamiclookupcommand && !resolvepeer(conf, 0)) {
        debug(DBG_ERR, "failed to resolve host %s port %s, exiting", conf->host ? conf->host : "(null)", conf->port ? conf->port : "(null)");
        return 0;
@@ -2979,9 +2967,21 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
            goto errexit;
     }
     
+    if (!conf->secret) {
+       if (!conf->pdef->secretdefault) {
+           debug(DBG_ERR, "error in block %s, secret must be specified for transport type %s", block, conf->pdef->name);
+           return 0;
+       }
+       conf->secret = stringcopy(conf->pdef->secretdefault, 0);
+       if (!conf->secret) {
+           debug(DBG_ERR, "malloc failed");
+           return 0;
+       }
+    }
+    
     if (resconf)
        return 1;
-       
+
     if (!list_push(srvconfs, conf)) {
        debug(DBG_ERR, "malloc failed");
        goto errexit;