No authhost in proxy means LOCAL
authoraland <aland>
Thu, 8 Nov 2001 16:58:56 +0000 (16:58 +0000)
committeraland <aland>
Thu, 8 Nov 2001 16:58:56 +0000 (16:58 +0000)
No accthost in proxy means LOCAL

Corrected bug where acct_port for proxy was set to auth_port

src/main/conffile.c

index 224cb90..d2c0d30 100644 (file)
@@ -858,61 +858,58 @@ static int generate_realms(const char *filename)
                c = rad_malloc(sizeof(REALM));
                memset(c, 0, sizeof(REALM));
 
+               c->secret[0] = '\0';
+
                /*
-                *      An authhost must exist in the configuration
+                *      No authhost means LOCAL.
                 */
                if ((authhost = cf_section_value_find(cs, "authhost")) == NULL) {
-                       radlog(L_CONS|L_ERR, 
-                               "%s[%d]: No authhost entry for realm: %s", 
-                               filename, cs->item.lineno, cs->name2);
-                       return -1;
-               }
-               if ((s = strchr(authhost, ':')) != NULL) {
-                       *s++ = 0;
-                       c->auth_port = atoi(s);
-               } else {
-                       c->auth_port = auth_port;
-               }
-               if (strcmp(authhost, "LOCAL") == 0) {
-                       /*
-                        *      Local realms don't have an IP address,
-                        *      secret, or port.
-                        */
                        c->ipaddr = htonl(INADDR_NONE);
-                       c->secret[0] = '\0';
                        c->auth_port = auth_port;
                } else {
-                       c->ipaddr = ip_getaddr(authhost);
+                       if ((s = strchr(authhost, ':')) != NULL) {
+                               *s++ = 0;
+                               c->auth_port = atoi(s);
+                       } else {
+                               c->auth_port = auth_port;
+                       }
+                       if (strcmp(authhost, "LOCAL") == 0) {
+                               /*
+                                *      Local realms don't have an IP address,
+                                *      secret, or port.
+                                */
+                               c->ipaddr = htonl(INADDR_NONE);
+                               c->auth_port = auth_port;
+                       } else {
+                               c->ipaddr = ip_getaddr(authhost);
+                       }
                }
 
                /*
-                *      An accthost must exist in the configuration
+                *      No accthost means LOCAL
                 */
                if ((accthost = cf_section_value_find(cs, "accthost")) == NULL) {
-                       radlog(L_CONS|L_ERR, 
-                               "%s[%d]: No accthost entry for realm: %s", 
-                               filename, cs->item.lineno, cs->name2);
-                       return -1;
-               }
-
-               if ((s = strchr(accthost, ':')) != NULL) {
-                       *s++ = 0;
-                       c->acct_port = atoi(s); 
-               } else {
-                       c->acct_port = acct_port;
-               }
-               if (strcmp(accthost, "LOCAL") == 0) {
-                       /*
-                        *      Local realms don't have an IP address,
-                        *      secret, or port.
-                        */
                        c->acct_ipaddr = htonl(INADDR_NONE);
-                       c->acct_port = auth_port;
+                       c->acct_port = acct_port;
                } else {
-                       c->acct_ipaddr = ip_getaddr(authhost);
+                       if ((s = strchr(accthost, ':')) != NULL) {
+                               *s++ = 0;
+                               c->acct_port = atoi(s); 
+                       } else {
+                               c->acct_port = acct_port;
+                       }
+                       if (strcmp(accthost, "LOCAL") == 0) {
+                               /*
+                                *      Local realms don't have an IP address,
+                                *      secret, or port.
+                                */
+                               c->acct_ipaddr = htonl(INADDR_NONE);
+                               c->acct_port = acct_port;
+                       } else {
+                               c->acct_ipaddr = ip_getaddr(authhost);
+                       }
                }
 
-
                /* 
                 * Double check length, just to be sure!
                 */