1 Star 0 Fork 33

ikernel_Mryao/shadow

forked from src-openEuler/shadow 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-chpasswd-fix-function-problem-with-R-parameter.patch 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
From 3732cf72d6f05fcd9d9f301eac84c1a61443e379 Mon Sep 17 00:00:00 2001
From: juyin <zhuyan34@huawei.com>
Date: Thu, 31 Mar 2022 16:48:52 +0800
Subject: [PATCH] chpasswd: fix function problem with -R parameter
Generating salt value depends on /dev/urandom. But after the
function process_root_flag changed the root directory, It does
not exist.
So, generate salt value before changeing the directory.
Fixes: #514
Reference: https://github.com/shadow-maint/shadow/commit/3732cf72d6f05fcd9d9f301eac84c1a61443e379
Conflict: NA
---
src/chpasswd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/chpasswd.c b/src/chpasswd.c
index 94e923ab..d0da14c6 100644
--- a/src/chpasswd.c
+++ b/src/chpasswd.c
@@ -451,10 +451,11 @@ int main (int argc, char **argv)
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
- process_root_flag ("-R", argc, argv);
-
process_flags (argc, argv);
+ salt = get_salt();
+ process_root_flag ("-R", argc, argv);
+
#ifdef USE_PAM
if (md5flg || eflg || cflg) {
use_pam = false;
@@ -545,7 +546,6 @@ int main (int argc, char **argv)
const struct passwd *pw;
struct passwd newpw;
- salt = get_salt();
if (salt) {
cp = pw_encrypt (newpwd, salt);
if (NULL == cp) {
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ikernel-mryao/shadow.git
git@gitee.com:ikernel-mryao/shadow.git
ikernel-mryao
shadow
shadow
master

搜索帮助