diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-03-24 19:16:44 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-03-24 19:16:44 -0600 |
commit | dd1a804ceac5de3614c9a4e406e738ca58770db1 (patch) | |
tree | 4743ff6faebadd34a1e5873b947018fad4a25633 | |
parent | 7ff59362ba9fcf50fbac5ceba80a67fedaa08a05 (diff) | |
download | sudo-dd1a804ceac5de3614c9a4e406e738ca58770db1.tar.gz |
utmp_fill: user is now always non-NULL, no need for user_details.
-rw-r--r-- | src/utmp.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/utmp.c b/src/utmp.c index 952bf3043..397f329ea 100644 --- a/src/utmp.c +++ b/src/utmp.c @@ -158,15 +158,10 @@ utmp_fill(const char *line, const char *user, sudo_utmp_t *ut_old, if (ut_old == NULL) { memset(ut_new, 0, sizeof(*ut_new)); - if (user == NULL) { - strncpy(ut_new->ut_user, user_details.username, - sizeof(ut_new->ut_user)); - } } else if (ut_old != ut_new) { memcpy(ut_new, ut_old, sizeof(*ut_new)); } - if (user != NULL) - strncpy(ut_new->ut_user, user, sizeof(ut_new->ut_user)); + strncpy(ut_new->ut_user, user, sizeof(ut_new->ut_user)); strncpy(ut_new->ut_line, line, sizeof(ut_new->ut_line)); #if defined(HAVE_STRUCT_UTMP_UT_ID) utmp_setid(ut_old, ut_new); |