From af7b6c17cb82bfe7a00b9713be8b69861ba2614c Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Wed, 2 Dec 2015 12:22:39 +0100 Subject: [PATCH] Correctly parse service configuration stanzas containing slashes Parser would erroneously interpret an event specification containing slashes as an inet service/proto specification. E.g. "" was interpreted as port "". --- service.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/service.c b/service.c index 16cadef8..f598fa52 100644 --- a/service.c +++ b/service.c @@ -687,15 +687,7 @@ int service_register(int type, char *line, time_t mtime, char *username) } while (cmd) { - if (cmd[0] != '/' && strchr(cmd, '/')) - service = cmd; /* inetd service/proto */ -#ifndef INETD_DISABLED - else if (!strncasecmp(cmd, "nowait", 6)) - forking = 1; - else if (!strncasecmp(cmd, "wait", 4)) - forking = 0; -#endif - else if (cmd[0] == '@') /* @username[:group] */ + if (cmd[0] == '@') /* @username[:group] */ username = &cmd[1]; else if (cmd[0] == '[') /* [runlevels] */ runlevels = &cmd[0]; @@ -703,6 +695,14 @@ int service_register(int type, char *line, time_t mtime, char *username) events = &cmd[1]; else if (cmd[0] == ':') /* :ID */ id = atoi(&cmd[1]); +#ifndef INETD_DISABLED + else if (!strncasecmp(cmd, "nowait", 6)) + forking = 1; + else if (!strncasecmp(cmd, "wait", 4)) + forking = 0; +#endif + else if (cmd[0] != '/' && strchr(cmd, '/')) + service = cmd; /* inetd service/proto */ else break;