]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-windows-more-cellservdb-consolidation-20080201
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 2 Feb 2008 02:48:12 +0000 (02:48 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 2 Feb 2008 02:48:12 +0000 (02:48 +0000)
LICENSE MIT

Merge cellconfig.c and the afsreg library.
Redefine the location of the client cellservdb directory in dirpath
in terms of the cellservdb direction and not the install directory.
(although they point at the same thing now by default.)

Future changes to the location of the cellservdb directory should
be made in afsreg.

(cherry picked from commit 753ba70cf257aded0fae158c556a25ca72243214)

src/NTMakefile
src/WINNT/afsd/cm_config.c
src/WINNT/afsreg/afssw.c
src/WINNT/afsreg/afssw.h
src/libadmin/cfg/NTMakefile
src/util/dirpath.c

index 265e6a23237eebd2e72f40116c3d9e5d2cda9552..0b8d325e37015cc7f0187a165e3fb3fc0444cddc 100644 (file)
@@ -409,82 +409,82 @@ tbutc:  tviced
      $(NTMAKE)
      $(CD) ..\..
 
-adminutil: tbutc
+talocale: tbutc
      echo ***** $@
-       $(DOCD) $(SRC)\libadmin\$@
-       $(CD) $(SRC)\libadmin\$@
+       $(DOCD) $(SRC)\WINNT\$@
+       $(CD) $(SRC)\WINNT\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-vos: adminutil
+license: talocale
      echo ***** $@
-       $(DOCD) $(SRC)\libadmin\$@
-       $(CD) $(SRC)\libadmin\$@
+       $(DOCD) $(SRC)\WINNT\$@
+       $(CD) $(SRC)\WINNT\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-client: vos
+client_osi: license
      echo ***** $@
-       $(DOCD) $(SRC)\libadmin\$@
-       $(CD) $(SRC)\libadmin\$@
+       $(DOCD) $(SRC)\WINNT\$@
+       $(CD) $(SRC)\WINNT\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-kas: client
+afsd: client_osi
      echo ***** $@
-       $(DOCD) $(SRC)\libadmin\$@
-       $(CD) $(SRC)\libadmin\$@
+       $(DOCD) $(SRC)\WINNT\$@
+       $(CD) $(SRC)\WINNT\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-pts: kas
+libadmin: afsd
      echo ***** $@
-       $(DOCD) $(SRC)\libadmin\$@
-       $(CD) $(SRC)\libadmin\$@
+       $(DOCD) $(SRC)\$@
+       $(CD) $(SRC)\$@
        $(NTMAKE)
-       $(CD) ..\..\..
+       $(CD) ..\..
 
-bos: pts
+adminutil: libadmin
      echo ***** $@
        $(DOCD) $(SRC)\libadmin\$@
        $(CD) $(SRC)\libadmin\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-talocale: bos
+vos: adminutil
      echo ***** $@
-       $(DOCD) $(SRC)\WINNT\$@
-       $(CD) $(SRC)\WINNT\$@
+       $(DOCD) $(SRC)\libadmin\$@
+       $(CD) $(SRC)\libadmin\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-license: talocale
+client: vos
      echo ***** $@
-       $(DOCD) $(SRC)\WINNT\$@
-       $(CD) $(SRC)\WINNT\$@
+       $(DOCD) $(SRC)\libadmin\$@
+       $(CD) $(SRC)\libadmin\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-client_osi: license
+kas: client
      echo ***** $@
-       $(DOCD) $(SRC)\WINNT\$@
-       $(CD) $(SRC)\WINNT\$@
+       $(DOCD) $(SRC)\libadmin\$@
+       $(CD) $(SRC)\libadmin\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-afsd: client_osi
+pts: kas
      echo ***** $@
-       $(DOCD) $(SRC)\WINNT\$@
-       $(CD) $(SRC)\WINNT\$@
+       $(DOCD) $(SRC)\libadmin\$@
+       $(CD) $(SRC)\libadmin\$@
        $(NTMAKE)
        $(CD) ..\..\..
 
-libadmin: afsd
+bos: pts
      echo ***** $@
-       $(DOCD) $(SRC)\$@
-       $(CD) $(SRC)\$@
+       $(DOCD) $(SRC)\libadmin\$@
+       $(CD) $(SRC)\libadmin\$@
        $(NTMAKE)
-       $(CD) ..\..
+       $(CD) ..\..\..
 
 cfg: bos
      echo ***** $@
index de7de240bf102483172e606c18d614afe7a1e8cd..ddf22191978aee6dd1bb9d647dbd1ee6122c340a 100644 (file)
@@ -318,9 +318,9 @@ long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl,
 #endif /* AFS_AFSDB_ENV */
 }
 
