Use malloc'ed strings instead of static libc buffers for user and group lookup (#42184)
Preparation for other work.
This commit is contained in:
@@ -430,8 +430,7 @@ static int condition_test_user(Condition *c, char **env) {
|
||||
if (streq(username, c->parameter))
|
||||
return 1;
|
||||
|
||||
const char *u = c->parameter;
|
||||
r = get_user_creds(&u, &id, NULL, NULL, NULL, USER_CREDS_ALLOW_MISSING);
|
||||
r = get_user_creds(c->parameter, USER_CREDS_ALLOW_MISSING, NULL, &id, NULL, NULL, NULL);
|
||||
if (r < 0)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -1704,9 +1704,7 @@ static int add_matches_for_coredump_uid(sd_journal *j, MatchUnitFlag flags, cons
|
||||
return 0;
|
||||
|
||||
if (cached_uid == 0) {
|
||||
const char *user = "systemd-coredump";
|
||||
|
||||
r = get_user_creds(&user, &cached_uid, NULL, NULL, NULL, 0);
|
||||
r = get_user_creds("systemd-coredump", /* flags= */ 0, NULL, &cached_uid, NULL, NULL, NULL);
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to resolve systemd-coredump user, ignoring: %m");
|
||||
cached_uid = UID_INVALID;
|
||||
|
||||
Reference in New Issue
Block a user