Blame SOURCES/sudo-1.9.5-utmp-leak.patch

698cd1
From 3fc3a07a03ef74fde99db40ce9ef43ccab336205 Mon Sep 17 00:00:00 2001
698cd1
From: MertsA <andrewmerts@gmail.com>
698cd1
Date: Fri, 23 Jul 2021 03:36:05 -0700
698cd1
Subject: [PATCH] Rewind utmp file pointer after searching for entry
698cd1
698cd1
getutline() advances the file pointer until it matches or reaches EOF. pututline() starts from the current position in utmp. This rewinds the file pointer to the beginning to avoid allocating additional spurious utmp entries.
698cd1
---
698cd1
 src/utmp.c | 1 +
698cd1
 1 file changed, 1 insertion(+)
698cd1
698cd1
diff --git a/src/utmp.c b/src/utmp.c
698cd1
index 544a37519..952bf3043 100644
698cd1
--- a/src/utmp.c
698cd1
+++ b/src/utmp.c
698cd1
@@ -210,6 +210,7 @@ utmp_login(const char *from_line, const char *to_line, int ttyfd,
698cd1
 	memset(&utbuf, 0, sizeof(utbuf));
698cd1
 	strncpy(utbuf.ut_line, from_line, sizeof(utbuf.ut_line));
698cd1
 	ut_old = sudo_getutline(&utbuf);
698cd1
+	sudo_setutent();
698cd1
     }
698cd1
     utmp_fill(to_line, user, ut_old, &utbuf);
698cd1
     if (sudo_pututline(&utbuf) != NULL)