Re: Event Viewer errors

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Kern Sibbald
On Wednesday 11 May 2005 16:15, Russell Howe wrote:

> Raymond Norton wrote:
> > I am getting many of the following errors on our win 2003 servers.
> >
> > Bacula error: 1063 at ..\..\filed\win32\winservice.cpp:325,
> > StartServiceCtrlDispatcher failed., The service process could not connect
> > to the service controller.
> > .
>
> I get these on Win2k servers too. They seem to occur more frequently on
> our busiest server (a Citrix server) so I suspect that it is the service
> controller not responding in a timely fashion.
>
> I traced the bacula code quickly though, and it seems that
> StartServiceCtrlDispatcher is only called when the service is first
> started up, so it seemed a little odd.

Why is this odd?  Should Bacula be restarting the service dispatcher from time
to time or what?

>
> Still, bigger fish to fry at work, and bacula's keeping a low profile at
> the moment :)

--
Best regards,

Kern

  (">
  /\
  V_V


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Russell Howe
Kern Sibbald wrote:
>>I traced the bacula code quickly though, and it seems that
>>StartServiceCtrlDispatcher is only called when the service is first
>>started up, so it seemed a little odd.
>
> Why is this odd?  Should Bacula be restarting the service dispatcher from time
> to time or what?

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.

--
Russell Howe
[hidden email]

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


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Brian McDonald
Russell Howe wrote:
Kern Sibbald wrote:
  
I traced the bacula code quickly though, and it seems that
StartServiceCtrlDispatcher is only called when the service is first
started up, so it seemed a little odd.
      
Why is this odd?  Should Bacula be restarting the service dispatcher from time 
to time or what?
    

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 believe it's the tray icon process that is doing this.  I get these messages on a 1-to-1 correlation with logging into the system via Terminal Services.

Brian

Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Russell Howe
Brian McDonald wrote:
> I believe it's the tray icon process that is doing this.  I get these
> messages on a 1-to-1 correlation with logging into the system via
> Terminal Services.

Ah, that would explain it!

We get this logged far more frequently on our Citrix server - I'd
assumed it was a time-out issue and due to the Citrix server being our
busiest box.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/startservicectrldispatcher.asp

Says that StartServiceCtrlDispatcher will only work if the process is
being started as a service (which the tray icon isn't, I assume)

Looking at the return codes for StartServiceCtrlDispatcher:

ERROR_FAILED_SERVICE_CONTROLLER_CONNECT

Typically, this error indicates that the program is being run as a
console application rather than as a service.

If the program will be run as a console application for debugging
purposes, structure it such that service-specific code is not called
when this error is returned.

Looks like bacula-fd.exe is being executed at login time and is trying
to execute code which only makes sense when being started as a service
by the service controller.

--
Russell Howe
[hidden email]

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


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Kern Sibbald
In reply to this post by Russell Howe
On Friday 13 May 2005 11:10, Russell Howe wrote:

> Kern Sibbald wrote:
> >>I traced the bacula code quickly though, and it seems that
> >>StartServiceCtrlDispatcher is only called when the service is first
> >>started up, so it seemed a little odd.
> >
> > Why is this odd?  Should Bacula be restarting the service dispatcher from
> > time to time or what?
>
> 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.

--
Best regards,

Kern

  (">
  /\
  V_V


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Russell Howe
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
[hidden email]

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

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Kern Sibbald
Hello,

I suspect that it is not a question of bconsole.exe or bacula-fd.exe doing
anything, but rather any time a Windows console application is started, the
OS wants to run the tray application for that console. If it is not a local
graphical screen, but some tty console for doing maintenance, the tray
monitor is not going to be able to display itself or to interact with the
user, so it gets upset.

Who knows.  Anyway, if someone can supply a patch that does not break it on a
regular screen console, great -- otherwise, at the moment, it is not one of
my priorities.


On Friday 13 May 2005 18:33, Russell Howe wrote:

> 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?

--
Best regards,

Kern

  (">
  /\
  V_V


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Russell Howe
Kern Sibbald wrote:
> Hello,
>
> I suspect that it is not a question of bconsole.exe or bacula-fd.exe doing
> anything, but rather any time a Windows console application is started, the
> OS wants to run the tray application for that console. If it is not a local
> graphical screen, but some tty console for doing maintenance, the tray
> monitor is not going to be able to display itself or to interact with the
> user, so it gets upset.

Which provides the tray icon? From what I can see, bconsole.exe isn't
involved here, it's just bacula-fd.

bacula.fd.exe seems to take several command line parameters. One of them
is /service, which means "You're being run by the service controller. Do
your service thing". Another is /servicehelper, which looks to mean
"Display pretty system tray icon". The current code does not distinguish
between the two, as it uses strncmp. I'm having trouble explaining
myself clearly here, I know :)

> Who knows.  Anyway, if someone can supply a patch that does not break it on a
> regular screen console, great -- otherwise, at the moment, it is not one of
> my priorities.

I can supply a patch, but I don't have a win32 build environment here,
so I wouldn't be able to test it...

As far as I can tell, the fix is to change line

if (strncmp(&szCmdLine[i], BaculaRunService, \
strlen(BaculaRunService)) == 0) {

to

if (strcmp(&szCmdLine[i], BaculaRunService) == 0) {

or to change the commandline parameters so that there is no conflict
when comparing with strncmp (i.e. don't have any parameters where one is
a substring of another, beginning at the 1st character). Changing the
command line parameters would seem to break things, however.


> On Friday 13 May 2005 18:33, Russell Howe wrote:

>>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?
Trusted to be null terminated, rather (otherwise it may be a potential
vulnerability?).

--
Russell Howe
[hidden email]

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

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Kern Sibbald
On Monday 16 May 2005 11:25, Russell Howe wrote:

> Kern Sibbald wrote:
> > Hello,
> >
> > I suspect that it is not a question of bconsole.exe or bacula-fd.exe
> > doing anything, but rather any time a Windows console application is
> > started, the OS wants to run the tray application for that console. If it
> > is not a local graphical screen, but some tty console for doing
> > maintenance, the tray monitor is not going to be able to display itself
> > or to interact with the user, so it gets upset.
>
> Which provides the tray icon? From what I can see, bconsole.exe isn't
> involved here, it's just bacula-fd.

That is *exactly* what I said above.

>
> bacula.fd.exe seems to take several command line parameters. One of them
> is /service, which means "You're being run by the service controller. Do
> your service thing". Another is /servicehelper, which looks to mean
> "Display pretty system tray icon".

No, see below.

> The current code does not distinguish
> between the two, as it uses strncmp. I'm having trouble explaining
> myself clearly here, I know :)

/servicehelper is an old artifact that should not be used, unless you want to
have all kinds of problems -- see below.

>
> > Who knows.  Anyway, if someone can supply a patch that does not break it
> > on a regular screen console, great -- otherwise, at the moment, it is not
> > one of my priorities.
>
> I can supply a patch, but I don't have a win32 build environment here,
> so I wouldn't be able to test it...
>
> As far as I can tell, the fix is to change line
>
> if (strncmp(&szCmdLine[i], BaculaRunService, \
> strlen(BaculaRunService)) == 0) {
>
> to
>
> if (strcmp(&szCmdLine[i], BaculaRunService) == 0) {
>
> or to change the commandline parameters so that there is no conflict
> when comparing with strncmp (i.e. don't have any parameters where one is
> a substring of another, beginning at the 1st character). Changing the
> command line parameters would seem to break things, however.
>
> > On Friday 13 May 2005 18:33, Russell Howe wrote:
> >>Now, the question is what commandline is bacula-fd.exe being run with
> >>when starting at logon to provide the systray icon?

The bacula-fd runs both the daemon and the systray icon.  They are just two
different threads of the same program.

> >>
> >>HKLM\Software\Microsoft\Windows\CurrentVersion\Run has this:
> >>
> >>Name: Bacula
> >>Value: "c:\bacula\bin\bacula-fd.exe" /servicehelper

If that is how you are starting Bacula, then you are starting it incorrectly.
This is probably just some other key that the original code setup that is not
used by Bacula.  Bacula should always be started as /service.  I have no idea
what the service helper code does. It is old original code that is not
functional as best I know, and I just didn't bother to rip it out.

> >>
> >>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?
>
> Trusted to be null terminated, rather (otherwise it may be a potential
> vulnerability?).

I could be wrong, but I think you are going in a completely wrong direction.  
As I previously stated, most likely it has something to do with interacting
with the user.  If it is not that then it is some new requirement that
Microsoft has added in the past few years to interact with the Service
Manager that Bacula does not understand.

--
Best regards,

Kern

  (">
  /\
  V_V


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Russell Howe
Kern Sibbald wrote:
> On Monday 16 May 2005 11:25, Russell Howe wrote:
>
>>/servicehelper, which looks to mean "Display pretty system tray icon".
>
> No, see below.

OK, I had misconceptions about the /servicehelper switch.

> /servicehelper is an old artifact that should not be used, unless you want to
> have all kinds of problems -- see below.

OK. I notice that the current code in src/filed/win32/winmain.cpp
doesn't even check for it as a commandline option.

> The bacula-fd runs both the daemon and the systray icon.  They are just two
> different threads of the same program.

Ah, this I didn't realise - it explains some of my confusion :)

>>>>HKLM\Software\Microsoft\Windows\CurrentVersion\Run has this:
>>>>
>>>>Name: Bacula
>>>>Value: "c:\bacula\bin\bacula-fd.exe" /servicehelper
>
>
> If that is how you are starting Bacula, then you are starting it incorrectly.

This was not set up by me - looking at the source, it is set up by the
InstallService() member function of bacService. Take a look around line
528 of src/bacula/filed/win32/winservice.cpp:

// Now install the servicehelper registry setting...
// Locate the RunService registry entry
HKEY runapps;
if (RegCreateKey(HKEY_LOCAL_MACHINE,
        "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
        &runapps) != ERROR_SUCCESS) {

It then looks like bacula-fd.exe goes on to add itself to this startup key.

So, when bacula-fd is run with the /install switch, it creates this
HKLM\Software\Windows\CurrentVersion\Run key, as well as doing things
like registering itself with the service manager (at least on NT and above).

I don't know if removing this key on Win9x/ME will have any adverse
effects, although the code seems to add an entry under RunServices on
those OSes, so I suspect the key under Run is just noise. Since the code
doesn't even seem to check for the option, I don't see that it can be
doing anything...

> This is probably just some other key that the original code setup that is not
> used by Bacula.  Bacula should always be started as /service.  I have no idea
> what the service helper code does. It is old original code that is not
> functional as best I know, and I just didn't bother to rip it out.

Well, I have removed this startup key on one of our servers, so there is
no longer any copy of bacula running with the /servicehelper switch.
I'll let you know if it causes any weirdness. Removing the key certainly
stops the warning messages being logged when users log in via terminal
services.

>>>>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?
>>
>>Trusted to be null terminated, rather (otherwise it may be a potential
>>vulnerability?).
>
> I could be wrong, but I think you are going in a completely wrong direction.
> As I previously stated, most likely it has something to do with interacting
> with the user.  If it is not that then it is some new requirement that
> Microsoft has added in the past few years to interact with the Service
> Manager that Bacula does not understand.

Well, from where I'm sitting it looks like a couple of things:

* The registry key is (presumably?) superfluous and should not be
created when the FD is installed as a service in Windows. This will also
be one less thing to run at bootup, which I'm sure is welcome :)

* The commandline option parsing sees the following two options as
identical:

        foo
        foobar

(but will also pick up the 'foobar' option if it checks for it). This
isn't a problem, as long as command line options are picked such that
none follow the above pattern.

Had the latter not been the case, I suspect bacula-fd.exe would simply
have terminated as soon as it had been called with /servicehelper, with
an error to the effect that it didn't know what '/servicehelper' meant.
Instead, it took it to mean /service and tried to register itself with
the service helper (which MS says an application started from the
console cannot do).

--
Russell Howe
[hidden email]

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


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Kern Sibbald
On Tuesday 17 May 2005 11:37, Russell Howe wrote:

> Kern Sibbald wrote:
> > On Monday 16 May 2005 11:25, Russell Howe wrote:
> >>/servicehelper, which looks to mean "Display pretty system tray icon".
> >
> > No, see below.
>
> OK, I had misconceptions about the /servicehelper switch.
>
> > /servicehelper is an old artifact that should not be used, unless you
> > want to have all kinds of problems -- see below.
>
> OK. I notice that the current code in src/filed/win32/winmain.cpp
> doesn't even check for it as a commandline option.
>
> > The bacula-fd runs both the daemon and the systray icon.  They are just
> > two different threads of the same program.
>
> Ah, this I didn't realise - it explains some of my confusion :)
>
> >>>>HKLM\Software\Microsoft\Windows\CurrentVersion\Run has this:
> >>>>
> >>>>Name: Bacula
> >>>>Value: "c:\bacula\bin\bacula-fd.exe" /servicehelper
> >
> > If that is how you are starting Bacula, then you are starting it
> > incorrectly.
>
> This was not set up by me - looking at the source, it is set up by the
> InstallService() member function of bacService. Take a look around line
> 528 of src/bacula/filed/win32/winservice.cpp:
>
> // Now install the servicehelper registry setting...
> // Locate the RunService registry entry
> HKEY runapps;
> if (RegCreateKey(HKEY_LOCAL_MACHINE,
> "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
> &runapps) != ERROR_SUCCESS) {
>
> It then looks like bacula-fd.exe goes on to add itself to this startup key.
>
> So, when bacula-fd is run with the /install switch, it creates this
> HKLM\Software\Windows\CurrentVersion\Run key, as well as doing things
> like registering itself with the service manager (at least on NT and
> above).
>
> I don't know if removing this key on Win9x/ME will have any adverse
> effects, although the code seems to add an entry under RunServices on
> those OSes, so I suspect the key under Run is just noise.

Yes, a sort of pollution of the already polluted registry.

> Since the code
> doesn't even seem to check for the option, I don't see that it can be
> doing anything...

This is what I believe. When I first wrote the code, I didn't understand the
need for this key, but I was tired of tweaking things so just left it ...

>
> > This is probably just some other key that the original code setup that is
> > not used by Bacula.  Bacula should always be started as /service.  I have
> > no idea what the service helper code does. It is old original code that
> > is not functional as best I know, and I just didn't bother to rip it out.
>
> Well, I have removed this startup key on one of our servers, so there is
> no longer any copy of bacula running with the /servicehelper switch.
> I'll let you know if it causes any weirdness.

> Removing the key certainly
> stops the warning messages being logged when users log in via terminal
> services.

Well, this is a big surprise.  If this is all that it takes to correct the
problem, first it is easy enough to publish, and second, I'll be very happy
to remove the old code.

>
> >>>>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?
> >>
> >>Trusted to be null terminated, rather (otherwise it may be a potential
> >>vulnerability?).
> >
> > I could be wrong, but I think you are going in a completely wrong
> > direction. As I previously stated, most likely it has something to do
> > with interacting with the user.  If it is not that then it is some new
> > requirement that Microsoft has added in the past few years to interact
> > with the Service Manager that Bacula does not understand.
>
> Well, from where I'm sitting it looks like a couple of things:
>
> * The registry key is (presumably?) superfluous and should not be
> created when the FD is installed as a service in Windows. This will also
> be one less thing to run at bootup, which I'm sure is welcome :)

Yes, I agree as long as removing it doesn't break something.

>
> * The commandline option parsing sees the following two options as
> identical:
>
> foo
> foobar
>
> (but will also pick up the 'foobar' option if it checks for it). This
> isn't a problem, as long as command line options are picked such that
> none follow the above pattern.

This was on purpose to allow shorter versions of the command line options.
Probably it was a bad idea.

>
> Had the latter not been the case, I suspect bacula-fd.exe would simply
> have terminated as soon as it had been called with /servicehelper, with
> an error to the effect that it didn't know what '/servicehelper' meant.
> Instead, it took it to mean /service and tried to register itself with
> the service helper (which MS says an application started from the
> console cannot do).

Could you explain to me why and when Bacula would be called from that
ServiceHelper key?  Also, what is a Service helper?  I don't *really need to
know these things, but it might help me feeling a bit more at ease about
removing it ...

--
Best regards,

Kern

  (">
  /\
  V_V


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: Event Viewer errors

Russell Howe
Kern Sibbald wrote:
> On Tuesday 17 May 2005 11:37, Russell Howe wrote:
>>Removing the key certainly
>>stops the warning messages being logged when users log in via terminal
>>services.
>
> Well, this is a big surprise.  If this is all that it takes to correct the
> problem, first it is easy enough to publish, and second, I'll be very happy
> to remove the old code.

I think it may well be that easy, yes. That said, this isn't causing any
problems, it just logs a warning message in the logs whenever anyone
logs into a Windows machine via terminal services (i.e. remotely), so it
seems pretty harmless. It's just not Right(tm) though :)

>>* The commandline option parsing sees the following two options as
>>identical:
>>
>> foo
>> foobar
>
> This was on purpose to allow shorter versions of the command line options.
> Probably it was a bad idea.

I'm not sure that allowing abbreviated commandline options is all that
useful - especially on Windows, where it is rare to be typing them in
manually, and things tend to be scripted someplace.

>>Had the latter not been the case, I suspect bacula-fd.exe would simply
>>have terminated as soon as it had been called with /servicehelper, with
>>an error to the effect that it didn't know what '/servicehelper' meant.
>>Instead, it took it to mean /service and tried to register itself with
>>the service helper (which MS says an application started from the
>>console cannot do).
>
> Could you explain to me why and when Bacula would be called from that
> ServiceHelper key?  Also, what is a Service helper?  I don't *really need to
> know these things, but it might help me feeling a bit more at ease about
> removing it ...

/servicehelper is the command line option passed to bacula-fd.exe. I
don't know what it was intended for, but it doesn't seem to even be
checked for any more. Due to the above command line parsing behaviour,
/servicehelper is interpreted as /service.

RunServices is the name of the registry key located at:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices

It is much like the 'Run' key in the same location, but I think that
programs listed here are started before logon (whereas entries under
'Run' are started at logon time).

On NT-based OSes, I suppose the service controller is the preferred
(only?) way to start service-type applications, so the RunServices key
is only really appropriate for Win95/98/ME.

Please don't trust what I say though, I'm no expert in the Windows
startup process - all the above is based on observation & user-level
experience rather than hard documentation.

--
Russell Howe
[hidden email]

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


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users