Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
55ae8b52fb
!23 [sync] PR-20: update passwd manual page
From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-07-04 08:29:38 +00:00
李宇哲
07cb0f0455 update passwd manual page
Signed-off-by: 李宇哲 <liyuzhe@cqsoftware.com.cn>
(cherry picked from commit 92179b7822d9174125544244640b66b9765a39b2)
2024-07-04 16:06:21 +08:00
openeuler-ci-bot
ae12ae379d
!13 fix incorrect -S output
From: @wave-information_0 
Reviewed-by: @houmingyong, @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
2022-08-19 08:15:27 +00:00
xueyamao
d445a991da fix incorrect -S output
There is a password information set in /etc/shadow,but the password field in /etc/passwd is empty.

Signed-off-by: xueyamao <xueyamao@kylinos.cn>
2022-08-19 15:52:42 +08:00
openeuler-ci-bot
852f752d43
!9 [sync] PR-8: add sm3 crypt support
Merge pull request !9 from openeuler-sync-bot/sync-pr8-openEuler-20.03-LTS-Next-to-master
2022-01-24 02:36:32 +00:00
lujie42
2717ef9340 add sm3 crypt support
(cherry picked from commit 0f9094f1ec39c3761d9b3897ead43a85d1061099)
2022-01-24 10:11:26 +08:00
openeuler-ci-bot
0c693589db !2 Mainline:depend on audit-libs instead of audit
From: @hugel
Reviewed-by: @hanxinke
Signed-off-by: @hanxinke
2021-09-10 11:26:27 +00:00
Hugel
14ac7b1a9e depend on audit-libs instead of audit 2021-09-10 18:40:52 +08:00
openeuler-ci-bot
cf3362e57e !1 add yaml file
Merge pull request !1 from linwei9/master
2020-07-13 18:11:49 +08:00
linwei9
0fc5d3106b add yaml file 2020-06-18 16:02:42 +08:00
5 changed files with 176 additions and 2 deletions

View File

@ -0,0 +1,27 @@
From 87c95887b93ffac388b30ea81d41f83782e8cd34 Mon Sep 17 00:00:00 2001
From: lujie42 <lujie42@huawei.com>
Date: Thu, 28 Oct 2021 20:06:53 +0800
Subject: [PATCH] add sm3 crypt support
Signed-off-by: lujie42 <lujie42@huawei.com>
---
libuser.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libuser.c b/libuser.c
index 7a36520..f5bedc1 100644
--- a/libuser.c
+++ b/libuser.c
@@ -298,6 +298,9 @@ pwdb_display_status(const char *username)
} else if (strncmp(current, "$6$", 3) ==
0) {
msg = _("Password set, SHA512 crypt.");
+ } else if (strncmp(current, "$sm3$", 5) ==
+ 0) {
+ msg = _("Password set, SM3 crypt.");
} else {
msg = _("Password set, unknown crypt variant.");
}
--
1.8.3.1

View File

@ -0,0 +1,65 @@
From c023fa6c17c083caefe4ef41627556c3232fea08 Mon Sep 17 00:00:00 2001
From: Jiri Kucera <jkucera@redhat.com>
Date: Dec 03 2019 13:41:36 +0000
https://pagure.io/passwd/c/ff60631b73e48ab28fc984cd8f8206d18e369b82.patch
Subject: [PATCH] fix incorrect -S output
Fix incorrect -S output when password field in /etc/passwd is empty
but the password information in /etc/shadow is set.
---
libuser.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/libuser.c b/libuser.c
index f5bedc1..4ccd74c 100644
--- a/libuser.c
+++ b/libuser.c
@@ -245,6 +245,7 @@ pwdb_display_status(const char *username)
struct lu_ent *ent;
struct lu_error *error = NULL;
char *current;
+ char *current_user;
char *realname;
const char *msg;
int shadow = 1;
@@ -268,9 +269,10 @@ pwdb_display_status(const char *username)
goto bail;
}
current = lu_ent_get_first_value_strdup(ent, LU_SHADOWPASSWORD);
+ current_user = lu_ent_get_first_value_strdup(ent, LU_USERPASSWORD);
if (current == NULL) {
shadow = 0;
- current = lu_ent_get_first_value_strdup(ent, LU_USERPASSWORD);
+ current = current_user;
} else {
sp_lstchg = (time_t) ent_value_int64(ent, LU_SHADOWLASTCHANGE);
sp_min = ent_value_int64(ent, LU_SHADOWMIN);
@@ -313,6 +315,13 @@ pwdb_display_status(const char *username)
msg = _("Password set, DES crypt.");
}
if (shadow) {
+ if (status[0] != 'N' && current_user && strlen(current_user) == 0) {
+ fprintf(stderr, "%s: %s\n", progname,
+ _("There is a password information set in /etc/shadow,"
+ " but the password field in /etc/passwd is empty."));
+ msg = _("Empty password.");
+ status = "NP";
+ }
sp_lstchg = sp_lstchg * 24L * 3600L;
localtime_r(&sp_lstchg, &tm);
strftime(date, sizeof(date), "%Y-%m-%d", &tm);
@@ -322,6 +331,9 @@ pwdb_display_status(const char *username)
printf("%s %s (%s)\n", realname, status, msg);
}
g_free(current);
+ if (shadow && current_user) {
+ g_free(current_user);
+ }
} else {
printf(_("No password set.\n"));
}
--
2.33.0

