mirror of
https://github.com/troglobit/finit.git
synced 2026-11-18 19:30:56 +00:00
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:
1 parent
a822a7657c
commit
af7b6c17cb
1 file changed
+9
-9
@@ -687,15 +687,7 @@ int service_register(int type, char *line, time_t mtime, char *username)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (cmd) {
|
while (cmd) {
|
||||||
if (cmd[0] != '/' && strchr(cmd, '/'))
|
if (cmd[0] == '@') /* @username[:group] */
|
||||||
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] */
|
|
||||||
username = &cmd[1];
|
username = &cmd[1];
|
||||||
else if (cmd[0] == '[') /* [runlevels] */
|
else if (cmd[0] == '[') /* [runlevels] */
|
||||||
runlevels = &cmd[0];
|
runlevels = &cmd[0];
|
||||||
@@ -703,6 +695,14 @@ int service_register(int type, char *line, time_t mtime, char *username)
|
|||||||
events = &cmd[1];
|
events = &cmd[1];
|
||||||
else if (cmd[0] == ':') /* :ID */
|
else if (cmd[0] == ':') /* :ID */
|
||||||
id = atoi(&cmd[1]);
|
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
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user