windows-smb-disable-loopback-check-20090427

LICENSE MIT

Now that BackConnectionHostNames can be set each time the smb listener
threads are stopped and restarted, we need to make sure that we do not
clear the DisableLoopbackCheck value if it was set during the same
service session because BackConnectionHostName value changes only take
effect on a reboot.
This commit is contained in:
Jeffrey Altman 2009-04-28 00:37:16 +00:00
parent 8655541d1e
commit c4006edf40

View File

@ -9439,6 +9439,9 @@ configureBackConnectionHostNames(void)
* Starting in Longhorn Beta 1, an entry in the BackConnectionHostNames value will * Starting in Longhorn Beta 1, an entry in the BackConnectionHostNames value will
* force Windows to use the loopback authentication mechanism for the specified * force Windows to use the loopback authentication mechanism for the specified
* services. * services.
*
* Do not permit the "DisableLoopbackCheck" value to be removed within the same
* service session that set it.
*/ */
HKEY hkLsa; HKEY hkLsa;
HKEY hkMSV10; HKEY hkMSV10;
@ -9448,6 +9451,7 @@ configureBackConnectionHostNames(void)
DWORD dwValue; DWORD dwValue;
PBYTE pHostNames = NULL, pName = NULL; PBYTE pHostNames = NULL, pName = NULL;
BOOL bNameFound = FALSE; BOOL bNameFound = FALSE;
static BOOL bLoopbackCheckDisabled = FALSE;
/* BackConnectionHostNames and DisableLoopbackCheck */ /* BackConnectionHostNames and DisableLoopbackCheck */
if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE, if ( RegOpenKeyEx( HKEY_LOCAL_MACHINE,
@ -9521,12 +9525,13 @@ configureBackConnectionHostNames(void)
dwSize = sizeof(DWORD); dwSize = sizeof(DWORD);
dwValue = 1; dwValue = 1;
RegSetValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, dwType, (LPBYTE)&dwValue, dwSize); RegSetValueEx( hkClient, "RemoveDisableLoopbackCheck", 0, dwType, (LPBYTE)&dwValue, dwSize);
bLoopbackCheckDisabled = TRUE;
RegCloseKey(hkClient); RegCloseKey(hkClient);
} }
RegCloseKey(hkLsa); RegCloseKey(hkLsa);
} }
} }
} else { } else if (!bLoopbackCheckDisabled) {
if (RegCreateKeyEx( HKEY_LOCAL_MACHINE, if (RegCreateKeyEx( HKEY_LOCAL_MACHINE,
AFSREG_CLT_OPENAFS_SUBKEY, AFSREG_CLT_OPENAFS_SUBKEY,
0, 0,