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 f5e9123..29c17f8 100644 --- a/quota.spec +++ b/quota.spec @@ -96,6 +96,9 @@ Patch15: quota-4.04-xqmstats-Fix-a-file-descriptor-leak-in-main.patch Patch16: quota-4.04-Fix-warnquota-Cc-field-being-set-incorrectly-when-us.patch # Fix warnquota --help output, in upstream after 4.05 Patch17: quota-4.05-warnquota-Fix-help-text.patch +# Fix checking for the LDAP failures in the warnquota tool, +# in upstream after 4.05 +Patch18: quota-4.05-warnquota-Properly-detect-LDAP-errors.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -227,6 +230,7 @@ Linux/UNIX environment. %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 # Regenerate build scripts autoreconf -f -i @@ -373,6 +377,7 @@ make check %changelog * Tue Nov 05 2019 Petr Pisar - 1:4.04-13 - Fix warnquota --help output +- Fix checking for the LDAP failures in the warnquota tool * Tue Apr 02 2019 Petr Pisar - 1:4.04-12 - Fix warnquota CC field when using LDAP