Author: mturk
Date: Sat Oct  2 14:21:39 2010
New Revision: 1003805

URL: http://svn.apache.org/viewvc?rev=1003805&view=rev
Log:
Use full windows file naming convention for checking the service name validity

Modified:
    commons/proper/daemon/trunk/src/native/windows/src/service.c

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=1003805&r1=1003804&r2=1003805&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 
14:21:39 2010
@@ -39,16 +39,19 @@ typedef struct APXSERVICE {
 
 } APXSERVICE, *LPAPXSERVICE;
 
+static WCHAR __invalidPathChars[] = L" <>:\"/\\:|?*";
 static BOOL __apxIsValidServiceName(LPCWSTR szServiceName)
 {
     WCHAR ch;
     int   i = 0;
     while ((ch = szServiceName[i++])) {
-        if (ch == L'/' || ch == '\\' ||
-            ch == L' ') {
-            apxDisplayError(FALSE, NULL, 0, "Invalid service (%S) char '%C' 
detected",
-                            szServiceName, ch);
-            return FALSE;
+        int j = 0;
+        while (__invalidPathChars[j]) {
+            if (ch < 30 || ch == __invalidPathChars[j++]) {
+                apxDisplayError(FALSE, NULL, 0, "Service '%S' contains invalid 
character '%C'",
+                                szServiceName, ch);
+                return FALSE;
+            }
         }
     }
     return TRUE;


Reply via email to