auth: prevent uninitialized key list in AFS config
authorMark Vitale <mvitale@sinenomine.net>
Fri, 4 Oct 2013 01:42:10 +0000 (21:42 -0400)
committerDerrick Brashear <shadow@your-file-system.com>
Sat, 26 Oct 2013 13:00:44 +0000 (06:00 -0700)
_afsconf_OpenInternal() may exit early for a number of reasons
before properly initalizing afsconf_dir->listKeys.
This leads to a crash when _afsconf_CloseInternal() attempts
to clean up listKeys.

Prevent this situation by calling afsconf_InitKeys() before any
possible exit from _afsconf_OpenInternal().

Change-Id: I6911427817a2518a576c00a7ea56351f9fb4fd19
Reviewed-on: http://gerrit.openafs.org/10323
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/auth/cellconfig.c

index 14c03b4..2509ec7 100644 (file)
@@ -632,6 +632,9 @@ afsconf_OpenInternal(struct afsconf_dir *adir, char *cell,
     cm_enumCellRegistry_t enumCellRegistry = {0, 0};
 #endif /* AFS_NT40_ENV */
 
+    /* init the keys queue before any call to afsconf_CloseInternal() */
+    _afsconf_InitKeys(adir);
+
     /* figure out the local cell name */
 #ifdef AFS_NT40_ENV
     i = GetCellNT(adir);
@@ -667,9 +670,6 @@ afsconf_OpenInternal(struct afsconf_dir *adir, char *cell,
        return -1;
     }
 
-    /* init the keys queue before any call to afsconf_CloseInternal() */
-    _afsconf_InitKeys(adir);
-
     /* The CellServDB file is now open.
      * The following code parses the contents of the
      * file and creates a list with the first cell entry