From 09b6e2dfe64a101cbe1cd2392eb9be862842858f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 5 Nov 2019 12:04:20 +0100 Subject: [PATCH] Fix checking for the LDAP failures in the warnquota tool --- ...arnquota-Properly-detect-LDAP-errors.patch | 42 +++++++++++++++++++ quota.spec | 5 +++ 2 files changed, 47 insertions(+) create mode 100644 quota-4.05-warnquota-Properly-detect-LDAP-errors.patch diff --git a/quota-4.05-warnquota-Properly-detect-LDAP-errors.patch b/quota-4.05-warnquota-Properly-detect-LDAP-errors.patch new file mode 100644 index 0000000..9ec11f7 --- /dev/null +++ b/quota-4.05-warnquota-Properly-detect-LDAP-errors.patch @@ -0,0 +1,42 @@ +From 3615f3ec7dd3c867a8394640c0fc4736189315df Mon Sep 17 00:00:00 2001 +From: Jan Kara +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 +Signed-off-by: Petr Písař +--- + 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 + diff --git a/quota.spec b/quota.spec index f964b6e..995728a 100644 --- a/quota.spec +++ b/quota.spec @@ -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 - 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 - 1:4.05-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild