!82 revert: bugfix with cannot open database file

From: @BornThisWay 
Reviewed-by: @houmingyong 
Signed-off-by: @houmingyong
This commit is contained in:
openeuler-ci-bot 2023-03-21 11:45:55 +00:00 committed by Gitee
commit 47b8ad17ce
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 48 deletions

View File

@ -1,44 +0,0 @@
From 3bd5a1244a35974c8a0e21a9ac866cb5935f662e Mon Sep 17 00:00:00 2001
From: yaqiang chen <chenyaqiang@huawei.com>
Date: Wed, 15 Sep 2021 10:05:49 +0800
Subject: [PATCH] bugfix cannot open database file
---
modules/pam_userdb/pam_userdb.c | 17 ++++++++++++++---
1 file changed, 14 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,24 @@ user_lookup (pam_handle_t *pamh, const char *database, const char *cryptmode,
{
DBM *dbm;
datum key, data;
+ int retval;
/* 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 init database `%s': %m", database);
+ return -2;
+ } 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

View File

@ -4,7 +4,7 @@
%define _pamconfdir %{_sysconfdir}/pam.d %define _pamconfdir %{_sysconfdir}/pam.d
Name: pam Name: pam
Version: 1.5.2 Version: 1.5.2
Release: 4 Release: 6
Summary: Pluggable Authentication Modules for Linux Summary: Pluggable Authentication Modules for Linux
License: BSD and GPLv2+ License: BSD and GPLv2+
URL: http://www.linux-pam.org/ URL: http://www.linux-pam.org/
@ -22,9 +22,8 @@ Provides: %{name}-sm3 = %{version}-%{release}
Patch1: bugfix-pam-1.1.8-faillock-systemtime.patch Patch1: bugfix-pam-1.1.8-faillock-systemtime.patch
Patch9000:change-ndbm-to-gdbm.patch Patch9000:change-ndbm-to-gdbm.patch
Patch9001:0001-bugfix-cannot-open-database-file.patch Patch9001:add-sm3-crypt-support.patch
Patch9002:add-sm3-crypt-support.patch Patch9002:1003-Change-chinese-translation.patch
Patch9003:1003-Change-chinese-translation.patch
BuildRequires: autoconf automake libtool bison flex sed cracklib-devel gdbm-devel BuildRequires: autoconf automake libtool bison flex sed cracklib-devel gdbm-devel
BuildRequires: perl-interpreter pkgconfig gettext-devel libtirpc-devel libnsl2-devel BuildRequires: perl-interpreter pkgconfig gettext-devel libtirpc-devel libnsl2-devel
@ -179,6 +178,9 @@ fi
%changelog %changelog
* Thu Mar 09 2023 wangyu <wangyu283@huawei.com> - 1.5.2-6
- revert: bugfix with cannot open database file
* Mon Dec 12 2022 dongyuzhen <dongyuzhen@h-partners.com> - 1.5.2-4 * Mon Dec 12 2022 dongyuzhen <dongyuzhen@h-partners.com> - 1.5.2-4
- Change Chinese translation - Change Chinese translation