auth: pass the directory name to _afsconf_CellServDBPath 76/14076/6
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 20 Feb 2020 21:09:49 +0000 (16:09 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 6 Mar 2020 02:34:11 +0000 (21:34 -0500)
Change the signature of the _afsconf_CellServDBPath() static function to
take just the base directory name of the CellServDB file instead of the
entire afsconf_dir data object. This makes it clear we do not need other
members of the afsconf_dir structure to compose the CellServDB path.

Change-Id: I57509b2ca09123e78df5533d63494c66b5b24cdf
Reviewed-on: https://gerrit.openafs.org/14076
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>

src/auth/cellconfig.c

index bc81423..ef69dec 100644 (file)
@@ -315,32 +315,32 @@ _afsconf_IsClientConfigDirectory(const char *path)
 
 #ifdef AFS_NT40_ENV
 static void
-_afsconf_CellServDBPath(struct afsconf_dir *adir, char **path)
+_afsconf_CellServDBPath(const char *dirname, char **path)
 {
     char *p;
 
     /* NT client CellServDB has different file name than NT server or Unix */
-    if (_afsconf_IsClientConfigDirectory(adir->name)) {
+    if (_afsconf_IsClientConfigDirectory(dirname)) {
        if (!afssw_GetClientCellServDBDir(&p)) {
            if (asprintf(path, "%s/%s", p, AFSDIR_CELLSERVDB_FILE_NTCLIENT) < 0)
                *path = NULL;
            free(p);
        } else {
-           if (asprintf(path, "%s/%s", adir->name,
+           if (asprintf(path, "%s/%s", dirname,
                         AFSDIR_CELLSERVDB_FILE_NTCLIENT) < 0)
                *path = NULL;
        }
     } else {
-       if (asprintf(path, "%s/%s", adir->name, AFSDIR_CELLSERVDB_FILE) < 0)
+       if (asprintf(path, "%s/%s", dirname, AFSDIR_CELLSERVDB_FILE) < 0)
            *path = NULL;
     }
     return;
 }
 #else
 static void
-_afsconf_CellServDBPath(struct afsconf_dir *adir, char **path)
+_afsconf_CellServDBPath(const char *dirname, char **path)
 {
-    if (asprintf(path, "%s/%s", adir->name, AFSDIR_CELLSERVDB_FILE) < 0)
+    if (asprintf(path, "%s/%s", dirname, AFSDIR_CELLSERVDB_FILE) < 0)
        *path = NULL;
 }
 #endif /* AFS_NT40_ENV */
@@ -732,7 +732,7 @@ LoadConfig(struct afsconf_dir *adir)
     /* now parse the individual lines */
     curEntry = 0;
 
-    _afsconf_CellServDBPath(adir, &adir->cellservDB);
+    _afsconf_CellServDBPath(adir->name, &adir->cellservDB);
 
 #ifdef AFS_NT40_ENV
     if (_afsconf_IsClientConfigDirectory(adir->name))