Fix checking for the LDAP failures in the warnquota tool

This commit is contained in:
Petr Písař 2019-11-05 12:04:20 +01:00
parent 8cf703609d
commit 09b6e2dfe6
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,42 @@
From 3615f3ec7dd3c867a8394640c0fc4736189315df Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 5 Sep 2019 16:29:08 +0200
Subject: [PATCH] warnquota: Properly detect LDAP errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
ldap_search_ext_s() and ldap_sasl_bind_s() can return also positive
error result codes. Catch them properly.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 53da671..24d7410 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -201,7 +201,7 @@ static int setup_ldap(struct configparams *config)
}
}
ret = ldap_sasl_bind_s(ldapconn, config->ldap_binddn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
- if(ret < 0) {
+ if (ret != LDAP_SUCCESS) {
errstr(_("ldap_sasl_bind_s() failed: %s\n"), ldap_err2string(ret));
return -1;
}
@@ -426,7 +426,7 @@ static char *lookup_user(struct configparams *config, char *user)
searchbuf, NULL, 0, NULL, NULL, NULL,
0, &result);
- if (ret < 0) {
+ if (ret != LDAP_SUCCESS) {
errstr(_("Error with %s.\n"), user);
errstr(_("ldap_search_ext_s() failed: %s\n"), ldap_err2string(ret));
return NULL;
--
2.21.0

View File

@ -85,6 +85,9 @@ Patch10: quota-4.05-Make-a-directory-for-quota_nld-PID-file-configurable.patch
Patch11: quota-4.05-quotacheck-Skip-checking-of-filesystems-with-hidded-.patch
# Fix warnquota --help output, in upstream after 4.05
Patch12: quota-4.05-warnquota-Fix-help-text.patch
# Fix checking for the LDAP failures in the warnquota tool,
# in upstream after 4.05
Patch13: quota-4.05-warnquota-Properly-detect-LDAP-errors.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bash
@ -217,6 +220,7 @@ Linux/UNIX environment.
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
# Regenerate build scripts
autoreconf -f -i
@ -369,6 +373,7 @@ make check
* Tue Nov 05 2019 Petr Pisar <ppisar@redhat.com> - 1:4.05-6
- Optimize out useless checking of file systems with hidden quota files
- Fix warnquota --help output
- Fix checking for the LDAP failures in the warnquota tool
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.05-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild