summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-09-05 16:29:08 +0200
committerJan Kara <jack@suse.cz>2019-09-08 20:48:23 +0200
commit3615f3ec7dd3c867a8394640c0fc4736189315df (patch)
tree5ecf4a915743b3a2f155bfa952223eab6ff4d8a8
parent6e631074330aa6ea210b05dae3a2dcf5223b311f (diff)
downloadlinuxquota-3615f3ec7dd3c867a8394640c0fc4736189315df.tar.gz
warnquota: Properly detect LDAP errors
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>
-rw-r--r--warnquota.c4
1 files 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;