Return a cell name from afsconf_LookupServer
authorAndrew Deason <adeason@sinenomine.net>
Tue, 29 Dec 2009 20:45:51 +0000 (15:45 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Wed, 30 Dec 2009 02:20:29 +0000 (18:20 -0800)
Previously, afsconf_LookupServer could not meaningfully return a cell
name, since a char* was passed in for realCellName, and
afsconf_GetAfsdbInfo was expecting the value of the pointer to change.
Change afsconf_LookupServer to take a char**, and pass realCellName by
reference, so we can get a cell name back.

Change-Id: Ib945fcb4be482ee155cdd1dcd62fe577c002082d
Reviewed-on: http://gerrit.openafs.org/1039
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/auth/cellconfig.c

index 4fc5cc2..b5ebe00 100644 (file)
@@ -998,13 +998,14 @@ afsconf_LookupServer(const char *service, const char *protocol,
                     const char *cellName, unsigned short afsdbPort,
                     int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS],
                     unsigned short ports[], unsigned short ipRanks[],
-                    int *numServers, int *ttl, char *realCellName)
+                    int *numServers, int *ttl, char **arealCellName)
 {
     int code = 0;
     int len;
     unsigned char answer[1024];
     unsigned char *p;
     char *dotcellname;
+    char *realCellName;
     int cellnamelength, fullnamelength;
     char host[256];
     int server_num = 0;
@@ -1178,6 +1179,8 @@ afsconf_LookupServer(const char *service, const char *protocol,
            *p = tolower(*p);
     }
 
+    *arealCellName = realCellName;
+
     *numServers = server_num;
     *ttl = minttl ? (time(0) + minttl) : 0;
 
@@ -1215,7 +1218,7 @@ afsconf_GetAfsdbInfo(char *acellName, char *aservice,
                                (const char *)acellName, afsdbport,
                                cellHostAddrs, cellHostNames,
                                ports, ipRanks, &numServers, &ttl,
-                               realCellName);
+                               &realCellName);
 
     if (code == 0) {
        acellInfo->timeout = ttl;