diff --git a/0001-PATCH-lsof-fix-incorrect-S-output.patch b/0001-PATCH-lsof-fix-incorrect-S-output.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c48616de04516bcd9f4f3ef745831ec4952c71d --- /dev/null +++ b/0001-PATCH-lsof-fix-incorrect-S-output.patch @@ -0,0 +1,60 @@ +From ff60631b73e48ab28fc984cd8f8206d18e369b82 Mon Sep 17 00:00:00 2001 +From: Jiri Kucera +Date: Dec 03 2019 13:41:36 +0000 +Subject: 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. + +--- + +diff --git a/libuser.c b/libuser.c +index 7a36520..06c6200 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); +@@ -310,6 +312,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); +@@ -319,6 +328,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")); + } + diff --git a/passwd.spec b/passwd.spec index 7b8e109f33e40c5d82d66bf28d0e1b7384ad2603..b3921a92aecea602e1a79d378495dffc0f41b627 100644 --- a/passwd.spec +++ b/passwd.spec @@ -1,4 +1,4 @@ -%define anolis_release 3 +%define anolis_release 4 Name: passwd Version: 0.80 @@ -9,6 +9,8 @@ License: BSD or GPL+ URL: https://pagure.io/passwd Source0: https://releases.pagure.org/passwd/passwd-%{version}.autotoolized.tar.bz2 +Patch0: 0001-PATCH-lsof-fix-incorrect-S-output.patch + BuildRequires: m4 BuildRequires: gcc BuildRequires: autoconf @@ -57,6 +59,9 @@ install -m 644 passwd.pamd -D %{buildroot}%{_sysconfdir}/pam.d/passwd %doc AUTHORS ChangeLog NEWS %changelog +* Thu Dec 15 2022 Guyu Wang - 0.80-4 +- add patch + * Sat Oct 08 2022 mgb01105731 - 0.80-3 - add doc package