From a13e0c393d1deaf71f37b18d1783465040341b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BA=9A=E5=BC=BA?= Date: Wed, 15 Sep 2021 06:25:49 +0000 Subject: [PATCH 1/2] add 0001-bugfix-cannot-open-database-file.patch. --- 0001-bugfix-cannot-open-database-file.patch | 49 +++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 0001-bugfix-cannot-open-database-file.patch diff --git a/0001-bugfix-cannot-open-database-file.patch b/0001-bugfix-cannot-open-database-file.patch new file mode 100644 index 0000000..33527bf --- /dev/null +++ b/0001-bugfix-cannot-open-database-file.patch @@ -0,0 +1,49 @@ +From 3bd5a1244a35974c8a0e21a9ac866cb5935f662e Mon Sep 17 00:00:00 2001 +From: yaqiang chen +Date: Wed, 15 Sep 2021 10:05:49 +0800 +Subject: [PATCH] bugfix cannot open database file + +--- + modules/pam_userdb/pam_userdb.c | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/modules/pam_userdb/pam_userdb.c b/modules/pam_userdb/pam_userdb.c +index dc2ca23..a9992a7 100644 +--- a/modules/pam_userdb/pam_userdb.c ++++ b/modules/pam_userdb/pam_userdb.c +@@ -147,13 +147,30 @@ user_lookup (pam_handle_t *pamh, const char *database, const char *cryptmode, + { + DBM *dbm; + datum key, data; ++ int retval; + ++ /* Init the DB file. */ ++ retval = dbminit(database); ++ if (retval) { ++ pam_syslog(pamh, LOG_ERR, ++ "user_lookup: could not init database `%s': %m", database); ++ return -2; ++ } + /* Open the DB file. */ + dbm = dbm_open(database, O_RDONLY, 0644); + if (dbm == NULL) { +- pam_syslog(pamh, LOG_ERR, +- "user_lookup: could not open database `%s': %m", database); +- return -2; ++ retval = dbminit(database); ++ if (retval){ ++ pam_syslog(pamh, LOG_ERR, ++ "user_lookup: could not re-init database `%s': %m", database); ++ } else { ++ dbm = dbm_open(database, O_RDONLY, 0644); ++ if(dbm == NULL) { ++ pam_syslog(pamh, LOG_ERR, ++ "user_lookup: could not open database `%s': %m", database); ++ return -2; ++ } ++ } + } + + /* dump out the database contents for debugging */ +-- +1.8.3.1 \ No newline at end of file -- Gitee From 4069e8fe61cb5b34e62e6b06c9e155f5f92defb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BA=9A=E5=BC=BA?= Date: Wed, 15 Sep 2021 06:27:41 +0000 Subject: [PATCH 2/2] update pam.spec. --- pam.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pam.spec b/pam.spec index ed960ac..36b36cc 100644 --- a/pam.spec +++ b/pam.spec @@ -4,7 +4,7 @@ %define _pamconfdir %{_sysconfdir}/pam.d Name: pam Version: 1.5.1 -Release: 3 +Release: 4 Summary: Pluggable Authentication Modules for Linux License: BSD and GPLv2+ URL: http://www.linux-pam.org/ @@ -22,6 +22,7 @@ Patch0: bugfix-pam-1.1.8-faillock-failmessages.patch Patch1: bugfix-pam-1.1.8-faillock-systemtime.patch Patch2: fix-login-message.patch Patch9000:openEuler-change-ndbm-to-gdbm.patch +Patch9001:0001-bugfix-cannot-open-database-file.patch BuildRequires: autoconf automake libtool bison flex sed cracklib-devel gdbm-devel BuildRequires: perl-interpreter pkgconfig gettext-devel libtirpc-devel libnsl2-devel @@ -169,6 +170,9 @@ fi %changelog +* Wed Sep 15 2021 chenyaqiang - 1.5.1-4 +- bugfix with cannot open database file + * Thu Jul 15 2021 shixuantong - 1.5.1-3 - remove unnecessary dependency packages from the spec file -- Gitee