!84 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:44:13 +00:00 committed by Gitee
commit ed6fda24f9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 5 additions and 53 deletions

View File

@ -1,50 +0,0 @@
From 3bd5a1244a35974c8a0e21a9ac866cb5935f662e Mon Sep 17 00:00:00 2001
From: Hongxun Ren <renhongxun@huawei.com>
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

View File

@ -4,7 +4,7 @@
%define _pamconfdir %{_sysconfdir}/pam.d
Name: pam
Version: 1.4.0
Release: 9
Release: 10
Summary: Pluggable Authentication Modules for Linux
License: BSD and GPLv2+
URL: http://www.linux-pam.org/
@ -33,8 +33,7 @@ Patch6001: backport-add-helper-to-handle-SELinux.patch
Patch6002: zh_CN_po_fix_str_meaning_error.patch
Patch6003: backport-po-update-translations-using-Weblate-Chinese-Simplif.patch
Patch9000: 0001-bugfix-cannot-open-database-file.patch
Patch9001: add-sm3-crypt-support.patch
Patch9000: add-sm3-crypt-support.patch
BuildRequires: autoconf automake libtool bison flex sed cracklib-devel gdbm-devel
BuildRequires: perl-interpreter pkgconfig gettext-devel libtirpc-devel libnsl2-devel
@ -187,6 +186,9 @@ fi
%changelog
* Thu Mar 09 2023 wangyu <wangyu283@huawei.com> - 1.4.0-10
- revert: bugfix with cannot open database file
* Sat Dec 10 2022 wanglimin<wanglimin@xfusion.com> - 1.4.0-9
- update translations for Weblate-Chinese-Simplif