Windows: Only install Service NP if one exists

Do not blindly install a network provider for the service since at
least one end user organization does not install the service's network
provider.

Change-Id: I15a528ff34ffd3e060fdbd93545af3857592c835
Reviewed-on: http://gerrit.openafs.org/12051
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
Jeffrey Altman 2015-10-07 18:09:50 -04:00
parent cda7556b85
commit c615a712bf

View File

@ -1305,6 +1305,21 @@ InstNetProvider(const char *svcname, int bInst, const char *before)
return rv;
}
static int
clientServiceProviderKeyExists(void)
{
HKEY hk;
LONG rv;
rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
AFSREG_CLT_SVC_PROVIDER_KEY, 0,
KEY_READ, &hk);
if (rv == ERROR_SUCCESS)
RegCloseKey(hk);
return (rv == ERROR_SUCCESS);
}
/*
control serviceex exists only on 2000/xp. These functions will be loaded dynamically.
*/
@ -1563,7 +1578,8 @@ afsd_Main(DWORD argc, LPTSTR *argv)
InstNetProvider("AFSRedirector", FALSE, NULL);
}
InstNetProvider("TransarcAFSDaemon", TRUE, NULL);
InstNetProvider("TransarcAFSDaemon", clientServiceProviderKeyExists(),
NULL);
/*
* Set the default for the SMB interface based upon the state of the