From 9d0c219e8d18ad29ac070f4a5a30f5f13ab951c2 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Mon, 9 Jan 2012 12:11:29 +0000 Subject: Warn if ldap_set_option() fails for LDAP_OPT_ERROR_NUM git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1593 ef36b2f9-881f-0410-afb5-c4e39611909c --- nslcd/myldap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nslcd/myldap.c b/nslcd/myldap.c index 5858f0f..8342c64 100644 --- a/nslcd/myldap.c +++ b/nslcd/myldap.c @@ -779,7 +779,8 @@ static int do_try_search(MYLDAP_SEARCH *search) log_log(LOG_WARNING,"ldap_create_page_control() failed: %s",ldap_err2string(rc)); /* clear error flag */ rc=LDAP_SUCCESS; - ldap_set_option(search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc); + if (ldap_set_option(search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc)!=LDAP_SUCCESS) + log_log(LOG_WARNING,"failed to clear the error flag\n"); pServerCtrls=NULL; } } @@ -1167,7 +1168,8 @@ MYLDAP_ENTRY *myldap_get_entry(MYLDAP_SEARCH *search,int *rcp) ldap_err2string(rc)); /* clear error flag */ rc=LDAP_SUCCESS; - ldap_set_option(search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc); + if (ldap_set_option(search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc)!=LDAP_SUCCESS) + log_log(LOG_WARNING,"failed to clear the error flag\n"); } /* TODO: handle the above return code?? */ ldap_controls_free(resultcontrols); @@ -1433,7 +1435,8 @@ const char **myldap_get_values(MYLDAP_ENTRY *entry,const char *attr) if (rc==LDAP_DECODING_ERROR) { rc=LDAP_SUCCESS; - ldap_set_option(entry->search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc); + if (ldap_set_option(entry->search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc)!=LDAP_SUCCESS) + log_log(LOG_WARNING,"failed to clear the error flag\n"); } else if (rc==LDAP_SUCCESS) { @@ -1542,7 +1545,8 @@ const char **myldap_get_values_len(MYLDAP_ENTRY *entry,const char *attr) if (rc==LDAP_DECODING_ERROR) { rc=LDAP_SUCCESS; - ldap_set_option(entry->search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc); + if (ldap_set_option(entry->search->session->ld,LDAP_OPT_ERROR_NUMBER,&rc)!=LDAP_SUCCESS) + log_log(LOG_WARNING,"failed to clear the error flag\n"); } else if (rc==LDAP_SUCCESS) { -- cgit v1.2.3