Compare commits
10 Commits
592ff624f8
...
55ae8b52fb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55ae8b52fb | ||
|
|
07cb0f0455 | ||
|
|
ae12ae379d | ||
|
|
d445a991da | ||
|
|
852f752d43 | ||
|
|
2717ef9340 | ||
|
|
0c693589db | ||
|
|
14ac7b1a9e | ||
|
|
cf3362e57e | ||
|
|
0fc5d3106b |
27
add-sm3-crypt-support.patch
Normal file
27
add-sm3-crypt-support.patch
Normal 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
|
||||
|
||||
65
fix-incorrect-S-output.patch
Normal file
65
fix-incorrect-S-output.patch
Normal 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
|
||||
|
||||
32
passwd.spec
32
passwd.spec
@ -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
4
passwd.yaml
Normal 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
50
update-manpage.patch
Normal 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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user