|
|
ab00cd |
From 96698a525784ad91cb27b572dd5f871c183fdfa5 Mon Sep 17 00:00:00 2001
|
|
|
ab00cd |
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
|
|
|
ab00cd |
Date: Sun, 28 Jul 2019 12:25:35 +0200
|
|
|
ab00cd |
Subject: [PATCH 1/3] Set s_uwtmp_inserted only after record insertion/removal
|
|
|
ab00cd |
|
|
|
ab00cd |
pututxline() is the function that actually inserts the new record, so
|
|
|
ab00cd |
setting 's_uwtmp_inserted' before calling pututxline() doesn't make
|
|
|
ab00cd |
sense.
|
|
|
ab00cd |
|
|
|
ab00cd |
We'll need this change for other fixes.
|
|
|
ab00cd |
---
|
|
|
ab00cd |
sysdeputil.c | 4 ++--
|
|
|
ab00cd |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
ab00cd |
|
|
|
ab00cd |
diff --git a/sysdeputil.c b/sysdeputil.c
|
|
|
ab00cd |
index 4fe56c2..bd1e8c9 100644
|
|
|
ab00cd |
--- a/sysdeputil.c
|
|
|
ab00cd |
+++ b/sysdeputil.c
|
|
|
ab00cd |
@@ -1224,7 +1224,6 @@ vsf_insert_uwtmp(const struct mystr* p_user_str,
|
|
|
ab00cd |
sizeof(s_utent.ut_line));
|
|
|
ab00cd |
str_free(&line_str);
|
|
|
ab00cd |
}
|
|
|
ab00cd |
- s_uwtmp_inserted = 1;
|
|
|
ab00cd |
s_utent.ut_type = USER_PROCESS;
|
|
|
ab00cd |
s_utent.ut_pid = vsf_sysutil_getpid();
|
|
|
ab00cd |
vsf_sysutil_strcpy(s_utent.ut_user, str_getbuf(p_user_str),
|
|
|
ab00cd |
@@ -1235,6 +1234,7 @@ vsf_insert_uwtmp(const struct mystr* p_user_str,
|
|
|
ab00cd |
setutxent();
|
|
|
ab00cd |
(void) pututxline(&s_utent);
|
|
|
ab00cd |
endutxent();
|
|
|
ab00cd |
+ s_uwtmp_inserted = 1;
|
|
|
ab00cd |
updwtmpx(WTMPX_FILE, &s_utent);
|
|
|
ab00cd |
}
|
|
|
ab00cd |
|
|
|
ab00cd |
@@ -1245,7 +1245,6 @@ vsf_remove_uwtmp(void)
|
|
|
ab00cd |
{
|
|
|
ab00cd |
return;
|
|
|
ab00cd |
}
|
|
|
ab00cd |
- s_uwtmp_inserted = 0;
|
|
|
ab00cd |
s_utent.ut_type = DEAD_PROCESS;
|
|
|
ab00cd |
vsf_sysutil_memclr(s_utent.ut_user, sizeof(s_utent.ut_user));
|
|
|
ab00cd |
vsf_sysutil_memclr(s_utent.ut_host, sizeof(s_utent.ut_host));
|
|
|
ab00cd |
@@ -1253,6 +1252,7 @@ vsf_remove_uwtmp(void)
|
|
|
ab00cd |
setutxent();
|
|
|
ab00cd |
(void) pututxline(&s_utent);
|
|
|
ab00cd |
endutxent();
|
|
|
ab00cd |
+ s_uwtmp_inserted = 0;
|
|
|
ab00cd |
s_utent.ut_tv.tv_sec = vsf_sysutil_get_time_sec();
|
|
|
ab00cd |
updwtmpx(WTMPX_FILE, &s_utent);
|
|
|
ab00cd |
}
|
|
|
ab00cd |
--
|
|
|
ab00cd |
2.20.1
|
|
|
ab00cd |
|