make bozo honor -rxbind correctly
authorAdam Megacz <adam@megacz.com>
Fri, 23 Mar 2007 19:14:41 +0000 (12:14 -0700)
committerJeffrey Altman <jaltman@openafs.org>
Tue, 7 Jun 2011 14:23:55 +0000 (07:23 -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

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>
(cherry picked from commit 6260c4ae51e7a2807596ddf1bd49620f98eed94c)

Change-Id: Ie6880661d49670437429e61d31671778514827ce
Reviewed-on: http://gerrit.openafs.org/4813
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/bozo/bosserver.c

index 60c7df1..9bbca23 100644 (file)
@@ -930,8 +930,31 @@ main(int argc, char **argv, char **envp)
     /* Write current state of directory permissions to log file */
     DirAccessOK();
 
+    if (rxBind) {
+       afs_int32 ccode;
+#ifndef AFS_NT40_ENV
+       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
+#endif
+       {
+            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);
@@ -1013,25 +1036,6 @@ main(int argc, char **argv, char **envp)
        rx_SetMaxMTU(rxMaxMTU);
     }
 
-    if (rxBind) {
-       afs_int32 ccode;
-#ifndef AFS_NT40_ENV
-        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 
-#endif 
-       {
-            ccode = rx_getAllAddr(SHostAddrs, ADDRSPERSITE);
-        }
-        if (ccode == 1) 
-            host = SHostAddrs[0];
-    }
-
     tservice = rx_NewServiceHost(host,  /* port */ 0, /* service id */ 1,
                             /*service name */ "bozo",
                             /* security classes */