service: allow starting service with user's realuid

This commit is contained in:
Thomas Veerman
2012-02-01 13:21:56 +00:00
parent d5210e9bdd
commit d4cdd59eaa
3 changed files with 14 additions and 5 deletions
+10 -4
View File
@@ -138,11 +138,17 @@ PRIVATE void do_uid(config_t *cpe, struct rs_start *rs_start)
uid= pw->pw_uid;
else
{
uid= strtol(cpe->word, &check, 0);
if (check[0] != '\0')
if (!strncmp(cpe->word, KW_SELF, strlen(KW_SELF)+1))
{
fatal("do_uid: bad uid/login '%s' at %s:%d",
cpe->word, cpe->file, cpe->line);
uid= getuid(); /* Real uid */
}
else {
uid= strtol(cpe->word, &check, 0);
if (check[0] != '\0')
{
fatal("do_uid: bad uid/login '%s' at %s:%d",
cpe->word, cpe->file, cpe->line);
}
}
}