Add 'smb_Enabled' and 'RDR_Initialized' flag variables.
Default smb_Enabled to true and RDR_Initialized to false.
Add registry value "SMBInterfaceEnabled" to permit disabling
the SMB interface.
If the redirector interface is initialized (a future set of
patchsets will add it) disable the SMB interface at runtime.
Change-Id: I354e121001d942421aa98490b62b710ac175051f
Reviewed-on: http://gerrit.openafs.org/5337
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
extern HANDLE WaitToTerminate;
+extern int RDR_Initialized;
+
+extern afs_uint32 smb_Enabled;
+
#define DFS_SUPPORT 1
#define LOG_PACKET 1
#undef NOTSERVICE
int cm_chunkSize;
int smb_UseV3 = 1;
+afs_uint32 smb_Enabled = 1;
int LANadapter;
smb_AsyncStoreSize = CM_CONFIGDEFAULT_ASYNCSTORESIZE;
afsi_log("SMBAsyncStoreSize = %d", smb_AsyncStoreSize);
+ dummyLen = sizeof(DWORD);
+ code = RegQueryValueEx(parmKey, "SMBInterfaceEnabled", NULL, NULL,
+ (BYTE *) &dwValue, &dummyLen);
+ if (code == ERROR_SUCCESS)
+ smb_Enabled = dwValue ? 1 : 0;
+ afsi_log("SMBInterfaceEnabled = %d", smb_Enabled);
+
RegCloseKey (parmKey);
}
+ if ( smb_Enabled ) {
/* Do this last so that we don't handle requests before init is done.
* Here we initialize the SMB listener.
*/
smb_Init(afsd_logp, smb_UseV3, numSvThreads, aMBfunc);
afsi_log("smb_Init complete");
+ } else {
+ afsi_log("smb_Init skipped");
+ }
return 0;
}
static int powerEventsRegistered = 0;
extern int powerStateSuspended = 0;
+extern int RDR_Initialized = 0;
static VOID (WINAPI* pRtlCaptureContext)(PCONTEXT ContextRecord) = NULL;
/* This is the message delivered once all devices are up */
afsi_log("SERVICE_CONTROL_APMRESUMEAUTOMATIC");
powerStateSuspended = 0;
- if (osVersion.dwMajorVersion >= 6) {
+ if (smb_Enabled && osVersion.dwMajorVersion >= 6) {
smb_SetLanAdapterChangeDetected();
}
dwRet = NO_ERROR;
/* Notify any volume status handlers that the cache manager has started */
cm_VolStatus_Service_Started();
+ /*
+ * Set the default for the SMB interface based upon the state of the
+ * Redirector interface.
+ */
+ smb_Enabled = !RDR_Initialized;
+
code = afsd_InitSMB(&reason, MessageBox);
- if (code != 0) {
+ if (smb_Enabled && code != 0) {
afsi_log("afsd_InitSMB failed: %s (code = %d)", reason, code);
osi_panic(reason, __FILE__, __LINE__);
}
+ if (!smb_Enabled && !RDR_Initialized) {
+ afsi_log("Neither RDR nor SMB interfaces available");
+ osi_panic(reason, __FILE__, __LINE__);
+ }
+
/* allow an exit to be called post smb initialization */
hHookDll = cm_LoadAfsdHookLib();
if (hHookDll)
* We base our values on those while making sure we leave
* enough time for overhead.
*/
- if (ConnDeadtimeout == 0) {
- ConnDeadtimeout = (unsigned short) ((RDRtimeout / 2) < 50 ? (RDRtimeout / 2) : 50);
- afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout);
- }
- if (HardDeadtimeout == 0) {
- HardDeadtimeout = (unsigned short) (RDRtimeout > 125 ? 120 : (RDRtimeout - 5));
- afsi_log("HardDeadTimeout is %d", HardDeadtimeout);
- }
- if (IdleDeadtimeout == 0) {
- IdleDeadtimeout = (unsigned short) ConnDeadtimeout;
- afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout);
+ if (smb_Enabled) {
+ afsi_log("lanmanworkstation : SessTimeout %u", RDRtimeout);
+ if (ConnDeadtimeout == 0) {
+ ConnDeadtimeout = (unsigned short) ((RDRtimeout / 2) < 50 ? (RDRtimeout / 2) : 50);
+ afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout);
+ }
+ if (HardDeadtimeout == 0) {
+ HardDeadtimeout = (unsigned short) (RDRtimeout > 125 ? 120 : (RDRtimeout - 5));
+ afsi_log("HardDeadTimeout is %d", HardDeadtimeout);
+ }
+ if (IdleDeadtimeout == 0) {
+ IdleDeadtimeout = (unsigned short) ConnDeadtimeout;
+ afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout);
+ }
}
osi_EndOnce(&once);
}
Result = NotifyAddrChange(NULL,NULL);
if (Result == NO_ERROR && daemon_ShutdownFlag == 0) {
lastIPAddrChange = osi_Time();
- smb_SetLanAdapterChangeDetected();
+ if (smb_Enabled)
+ smb_SetLanAdapterChangeDetected();
cm_SetLanAdapterChangeDetected();
thrd_ResetEvent(cm_IPAddrDaemon_ShutdownEvent);
}
int lana_found = 0;
lana_number_t lanaNum;
+ if (!smb_Enabled)
+ return 0;
+
if (!locked)
lock_ObtainMutex(&smb_StartedLock);
int lpid;
thread_t phandle;
+ if (!smb_Enabled)
+ return;
+
if (!locked)
lock_ObtainMutex(&smb_StartedLock);
void smb_RestartListeners(int locked)
{
+ if (!smb_Enabled)
+ return;
+
if (!locked)
lock_ObtainMutex(&smb_StartedLock);
NCB *ncbp;
int lana, l;
+ if (!smb_Enabled)
+ return;
+
if (!locked)
lock_ObtainMutex(&smb_StartedLock);
char eventName[MAX_PATH];
int startListeners = 0;
+ if (!smb_Enabled)
+ return;
+
smb_MBfunc = aMBfunc;
smb_useV3 = useV3;
afs_uint32 i;
smb_vc_t *vcp;
+ if (!smb_Enabled)
+ return;
+
/*fprintf(stderr, "Entering smb_Shutdown\n");*/
/* setup the NCB system */
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+ if (!smb_Enabled)
+ goto done;
+
sprintf(output, "begin dumping smb_waitingLockRequest_t\r\n");
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
-
for ( wlrp = smb_allWaitingLocks; wlrp; wlrp = (smb_waitingLockRequest_t *) osi_QNext(&wlrp->q)) {
smb_waitingLock_t *lockp;
sprintf(output, "done dumping DEAD smb_vc_t\r\n");
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
+ done:
if (lock)
lock_ReleaseRead(&smb_rctLock);
return 0;
long smb_IsNetworkStarted(void)
{
long rc;
+
+ if (!smb_Enabled)
+ return 0;
+
lock_ObtainWrite(&smb_globalLock);
rc = (smb_ListenerState == SMB_LISTENER_STARTED && smbShutdownFlag == 0);
lock_ReleaseWrite(&smb_globalLock);