]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
budb: Do not use garbage cellinfo
authorAndrew Deason <adeason@sinenomine.net>
Wed, 31 Jul 2013 20:58:41 +0000 (15:58 -0500)
committerRuss Allbery <rra@debian.org>
Sun, 20 Oct 2013 15:51:25 +0000 (08:51 -0700)
If the -servers option is given, we never initialize cellinfo or the
clones array. So, don't give the cellinfo structure or the clones
array to ubik in that case, or we may crash or do other weird things.

This issue appears to have been introduced in commit fc4ab52e.

FIXES 131706

Reviewed-on: http://gerrit.openafs.org/10115
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 6b0016dd992b3215cb17c93812e14de9e4916d25)

Change-Id: I7174d3ac596fb9ecf512aa159fdc839714f8791c
Reviewed-on: http://gerrit.openafs.org/10166
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/budb/server.c

index 94a37ac4b6fe703395dd31dcf14e353e9f93b1cd..fc7aa58b2e0bb409b02c2969b7a878eb7507704a 100644 (file)
@@ -369,7 +369,8 @@ main(int argc, char **argv)
 {
     char *whoami = argv[0];
     char *dbNamePtr = 0;
-    struct afsconf_cell cellinfo;
+    struct afsconf_cell cellinfo_s;
+    struct afsconf_cell *cellinfo = NULL;
     time_t currentTime;
     afs_int32 code = 0;
     afs_uint32 host = ntohl(INADDR_ANY);
@@ -406,6 +407,10 @@ main(int argc, char **argv)
     sigaction(SIGSEGV, &nsa, NULL);
     sigaction(SIGABRT, &nsa, NULL);
 #endif
+
+    memset(&cellinfo_s, 0, sizeof(cellinfo_s));
+    memset(clones, 0, sizeof(clones));
+
     osi_audit_init();
     osi_audit(BUDB_StartEvent, 0, AUD_END);
 
@@ -490,9 +495,11 @@ main(int argc, char **argv)
         * list from the cell's database
         */
 
+       cellinfo = &cellinfo_s;
+
        LogDebug(1, "Using server list from %s cell database.\n", lcell);
 
-       code = afsconf_GetExtendedCellInfo (BU_conf, lcell, 0, &cellinfo,
+       code = afsconf_GetExtendedCellInfo (BU_conf, lcell, 0, cellinfo,
                                            clones);
        if (code) {
            LogError(0, "Can't read cell information\n");
@@ -500,7 +507,7 @@ main(int argc, char **argv)
        }
 
        code =
-           convert_cell_to_ubik(&cellinfo, &globalConfPtr->myHost,
+           convert_cell_to_ubik(cellinfo, &globalConfPtr->myHost,
                                 globalConfPtr->serverList);
        if (code)
            ERROR(code);
@@ -555,12 +562,19 @@ main(int argc, char **argv)
     /* Disable jumbograms */
     rx_SetNoJumbo();
 
-    code = ubik_ServerInitByInfo (globalConfPtr->myHost,
-                                 htons(AFSCONF_BUDBPORT),
-                                 &cellinfo,
-                                 clones,
-                                 dbNamePtr,           /* name prefix */
-                                 &BU_dbase);
+    if (cellinfo) {
+       code = ubik_ServerInitByInfo(globalConfPtr->myHost,
+                                    htons(AFSCONF_BUDBPORT),
+                                    cellinfo,
+                                    clones,
+                                    dbNamePtr,           /* name prefix */
+                                    &BU_dbase);
+    } else {
+       code = ubik_ServerInit(globalConfPtr->myHost, htons(AFSCONF_BUDBPORT),
+                              globalConfPtr->serverList,
+                              dbNamePtr,  /* name prefix */
+                              &BU_dbase);
+    }
 
     if (code) {
        LogError(code, "Ubik init failed\n");