Correctly parse service configuration stanzas containing slashes

Parser would erroneously interpret an event specification containing
slashes as an inet service/proto specification.

E.g. "<net/gw>" was interpreted as port "<net" using protocol "gw>".
This commit is contained in:
Tobias Waldekranz committed 2016-01-05 14:50:13 +01:00
1 parent a822a7657c
commit af7b6c17cb
1 file changed
+9 -9
+9 -9
View File
@@ -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;