tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schreibman, David" <>
Subject PATCH: NT Service display name should not be used as service name
Date Thu, 20 Dec 2001 16:02:16 GMT

We've encountered a problem with the way jk_nt_service.c creates nt

Specifically, the call to CreateService uses the name passed in for the
service as both the service name and the service display name.  This is a
problem because there are restrictions on the service name that do not apply
to the display name.  The MS documentation states that neither forward nor
back slashes are allowed but in practice I have found that other characters
cause problems as well.

For example, if you create a service via jk_nt_service -i "My Service" the service creates just fine but it fails to start.

Since the MS source is not readily available we can't check on what the REAL
rules are for the internal service name.

To be safe, a solution I have used in the past is to treat the name passed
in via the command line as the display name, and then remove all
non-alphanumeric characters to generate the internal service name.

This is cheap, but might cause trouble if you are unlucky enough to have
multiple service display names mapping to a single internal name as in "My
Service 1.1" and "My Service 11".

An alternative that fixes this is to convert non alphanumerics to their hex

I've attached a patch using the first approach since I've used in in the
past without any problems.  I'll be happy to rework it to hex encode non
alphanumerics if there is interest.


View raw message