[Date Prev][Date Next]
Re: (ITS#5002) Windows Service: logoff causes shutdown
This bug was fixed several years ago. You should update to a current
release. This ITS will be closed.
> Full_Name: Mark Lakes
> Version: 2.1.22
> OS: Windows
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (126.96.36.199)
> Summary: LDAP service stops when user logs off.
> The LDAP server is registered as a Windows Service and works correctly with
> It is registered as an automatic service so should be running all the time.
> When a user logs off from the box, the logoff triggers the service to stop
> This happens on WindowsXP and Windows 2003 Server that are configured on a
> I have a solution.
> The problem is that despite the fact it is a service, it receives an event
> called CTRL_LOGOFF_EVENT. Since it is not handling this event, the default
> behavior by Windows is to shutdown the service.
> Add the following code to the source at an appropriate place(probably somewhere
> in ntservice.c) for when it runs as a service:
> This is used to handle CTRL_LOGOFF_EVENT from shutting us down when we are
> running as a service.
> Return TRUE works. We dont really care what the crtlType is.
> BOOL WINAPI
> WinSigHANDLER_ROUTINE(DWORD ctrlType)
> char logstr;
> sprintf(logstr, "NTservice: caught signal(%d)\n", ctrlType);
> switch (ctrlType)
> case CTRL_LOGOFF_EVENT:
> } */
> return TRUE;
> Then, register the above function in the appropriate place as follows:
> SetConsoleCtrlHandler(WinSigHANDLER_ROUTINE, TRUE);
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/