2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
17 #include <WINNT\afssw.h>
18 #include <WINNT\afsreg.h>
20 #include <afs/param.h>
22 #include <afs/cellconfig.h>
26 #include <afs/afsint.h>
29 static long cm_ParsePair(char *lineBufferp, char *leftp, char *rightp)
38 for(tp = lineBufferp; *tp; tp++) {
47 /* comment or line end */
48 if (tc == '#' || tc == '\r' || tc == '\n')
51 /* square bracket comment -- look for closing delim */
58 if (tc == ' ' || tc == '\t')
66 /* now we have a real character, put it in the appropriate bucket */
75 /* null terminate the strings */
79 return 0; /* and return success */
83 IsWindowsModule(const char * name)
88 /* Do not perform searches for probable Windows modules */
89 for (p = name, i=0; *p; p++) {
93 p = strrchr(name, '.');
96 (!cm_stricmp_utf8N(p,".dll") ||
97 !cm_stricmp_utf8N(p,".exe") ||
98 !cm_stricmp_utf8N(p,".ini") ||
99 !cm_stricmp_utf8N(p,".db") ||
100 !cm_stricmp_utf8N(p,".drv")))
106 /* search for a cell, and either return an error code if we don't find it,
107 * or return 0 if we do, in which case we also fill in the addresses in
110 * new feature: we can handle abbreviations and are insensitive to case.
111 * If the caller wants the "real" cell name, it puts a non-null pointer in
112 * newCellNamep. Anomaly: if cellNamep is ambiguous, we may modify
113 * newCellNamep but return an error code.
115 * Linked Cells: the CellServDB format permits linked cells
116 * >cell [linked-cell] #Description
118 * newCellNamep and linkedNamep are required to be CELL_MAXNAMELEN in size.
120 long cm_SearchCellFile(char *cellNamep, char *newCellNamep,
121 cm_configProc_t *procp, void *rockp)
123 return cm_SearchCellFileEx(cellNamep, newCellNamep, NULL, procp, rockp);
126 long cm_SearchCellFileEx(char *cellNamep, char *newCellNamep,
128 cm_configProc_t *procp, void *rockp)
130 char wdir[MAX_PATH]="";
131 FILE *tfilep = NULL, *bestp, *tempp;
133 char lineBuffer[257];
136 struct sockaddr_in vlSockAddr;
140 int tracking = 1, partial = 0;
142 if ( IsWindowsModule(cellNamep) )
145 cm_GetCellServDB(wdir, sizeof(wdir));
147 tfilep = fopen(wdir, "r");
152 bestp = fopen(wdir, "r");
154 #ifdef CELLSERV_DEBUG
155 osi_Log2(afsd_logp,"cm_searchfile fopen handle[%p], wdir[%s]", bestp,
156 osi_LogSaveString(afsd_logp,wdir));
158 /* have we seen the cell line for the guy we're looking for? */
161 tp = fgets(lineBuffer, sizeof(lineBuffer), tfilep);
163 (void) fgets(lineBuffer, sizeof(lineBuffer), bestp);
169 * found partial match earlier;
182 return (foundCell? 0 : -3);
187 /* turn trailing cr or lf into null */
188 tp = strrchr(lineBuffer, '\r');
190 tp = strrchr(lineBuffer, '\n');
193 /* skip blank lines */
194 if (lineBuffer[0] == 0) continue;
198 * >[cell] [linked-cell] #[Description]
199 * where linked-cell and Description are optional
201 if (lineBuffer[0] == '>') {
205 return(foundCell ? 0 : -6);
209 * terminate the cellname at the first white space
210 * leaving 'tp' pointing to the next string if any
212 for (tp = &lineBuffer[1]; tp && !isspace(*tp); tp++);
215 for (tp++ ;tp && isspace(*tp); tp++);
218 for (; tp && !isspace(*tp); tp++);
224 /* now see if this is the right cell */
225 if (stricmp(lineBuffer+1, cellNamep) == 0) {
226 /* found the cell we're looking for */
228 strncpy(newCellNamep, lineBuffer+1,CELL_MAXNAMELEN);
229 newCellNamep[CELL_MAXNAMELEN-1] = '\0';
230 strlwr(newCellNamep);
233 strncpy(linkedNamep, linkp ? linkp : "", CELL_MAXNAMELEN);
234 linkedNamep[CELL_MAXNAMELEN-1] = '\0';
239 #ifdef CELLSERV_DEBUG
240 osi_Log2(afsd_logp, "cm_searchfile is cell inRightCell[%p], linebuffer[%s]",
241 inRightCell, osi_LogSaveString(afsd_logp,lineBuffer));
244 else if (cm_stricmp_utf8(lineBuffer+1, cellNamep) == 0) {
246 if (partial) { /* ambiguous */
252 strncpy(newCellNamep, lineBuffer+1,CELL_MAXNAMELEN);
253 newCellNamep[CELL_MAXNAMELEN-1] = '\0';
254 strlwr(newCellNamep);
257 strncpy(linkedNamep, linkp ? linkp : "", CELL_MAXNAMELEN);
258 linkedNamep[CELL_MAXNAMELEN-1] = '\0';
265 else inRightCell = 0;
268 valuep = strchr(lineBuffer, '#');
269 if (valuep == NULL) {
274 valuep++; /* skip the "#" */
276 valuep += strspn(valuep, " \t"); /* skip SP & TAB */
277 /* strip spaces and tabs in the end. They should not be there according to CellServDB format
278 * so do this just in case
280 while (valuep[strlen(valuep) - 1] == ' ' || valuep[strlen(valuep) - 1] == '\t')
281 valuep[strlen(valuep) - 1] = '\0';
284 /* add the server to the VLDB list */
286 thp = gethostbyname(valuep);
287 #ifdef CELLSERV_DEBUG
288 osi_Log3(afsd_logp,"cm_searchfile inRightCell thp[%p], valuep[%s], WSAGetLastError[%d]",
289 thp, osi_LogSaveString(afsd_logp,valuep), WSAGetLastError());
292 memcpy(&vlSockAddr.sin_addr.s_addr, thp->h_addr,
294 vlSockAddr.sin_family = AF_INET;
295 /* sin_port supplied by connection code */
297 (*procp)(rockp, &vlSockAddr, valuep, 0);
302 unsigned int c1, c2, c3, c4;
304 /* Since there is no gethostbyname() data
305 * available we will read the IP address
306 * stored in the CellServDB file
308 code = sscanf(lineBuffer, " %u.%u.%u.%u",
310 if (code == 4 && c1<256 && c2<256 && c3<256 && c4<256) {
311 tp = (unsigned char *) &ip_addr;
316 memcpy(&vlSockAddr.sin_addr.s_addr, &ip_addr,
318 vlSockAddr.sin_family = AF_INET;
319 /* sin_port supplied by connection code */
321 (*procp)(rockp, &vlSockAddr, valuep, 0);
327 } /* while loop processing all lines */
329 /* if for some unknown reason cell is not found, return negative code (-11) ??? */
330 return (foundCell) ? 0 : -11;
334 * The CellServDB registry schema is as follows:
336 * HKLM\SOFTWARE\OpenAFS\Client\CellServDB\[cellname]\
337 * "LinkedCell" REG_SZ "[cellname]"
338 * "Description" REG_SZ "[comment]"
339 * "ForceDNS" DWORD {0,1}
341 * HKLM\SOFTWARE\OpenAFS\Client\CellServDB\[cellname]\[servername]\
342 * "HostName" REG_SZ "[hostname]"
343 * "IPv4Address" REG_SZ "[address]"
344 * "IPv6Address" REG_SZ "[address]" <future>
345 * "Comment" REG_SZ "[comment]"
346 * "Rank" DWORD "0..65535"
347 * "Clone" DWORD "{0,1}"
348 * "vlserver" DWORD "7003" <future>
349 * "ptserver" DWORD ... <future>
351 * ForceDNS is implied non-zero if there are no [servername]
352 * keys under the [cellname] key. Otherwise, ForceDNS is zero.
353 * If [servername] keys are specified and none of them evaluate
354 * to a valid server configuration, the return code is success.
355 * This prevents failover to the CellServDB file or DNS.
357 long cm_SearchCellRegistry(afs_uint32 client,
358 char *cellNamep, char *newCellNamep,
360 cm_configProc_t *procp, void *rockp)
362 HKEY hkCellServDB = 0, hkCellName = 0, hkServerName = 0;
363 DWORD dwType, dwSize;
364 DWORD dwCells, dwServers, dwForceDNS;
365 DWORD dwIndex, dwRank;
366 unsigned short ipRank;
368 FILETIME ftLastWriteTime;
369 char szCellName[CELL_MAXNAMELEN];
370 char szServerName[MAXHOSTCHARS];
371 char szHostName[MAXHOSTCHARS];
374 struct sockaddr_in vlSockAddr;
377 if ( IsWindowsModule(cellNamep) )
380 /* No Server CellServDB list (yet) */
382 return CM_ERROR_NOSUCHCELL;
384 if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
385 AFSREG_CLT_OPENAFS_SUBKEY "\\CellServDB",
387 KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
388 &hkCellServDB) != ERROR_SUCCESS)
389 return CM_ERROR_NOSUCHCELL;
391 if (RegOpenKeyEx( hkCellServDB,
394 KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
395 &hkCellName) != ERROR_SUCCESS) {
398 /* We did not find an exact match. Much search for partial matches. */
400 code = RegQueryInfoKey( hkCellServDB,
403 NULL, /* lpReserved */
404 &dwCells, /* lpcSubKeys */
405 NULL, /* lpcMaxSubKeyLen */
406 NULL, /* lpcMaxClassLen */
407 NULL, /* lpcValues */
408 NULL, /* lpcMaxValueNameLen */
409 NULL, /* lpcMaxValueLen */
410 NULL, /* lpcbSecurityDescriptor */
411 &ftLastWriteTime /* lpftLastWriteTime */
413 if (code != ERROR_SUCCESS)
417 * We search the entire list to ensure that there is only
418 * one prefix match. If there is more than one, we return none.
420 for ( dwIndex = 0; dwIndex < dwCells; dwIndex++ ) {
421 dwSize = CELL_MAXNAMELEN;
422 code = RegEnumKeyEx( hkCellServDB, dwIndex, szCellName, &dwSize, NULL,
423 NULL, NULL, &ftLastWriteTime);
424 if (code != ERROR_SUCCESS)
426 szCellName[CELL_MAXNAMELEN-1] = '\0';
429 /* if not a prefix match, try the next key */
430 if (strncmp(cellNamep, szCellName, strlen(cellNamep)))
433 /* If we have a prefix match and we already found another
434 * match, return neither */
437 RegCloseKey( hkCellName);
441 if (RegOpenKeyEx( hkCellServDB,
444 KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
445 &hkCellName) != ERROR_SUCCESS)
449 strncpy(newCellNamep, szCellName, CELL_MAXNAMELEN);
450 newCellNamep[CELL_MAXNAMELEN-1] = '\0';
456 RegCloseKey(hkCellServDB);
457 return CM_ERROR_NOSUCHCELL;
459 } else if (newCellNamep) {
460 strncpy(newCellNamep, cellNamep, CELL_MAXNAMELEN);
461 newCellNamep[CELL_MAXNAMELEN-1] = '\0';
462 strlwr(newCellNamep);
466 dwSize = CELL_MAXNAMELEN;
467 code = RegQueryValueEx(hkCellName, "LinkedCell", NULL, &dwType,
468 (BYTE *) linkedNamep, &dwSize);
469 if (code == ERROR_SUCCESS && dwType == REG_SZ) {
470 linkedNamep[CELL_MAXNAMELEN-1] = '\0';
473 linkedNamep[0] = '\0';
477 /* Check to see if DNS lookups are required */
478 dwSize = sizeof(DWORD);
479 code = RegQueryValueEx(hkCellName, "ForceDNS", NULL, &dwType,
480 (BYTE *) &dwForceDNS, &dwSize);
481 if (code == ERROR_SUCCESS && dwType == REG_DWORD) {
489 * Using the defined server list. Enumerate and populate
490 * the server list for the cell.
492 code = RegQueryInfoKey( hkCellName,
495 NULL, /* lpReserved */
496 &dwServers, /* lpcSubKeys */
497 NULL, /* lpcMaxSubKeyLen */
498 NULL, /* lpcMaxClassLen */
499 NULL, /* lpcValues */
500 NULL, /* lpcMaxValueNameLen */
501 NULL, /* lpcMaxValueLen */
502 NULL, /* lpcbSecurityDescriptor */
503 &ftLastWriteTime /* lpftLastWriteTime */
505 if (code != ERROR_SUCCESS)
508 for ( dwIndex = 0; dwIndex < dwServers; dwIndex++ ) {
509 dwSize = MAXHOSTCHARS;
510 code = RegEnumKeyEx( hkCellName, dwIndex, szServerName, &dwSize, NULL,
511 NULL, NULL, &ftLastWriteTime);
512 if (code != ERROR_SUCCESS)
515 szServerName[MAXHOSTCHARS-1] = '\0';
516 if (RegOpenKeyEx( hkCellName,
519 KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
520 &hkServerName) != ERROR_SUCCESS)
523 /* We have a handle to a valid server key. Now we need
524 * to add the server to the cell */
526 /* First, see if there is an alternate hostname specified */
527 dwSize = MAXHOSTCHARS;
528 code = RegQueryValueEx(hkServerName, "HostName", NULL, &dwType,
529 (BYTE *) szHostName, &dwSize);
530 if (code == ERROR_SUCCESS && dwType == REG_SZ) {
531 szHostName[MAXHOSTCHARS-1] = '\0';
538 dwSize = sizeof(DWORD);
539 code = RegQueryValueEx(hkServerName, "Rank", NULL, &dwType,
540 (BYTE *) &dwRank, &dwSize);
541 if (code == ERROR_SUCCESS && dwType == REG_DWORD) {
542 ipRank = (unsigned short)(dwRank <= 65535 ? dwRank : 65535);
547 dwSize = sizeof(szAddr);
548 code = RegQueryValueEx(hkServerName, "IPv4Address", NULL, &dwType,
549 (BYTE *) szAddr, &dwSize);
550 if (code == ERROR_SUCCESS && dwType == REG_SZ) {
557 thp = gethostbyname(s);
559 memcpy(&vlSockAddr.sin_addr.s_addr, thp->h_addr, sizeof(long));
560 vlSockAddr.sin_family = AF_INET;
561 /* sin_port supplied by connection code */
563 (*procp)(rockp, &vlSockAddr, s, ipRank);
564 } else if (szAddr[0]) {
566 unsigned int c1, c2, c3, c4;
568 /* Since there is no gethostbyname() data
569 * available we will read the IP address
570 * stored in the CellServDB file
572 code = sscanf(szAddr, " %u.%u.%u.%u",
574 if (code == 4 && c1<256 && c2<256 && c3<256 && c4<256) {
575 unsigned char * tp = (unsigned char *) &ip_addr;
580 memcpy(&vlSockAddr.sin_addr.s_addr, &ip_addr,
582 vlSockAddr.sin_family = AF_INET;
583 /* sin_port supplied by connection code */
585 (*procp)(rockp, &vlSockAddr, s, ipRank);
589 RegCloseKey( hkServerName);
593 RegCloseKey(hkCellName);
594 RegCloseKey(hkCellServDB);
596 return ((dwForceDNS || dwServers == 0) ? CM_ERROR_FORCE_DNS_LOOKUP : 0);
599 long cm_EnumerateCellRegistry(afs_uint32 client, cm_enumCellRegistryProc_t *procp, void *rockp)
601 HKEY hkCellServDB = 0;
602 DWORD dwType, dwSize;
606 FILETIME ftLastWriteTime;
607 char szCellName[CELL_MAXNAMELEN];
609 /* No server CellServDB in the registry. */
610 if (!client || procp == NULL)
613 if (RegOpenKeyEx( HKEY_LOCAL_MACHINE,
614 AFSREG_CLT_OPENAFS_SUBKEY "\\CellServDB",
616 KEY_READ|KEY_WRITE|KEY_QUERY_VALUE,
617 &hkCellServDB) != ERROR_SUCCESS)
620 code = RegQueryInfoKey( hkCellServDB,
623 NULL, /* lpReserved */
624 &dwCells, /* lpcSubKeys */
625 NULL, /* lpcMaxSubKeyLen */
626 NULL, /* lpcMaxClassLen */
627 NULL, /* lpcValues */
628 NULL, /* lpcMaxValueNameLen */
629 NULL, /* lpcMaxValueLen */
630 NULL, /* lpcbSecurityDescriptor */
631 &ftLastWriteTime /* lpftLastWriteTime */
633 if (code != ERROR_SUCCESS)
637 * Enumerate each Cell and
639 for ( dwIndex = 0; dwIndex < dwCells; dwIndex++ ) {
640 dwSize = CELL_MAXNAMELEN;
641 code = RegEnumKeyEx( hkCellServDB, dwIndex, szCellName, &dwSize, NULL,
642 NULL, NULL, &ftLastWriteTime);
643 if (code != ERROR_SUCCESS)
645 szCellName[CELL_MAXNAMELEN-1] = '\0';
648 (*procp)(rockp, szCellName);
651 RegCloseKey(hkCellServDB);
655 /* newCellNamep is required to be CELL_MAXNAMELEN in size */
656 long cm_SearchCellByDNS(char *cellNamep, char *newCellNamep, int *ttl,
657 cm_configProc_t *procp, void *rockp)
661 int cellHostAddrs[AFSMAXCELLHOSTS];
662 char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
663 unsigned short ipRanks[AFSMAXCELLHOSTS];
666 struct sockaddr_in vlSockAddr;
667 #ifdef CELLSERV_DEBUG
668 osi_Log1(afsd_logp,"SearchCellDNS-Doing search for [%s]", osi_LogSaveString(afsd_logp,cellNamep));
670 if ( IsWindowsModule(cellNamep) )
672 rc = getAFSServer(cellNamep, cellHostAddrs, cellHostNames, ipRanks, &numServers, ttl);
673 if (rc == 0 && numServers > 0) { /* found the cell */
674 for (i = 0; i < numServers; i++) {
675 memcpy(&vlSockAddr.sin_addr.s_addr, &cellHostAddrs[i],
677 vlSockAddr.sin_family = AF_INET;
678 /* sin_port supplied by connection code */
680 (*procp)(rockp, &vlSockAddr, cellHostNames[i], ipRanks[i]);
683 strncpy(newCellNamep,cellNamep,CELL_MAXNAMELEN);
684 newCellNamep[CELL_MAXNAMELEN-1] = '\0';
685 strlwr(newCellNamep);
687 return 0; /* found cell */
690 return -1; /* not found */
692 return -1; /* not found */
693 #endif /* AFS_AFSDB_ENV */
696 /* use cm_GetConfigDir() plus AFS_CELLSERVDB to
697 * generate the fully qualified name of the CellServDB
700 long cm_GetCellServDB(char *cellNamep, afs_uint32 len)
704 cm_GetConfigDir(cellNamep, len);
706 /* add trailing backslash, if required */
707 tlen = (int)strlen(cellNamep);
709 if (cellNamep[tlen-1] != '\\') {
710 strncat(cellNamep, "\\", len);
711 cellNamep[len-1] = '\0';
714 strncat(cellNamep, AFS_CELLSERVDB, len);
715 cellNamep[len-1] = '\0';
720 /* look up the root cell's name in the Registry
721 * Input buffer must be at least CELL_MAXNAMELEN
722 * in size. (Defined in cm_cell.h)
724 long cm_GetRootCellName(char *cellNamep)
726 DWORD code, dummyLen;
729 code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
730 0, KEY_QUERY_VALUE, &parmKey);
731 if (code != ERROR_SUCCESS)
734 dummyLen = CELL_MAXNAMELEN;
735 code = RegQueryValueEx(parmKey, "Cell", NULL, NULL,
736 cellNamep, &dummyLen);
737 RegCloseKey (parmKey);
738 if (code != ERROR_SUCCESS || cellNamep[0] == 0)
744 cm_configFile_t *cm_CommonOpen(char *namep, char *rwp)
746 char wdir[MAX_PATH]="";
749 cm_GetConfigDir(wdir, sizeof(wdir));
751 strncat(wdir, namep, sizeof(wdir));
752 wdir[sizeof(wdir)-1] = '\0';
754 tfilep = fopen(wdir, rwp);
756 return ((cm_configFile_t *) tfilep);
759 long cm_WriteConfigString(char *labelp, char *valuep)
761 DWORD code, dummyDisp;
764 code = RegCreateKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
765 0, "container", 0, KEY_SET_VALUE, NULL,
766 &parmKey, &dummyDisp);
767 if (code != ERROR_SUCCESS)
770 code = RegSetValueEx(parmKey, labelp, 0, REG_SZ,
771 valuep, (DWORD)strlen(valuep) + 1);
772 RegCloseKey (parmKey);
773 if (code != ERROR_SUCCESS)
779 long cm_WriteConfigInt(char *labelp, long value)
781 DWORD code, dummyDisp;
784 code = RegCreateKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
785 0, "container", 0, KEY_SET_VALUE, NULL,
786 &parmKey, &dummyDisp);
787 if (code != ERROR_SUCCESS)
790 code = RegSetValueEx(parmKey, labelp, 0, REG_DWORD,
791 (LPBYTE)&value, sizeof(value));
792 RegCloseKey (parmKey);
793 if (code != ERROR_SUCCESS)
799 cm_configFile_t *cm_OpenCellFile(void)
801 cm_configFile_t *cfp;
803 cfp = cm_CommonOpen(AFS_CELLSERVDB ".new", "w");
807 long cm_AppendPrunedCellList(cm_configFile_t *ofp, char *cellNamep)
809 cm_configFile_t *tfilep; /* input file */
811 char lineBuffer[256];
816 tfilep = cm_CommonOpen(AFS_CELLSERVDB, "r");
822 /* have we seen the cell line for the guy we're looking for? */
825 tp = fgets(lineBuffer, sizeof(lineBuffer), (FILE *)tfilep);
827 if (feof((FILE *)tfilep)) {
829 fclose((FILE *)tfilep);
834 /* turn trailing cr or lf into null */
835 tp = strchr(lineBuffer, '\r');
837 tp = strchr(lineBuffer, '\n');
840 /* skip blank lines */
841 if (lineBuffer[0] == 0) {
842 fprintf((FILE *)ofp, "%s\n", lineBuffer);
846 if (lineBuffer[0] == '>') {
847 /* trim off at white space or '#' chars */
848 tp = strchr(lineBuffer, ' ');
850 tp = strchr(lineBuffer, '\t');
852 tp = strchr(lineBuffer, '#');
855 /* now see if this is the right cell */
856 if (strcmp(lineBuffer+1, cellNamep) == 0) {
857 /* found the cell we're looking for */
862 fprintf((FILE *)ofp, "%s\n", lineBuffer);
866 valuep = strchr(lineBuffer, '#');
867 if (valuep == NULL) return -2;
868 valuep++; /* skip the "#" */
870 fprintf((FILE *)ofp, "%s\n", lineBuffer);
873 } /* while loop processing all lines */
876 long cm_AppendNewCell(cm_configFile_t *filep, char *cellNamep)
878 fprintf((FILE *)filep, ">%s\n", cellNamep);
882 long cm_AppendNewCellLine(cm_configFile_t *filep, char *linep)
884 fprintf((FILE *)filep, "%s\n", linep);
888 long cm_CloseCellFile(cm_configFile_t *filep)
894 closeCode = fclose((FILE *)filep);
896 cm_GetConfigDir(wdir, sizeof(wdir));
899 if (closeCode != 0) {
900 /* something went wrong, preserve original database */
901 strncat(wdir, AFS_CELLSERVDB ".new", sizeof(wdir));
902 wdir[sizeof(wdir)-1] = '\0';
907 strncat(wdir, AFS_CELLSERVDB, sizeof(wdir));
908 wdir[sizeof(wdir)-1] = '\0';
909 strncat(sdir, AFS_CELLSERVDB ".new", sizeof(sdir));/* new file */
910 sdir[sizeof(sdir)-1] = '\0';
912 unlink(sdir); /* delete old file */
914 code = rename(sdir, wdir); /* do the rename */
922 void cm_GetConfigDir(char *dir, afs_uint32 len)
926 if (!afssw_GetClientCellServDBDir(&dirp)) {
927 strncpy(dir, dirp, len);