1 Star 0 Fork 0

sdf_2022/vsftpd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-Set-s_uwtmp_inserted-only-after-record-insertion-rem.patch 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
东风 提交于 2023-09-26 14:57 . upload src file
From 96698a525784ad91cb27b572dd5f871c183fdfa5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
Date: Sun, 28 Jul 2019 12:25:35 +0200
Subject: [PATCH 1/2] Set s_uwtmp_inserted only after record insertion/removal
pututxline() is the function that actually inserts the new record, so
setting 's_uwtmp_inserted' before calling pututxline() doesn't make
sense.
We'll need this change for other fixes.
---
sysdeputil.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeputil.c b/sysdeputil.c
index 4fe56c2..bd1e8c9 100644
--- a/sysdeputil.c
+++ b/sysdeputil.c
@@ -1224,7 +1224,6 @@ vsf_insert_uwtmp(const struct mystr* p_user_str,
sizeof(s_utent.ut_line));
str_free(&line_str);
}
- s_uwtmp_inserted = 1;
s_utent.ut_type = USER_PROCESS;
s_utent.ut_pid = vsf_sysutil_getpid();
vsf_sysutil_strcpy(s_utent.ut_user, str_getbuf(p_user_str),
@@ -1235,6 +1234,7 @@ vsf_insert_uwtmp(const struct mystr* p_user_str,
setutxent();
(void) pututxline(&s_utent);
endutxent();
+ s_uwtmp_inserted = 1;
updwtmpx(WTMPX_FILE, &s_utent);
}
@@ -1245,7 +1245,6 @@ vsf_remove_uwtmp(void)
{
return;
}
- s_uwtmp_inserted = 0;
s_utent.ut_type = DEAD_PROCESS;
vsf_sysutil_memclr(s_utent.ut_user, sizeof(s_utent.ut_user));
vsf_sysutil_memclr(s_utent.ut_host, sizeof(s_utent.ut_host));
@@ -1253,6 +1252,7 @@ vsf_remove_uwtmp(void)
setutxent();
(void) pututxline(&s_utent);
endutxent();
+ s_uwtmp_inserted = 0;
s_utent.ut_tv.tv_sec = vsf_sysutil_get_time_sec();
updwtmpx(WTMPX_FILE, &s_utent);
}
--
2.20.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/songdf_2022/vsftpd.git
git@gitee.com:songdf_2022/vsftpd.git
songdf_2022
vsftpd
vsftpd
master

搜索帮助