Kern Sibbald wrote:
>>I meant that it seemed a little odd that this message was being logged
>>multiple times when I certainly wasn't restarting the fd on the Windows
>>machine. I know the service manager does have the facility to restart
>>services, but as far as I am aware, it's not been doing that to the fd.
> 
> I suspect that the Service controller is checking from time to time, or some 
> other Microsoft wonder, and Bacula doesn't understand what is going on.

Hm, what I think is going on is that the StartServiceCtrlDispatcher()
call is being made by bacula-fd.exe both when it is started as a service
by the service controller *and* when started to provide a tray icon.

Since the StartServiceCtrlDispatcher is specified as failing when called
from a console application (and presumably when called from anything
that hasn't been spawned by the service controller?), when called by the
tray icon process, it fails and logs the error.

The call to StartServiceCtrlDispatcher is on line 324 of
bacula/src/filed/win32/winservice.cpp (current CVS) in
bacService::BaculaServiceMain()

bacService::BaculaServiceMain() is called from winmain.cpp, line 171, in
the WinMain() function:

if (strncmp(&szCmdLine[i], BaculaRunService, strlen(BaculaRunService))
== 0) {
        /* Run Bacula as a service */
        return bacService::BaculaServiceMain();
}

Which looks fine - BaculaServiceMain (and thence
StartServiceCtrlDispatcher) should presumably only be called when being
run as a service, and this check would seem to restrict it to this case.

Now, the question is what commandline is bacula-fd.exe being run with
when starting at logon to provide the systray icon?

HKLM\Software\Microsoft\Windows\CurrentVersion\Run has this:

Name: Bacula
Value: "c:\bacula\bin\bacula-fd.exe" /servicehelper

The problem (as far as I can see - I haven't got the setup to build
Windows programs here) is that strncmp(&szCmdLine[i], BaculaRunService,
strlen(BaculaRunService)) is being called like this:

strncmp("/servicehelper", "/service", 8) and is only matching on the 1st
8 characters of "/servicehelper".

"/service" is then seen as equal to "/servicehelper"

Should it not be strcmp(&szCmdLine[i], BaculaRunService)? Is
szCmdLine[i] trusted?

-- 
Russell Howe
[EMAIL PROTECTED]

Today's Nemi: http://www.metro.co.uk/img/pix/nemi_may13.jpg

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to