-/* look up the CellServDBDir's name in the Registry 
- * or use the Client Dirpath value to produce a CellServDB 
- * filename
+/* use cm_GetConfigDir() plus AFS_CELLSERVDB to 
+ * generate the fully qualified name of the CellServDB 
+ * file.
  */
 long cm_GetCellServDB(char *cellNamep, afs_uint32 len)
 {
@@ -541,46 +541,13 @@ long cm_CloseCellFile(cm_configFile_t *filep)
 
 void cm_GetConfigDir(char *dir, afs_uint32 len)
 {
-    char wdir[512];
-    int tlen;
-    char *afsconf_path;
-    DWORD dwSize;
-
-    dwSize = GetEnvironmentVariable("AFSCONF", NULL, 0);
-    afsconf_path = malloc(dwSize);
-    dwSize = GetEnvironmentVariable("AFSCONF", afsconf_path, dwSize);
-    if (!afsconf_path) {
-        DWORD code, dummyLen;
-        HKEY parmKey;
-
-        code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_OPENAFS_SUBKEY,
-                             0, KEY_QUERY_VALUE, &parmKey);
-        if (code != ERROR_SUCCESS)
-            goto dirpath;
-
-        dummyLen = sizeof(wdir);
-        code = RegQueryValueEx(parmKey, "CellServDBDir", NULL, NULL,
-                               wdir, &dummyLen);
-        RegCloseKey (parmKey);
-
-      dirpath:
-        if (code != ERROR_SUCCESS || wdir[0] == 0) {
-            strncpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH, sizeof(wdir));
-            wdir[sizeof(wdir)-1] = '\0';
-        }
-    } else {
-        strncpy(wdir, afsconf_path, sizeof(wdir));
-        wdir[sizeof(wdir)-1] = '\0';
-        free(afsconf_path);
-    }
+    char * dirp = NULL;
 
-    /* add trailing backslash, if required */
-    tlen = (int)strlen(wdir);
-    if (wdir[tlen-1] != '\\') {
-        strncat(wdir, "\\", sizeof(wdir));
-        wdir[sizeof(wdir)-1] = '\0';
+    if (!afssw_GetClientCellServDBDir(&dirp)) {
+        strncpy(dir, dirp, len);
+        dir[len-1] = '\0';
+        free(dirp);
+    } else {
+        dir[0] = '\0';
     }
-
-    strncpy(dir, wdir, len);
-    dir[len-1] ='\0';
 }
index c6aa2fe37d32699095c27c2d5c81a38c44a78654..9c23ba3f0d412de47f4a0cbc15e0b11e421f4d37 100644 (file)
@@ -77,9 +77,41 @@ afssw_GetClientInstallDir(char **bufPP)   /* [out] data buffer */
 int
 afssw_GetClientCellServDBDir(char **bufPP)   /* [out] data buffer */
 {
-    return StringDataRead(AFSREG_CLT_OPENAFS_KEY,
+    char wdir[512];
+    int tlen;
+    char *path = NULL;
+    int rc;
+    DWORD cbPath;
+
+    cbPath = GetEnvironmentVariable("AFSCONF", NULL, 0);
+    if (cbPath) {
+        cbPath += 2;
+        path = malloc(cbPath);
+    }
+    if (path) {
+        GetEnvironmentVariable("AFSCONF", path, cbPath);
+        tlen = (int)strlen(path);
+        if (path[tlen-1] != '\\') {
+            strncat(path, "\\", cbPath);
+            path[cbPath-1] = '\0';
+        }
+        *bufPP = path;
+        return 0;
+    }
+
+    if (!StringDataRead(AFSREG_CLT_OPENAFS_KEY,
                          AFSREG_CLT_OPENAFS_CELLSERVDB_DIR_VALUE,
-                         bufPP);
+                         &path)) {
+        tlen = (int)strlen(path);
+        if (path[tlen-1] != '\\') {
+            strncat(path, "\\", cbPath);
+            path[cbPath-1] = '\0';
+        }
+        *bufPP = path;
+        return 0;
+    }
+
+    return afssw_GetClientInstallDir(bufPP);
 }
 
 
index 5eaecbe73623074351ddf95ccd71fc82f4b34d3a..4d8326ea39bc07a687660edbec72a0dd7c7e02ea 100644 (file)
@@ -22,9 +22,6 @@ afssw_GetServerInstallDir(char **bufPP);
 extern int
 afssw_GetClientCellServDBDir(char **bufPP);
 
-extern int
-afssw_GetClientCellDir(char **bufPP);
-
 extern int
 afssw_GetClientCellName(char **bufPP);
 
index 3f11f0cd2c27cb3f9de52dbcc95f928257663b0f..b8c3c76c5002b3266d8791ef859f27ac0e5acbc8 100644 (file)
@@ -55,7 +55,8 @@ DLLLIBS =\
        $(DESTDIR)\lib\afs\afsvosadmin.lib \
        $(DESTDIR)\lib\afsrpc.lib \
        $(DESTDIR)\lib\afsauthent.lib \
-       $(DESTDIR)\lib\afs\afsreg.lib
+       $(DESTDIR)\lib\afs\afsreg.lib \
+        $(DESTDIR)\lib\libafsconf.lib
 
 $(DLLFILE): $(DLLOBJS) $(DLLLIBS)
        $(DLLCONLINK) /DEF:afscfgadmin.def
index ee245cfd4bb3bbfe3709dd8090be4ff77037b120..2648fd10e12591f5a54ec8c5590b88aef6f71d5a 100644 (file)
@@ -135,7 +135,7 @@ initDirPathArray(void)
     FilepathNormalize(ntServerInstallDirShort);
 
     /* get the afs client configuration directory (/usr/vice/etc equivalent) */
-    if (afssw_GetClientInstallDir(&buf)) {
+    if (afssw_GetClientCellServDBDir(&buf)) {
         /* failed */
         status = GetWindowsDirectory(ntClientConfigDirLong, AFSDIR_PATH_MAX);
         if (status == 0 || status > AFSDIR_PATH_MAX) {