On 2 October 2010 11:44, <mt...@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-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org