commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1003770 - in /commons/proper/daemon/trunk: RELEASE-NOTES.txt src/native/windows/src/service.c
Date Sat, 02 Oct 2010 13:16:46 GMT
On 2 October 2010 11:44,  <mturk@apache.org> wrote:
> Author: mturk
> Date: Sat Oct  2 10:44:05 2010
> New Revision: 1003770
>
> URL: http://svn.apache.org/viewvc?rev=1003770&view=rev
> Log:
> Partially fix DAEMON-164, The service names cannot have spaces however
>
> Modified:
>    commons/proper/daemon/trunk/RELEASE-NOTES.txt
>    commons/proper/daemon/trunk/src/native/windows/src/service.c
>
> Modified: commons/proper/daemon/trunk/RELEASE-NOTES.txt
> URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/RELEASE-NOTES.txt?rev=1003770&r1=1003769&r2=1003770&view=diff
> ==============================================================================
> --- commons/proper/daemon/trunk/RELEASE-NOTES.txt (original)
> +++ commons/proper/daemon/trunk/RELEASE-NOTES.txt Sat Oct  2 10:44:05 2010
> @@ -46,7 +46,7 @@ NEW FEATURES:
>
>  BUG FIXES:
>
> -1.0.4: DAEMON-95, DAEMON-171, DAEMON-100, DAEMON-165
> +1.0.4: DAEMON-95, DAEMON-171, DAEMON-100, DAEMON-164, DAEMON-165
>
>  1.0.3: DAEMON-108, DAEMON-128, DAEMON-139, DAEMON-143, DAEMON-148,
>        DAEMON-135, DAEMON-155, DAEMON-159, DAEMON-161, DAEMON-145, DAEMON-146,
>
> Modified: commons/proper/daemon/trunk/src/native/windows/src/service.c
> URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/src/service.c?rev=1003770&r1=1003769&r2=1003770&view=diff
> ==============================================================================
> --- commons/proper/daemon/trunk/src/native/windows/src/service.c (original)
> +++ commons/proper/daemon/trunk/src/native/windows/src/service.c Sat Oct  2 10:44:05
2010
> @@ -41,12 +41,16 @@ typedef struct APXSERVICE {
>
>  static BOOL __apxIsValidServiceName(LPCWSTR szServiceName)
>  {
> -    do {
> -        if (!IsCharAlphaNumericW(*szServiceName)) {
> -            apxDisplayError(FALSE, NULL, 0, "NonAlpha %d", *szServiceName);
> +    WCHAR ch;
> +    int   i = 0;
> +    while ((ch = szServiceName[i++])) {
> +        if (ch == L'/' || ch == '\\' ||
> +            ch == L' ') {

Not sure that is entirely safe?
AFAICT, the service name can now contain arbitrary non-alphanumeric
characters, including control chars.
For example, I don't think it's wise to allow > < or | - and there are
probably others.

Why not check for alpha-numeric plus a restricted range of additional
ones such as underscore and minus?
It would be easy enough to create an "isCharValidForServiceName" method.

> +            apxDisplayError(FALSE, NULL, 0, "Invalid service (%S) char '%C' detected",
> +                            szServiceName, ch);
>             return FALSE;
>         }
> -    } while( *(++szServiceName));
> +    }
>     return TRUE;
>  }
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message