make bozo honor -rxbind correctly
authorAdam Megacz <adam@megacz.com>
Fri, 23 Mar 2007 19:14:41 +0000 (12:14 -0700)
committerDerrick Brashear <shadow@dementia.org>
Fri, 27 May 2011 01:31:26 +0000 (18:31 -0700)
Bozo needs to call rxInitHost() rather than rxInit() when -rxbind is
present. This patch causes it to read NetInfo/NetRestrict earlier in
the startup process so it can make that decision.

FIXES 57286

Change-Id: I17058f4e8e5c23fdfcfe56178d5edc5dcceafb7a
Reviewed-on: http://gerrit.openafs.org/4729
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/bozo/bosserver.c

index 5d1eaec..b7a6bb7 100644 (file)
@@ -963,8 +963,28 @@ main(int argc, char **argv, char **envp)
     /* Write current state of directory permissions to log file */
     DirAccessOK();
 
+    if (rxBind) {
+       afs_int32 ccode;
+       if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
+           AFSDIR_SERVER_NETINFO_FILEPATH) {
+           char reason[1024];
+           ccode = parseNetFiles(SHostAddrs, NULL, NULL,
+                                 ADDRSPERSITE, reason,
+                                 AFSDIR_SERVER_NETINFO_FILEPATH,
+                                 AFSDIR_SERVER_NETRESTRICT_FILEPATH);
+        } else {
+            ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
+        }
+        if (ccode == 1)
+            host = SHostAddrs[0];
+    }
+
     for (i = 0; i < 10; i++) {
-       code = rx_Init(htons(AFSCONF_NANNYPORT));
+       if (rxBind) {
+           code = rx_InitHost(host, htons(AFSCONF_NANNYPORT));
+       } else {
+           code = rx_Init(htons(AFSCONF_NANNYPORT));
+       }
        if (code) {
            bozo_Log("can't initialize rx: code=%d\n", code);
            sleep(3);
@@ -1039,23 +1059,6 @@ main(int argc, char **argv, char **envp)
        rx_SetMaxMTU(rxMaxMTU);
     }
 
-    if (rxBind) {
-       afs_int32 ccode;
-        if (AFSDIR_SERVER_NETRESTRICT_FILEPATH ||
-            AFSDIR_SERVER_NETINFO_FILEPATH) {
-            char reason[1024];
-            ccode = parseNetFiles(SHostAddrs, NULL, NULL,
-                                           ADDRSPERSITE, reason,
-                                           AFSDIR_SERVER_NETINFO_FILEPATH,
-                                           AFSDIR_SERVER_NETRESTRICT_FILEPATH);
-        } else
-       {
-            ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
-        }
-        if (ccode == 1)
-            host = SHostAddrs[0];
-    }
-
     tservice = rx_NewServiceHost(host, 0, /* service id */ 1,
                                 "bozo", securityClasses, numClasses,
                                 BOZO_ExecuteRequest);