From: Jeffrey Altman Date: Tue, 16 Mar 2004 22:03:00 +0000 (+0000) Subject: reg-expand-str-20040316 X-Git-Tag: openafs-devel-1_3_60~20 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ec0ba71b30179be312452208bed139db0d9f01cf;p=packages%2Fo%2Fopenafs.git reg-expand-str-20040316 Change the NetbiosName registry value from REG_SZ to REG_EXPAND_SZ and add the necessary code to expand the strings. This will allow the use of %COMPUTERNAME%-AFS in case people want to explicitly use a non-portable name. ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== Update text for NetbiosName value. --- diff --git a/doc/txt/winnotes/registry.txt b/doc/txt/winnotes/registry.txt index de2e0c645..34d6a815e 100644 --- a/doc/txt/winnotes/registry.txt +++ b/doc/txt/winnotes/registry.txt @@ -119,12 +119,13 @@ Variable: traceOnPanic Issues a breakpoint in the event of a panic. (breakpoint: _asm int 3). Value : NetbiosName -Type : REG_SZ +Type : REG_EXPAND_SZ Default : "AFS" Variable: cm_NetbiosName Specifies the NetBIOS name to be used when binding to a Loopback - adapter. + adapter. To provide the old behavior specify a value of + "%COMPUTERNAME%-AFS" Value : IsGateway Type : DWORD {1,0} diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index 3e949be97..5094885d9 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -439,11 +439,17 @@ int afsd_InitCM(char **reasonP) } #endif /* AFS_FREELANCE_CLIENT */ - dummyLen = sizeof(cm_NetBiosName); + dummyLen = sizeof(buf); code = RegQueryValueEx(parmKey, "NetbiosName", NULL, NULL, - (BYTE *) &cm_NetBiosName, &dummyLen); + (BYTE *) &buf, &dummyLen); if (code == ERROR_SUCCESS) { - afsi_log("Explicit NetBios name is used %s", cm_NetBiosName); + DWORD len = ExpandEnvironmentStrings(buf, cm_NetBiosName, MAX_NB_NAME_LENGTH); + if ( len > 0 && len <= MAX_NB_NAME_LENGTH ) { + afsi_log("Explicit NetBios name is used %s", cm_NetBiosName); + } else { + afsi_log("Unable to Expand Explicit NetBios name: %s", buf); + cm_NetBiosName[0] = 0; /* turn it off */ + } } else { cm_NetBiosName[0] = 0; /* default off */