sysusers: support u username -:300 style syntax (#8325)

This PR implements the first part of RFE #8046. I.e. this allows to
write:
```
u username -:300
```
Where the uid is chosen automatically but the gid is fixed.
This commit is contained in:
Michael Vogt
2018-03-02 12:56:44 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent 283def70cf
commit 1825c909ff
8 changed files with 17 additions and 6 deletions
+6 -5
View File
@@ -1599,11 +1599,12 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
i->id_set_strict = true;
free_and_replace(resolved_id, uid);
}
r = parse_uid(resolved_id, &i->uid);
if (r < 0)
return log_error_errno(r, "Failed to parse UID: '%s': %m", id);
i->uid_set = true;
if (!streq(resolved_id, "-")) {
r = parse_uid(resolved_id, &i->uid);
if (r < 0)
return log_error_errno(r, "Failed to parse UID: '%s': %m", id);
i->uid_set = true;
}
}
}