View File

@ -1,14 +1,18 @@
Name: passwd
Version: 0.80
Release: 7
Release: 11
Summary: An implementation of the password setting/changing utility through PAM and libuser libraries
License: BSD or GPL+
URL: https://pagure.io/passwd
Source0: https://releases.pagure.org/passwd/passwd-%{version}.autotoolized.tar.bz2
Patch1: fix-incorrect-S-output.patch
Patch2: update-manpage.patch
Patch9000: add-sm3-crypt-support.patch
BuildRequires:libselinux-devel >= 2.1.6-3 gcc glib2-devel, libuser-devel, pam-devel, libuser >= 0.53-1
BuildRequires: gettext, popt-devel audit-libs-devel >= 2.4.5
Requires:libselinux >= 2.1.6-3 audit >= 2.4.5 pam >= 1.0.90, /etc/pam.d/system-auth
Requires:libselinux >= 2.1.6-3 audit-libs >= 2.4.5 pam >= 1.0.90, /etc/pam.d/system-auth
%description
The package contains an implementation of the password
@ -55,6 +59,30 @@ make check
%{_mandir}/man1/*.gz
%changelog
* Tue Apr 30 2024 liyuzhe <liyuzhe@cqsoftware.com.cn> - 0.80-11
- Type:defect
- ID:NA
- SUG:NA
- DESC:update manpage
* Mon Aug 15 2022 xueyamao <xueyamao@kylinos.cn> - 0.80-10
- Type:defect
- ID:NA
- SUG:NA
- DESC:fix incorrect -S output
* Thu Oct 28 2021 lujie <lujie42@huawei.com> - 0.80-9
- Type:requirement
- ID:NA
- SUG:NA
- DESC:add sm3 crypt support
* Fri Sep 10 2021 Hugel <gengqihu1@huawei.com> - 0.80-8
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:depend on audit-libs instead of audit
* Wed Oct 9 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.80-7
- Type:enhancement
- ID:NA

4
passwd.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: git
src_repo: https://pagure.io/passwd.git
tag_prefix: ^passwd-
seperator: .

50
update-manpage.patch Normal file
View File

@ -0,0 +1,50 @@
diff --git a/man/passwd.1 b/man/passwd.1
index 1bc2a6e..9727b88 100644
--- a/man/passwd.1
+++ b/man/passwd.1
@@ -40,7 +40,7 @@
passwd \- update user's authentication tokens
.SH SYNOPSIS
-.B passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username]
+.B passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [-?] [--usage] [username]
.sp 2
.SH DESCRIPTION
The passwd utility is used to update user's authentication token(s).
@@ -82,7 +82,7 @@ function correctly.
.SH OPTIONS
.TP
-\fB\-k\fR, \fB\-\-keep\fR
+\fB\-k\fR, \fB\-\-keep\-tokens\fR
The option
.B \-k
is used to indicate that the update should only be for expired
@@ -158,8 +158,8 @@ root only.
This will output a short information about the status of the password
for a given account. The status information consists of 7 fields. The
first field is the user's login name. The second field indicates if the
-user account has a locked password (L), has no password (NP), or has a
-usable password (P). The third field gives the date of the last password
+user account has a locked password (LK), has no password (NP), or has a
+usable password (PS). The third field gives the date of the last password
change. The next four fields are the minimum age, maximum age, warning
period, and inactivity period for the password. These ages are expressed
in days.
@@ -174,6 +174,14 @@ from the real date of the last password change by ±1 day.
.sp
This option is available to root only.
+.TP
+\fB\-?\fR, \fB\-\-help\fR
+Print a help message and exit.
+
+.TP
+\fB\-\-usage\fR
+Print a short usage message and exit.
+
.SH "Remember the following two principles"
.IP \fBProtect\ your\ password.\fR