From: Eric Covener Date: Tue, 1 Jan 2008 13:53:03 +0000 (+0000) Subject: Review comments from Ruediger on r607766: X-Git-Tag: 2.3.0~1068 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5df5e051d88bfe0cb1a2ddc3a77ed0cc80006784;p=apache Review comments from Ruediger on r607766: Don't allow the ldap calls to be evaluated (twice) in the macro git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@607841 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index ed5d6595f3..04cc1e4db6 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -733,9 +733,10 @@ start_over: } /* search for reqdn */ - if (AP_LDAP_IS_SERVER_DOWN(result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE, - "(objectclass=*)", NULL, 1, - NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res))) + result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE, + "(objectclass=*)", NULL, 1, + NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res); + if (AP_LDAP_IS_SERVER_DOWN(result)) { ldc->reason = "DN Comparison ldap_search_ext_s() " "failed with server down"; @@ -872,10 +873,11 @@ start_over: return result; } - if (AP_LDAP_IS_SERVER_DOWN(result = ldap_compare_s(ldc->ldap, - (char *)dn, - (char *)attrib, - (char *)value))) { + result = ldap_compare_s(ldc->ldap, + (char *)dn, + (char *)attrib, + (char *)value); + if (AP_LDAP_IS_SERVER_DOWN(result)) { /* connection failed - try again */ ldc->reason = "ldap_compare_s() failed with server down"; uldap_connection_unbind(ldc); @@ -1441,10 +1443,11 @@ start_over: } /* try do the search */ - if (AP_LDAP_IS_SERVER_DOWN(result = ldap_search_ext_s(ldc->ldap, - (char *)basedn, scope, - (char *)filter, attrs, 0, - NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res))) + result = ldap_search_ext_s(ldc->ldap, + (char *)basedn, scope, + (char *)filter, attrs, 0, + NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res); + if (AP_LDAP_IS_SERVER_DOWN(result)) { ldc->reason = "ldap_search_ext_s() for user failed with server down"; uldap_connection_unbind(ldc); @@ -1498,9 +1501,10 @@ start_over: * fails, it means that the password is wrong (the dn obviously * exists, since we just retrieved it) */ - if (AP_LDAP_IS_SERVER_DOWN(result = ldap_simple_bind_s(ldc->ldap, - (char *)*binddn, - (char *)bindpw))) { + result = ldap_simple_bind_s(ldc->ldap, + (char *)*binddn, + (char *)bindpw); + if (AP_LDAP_IS_SERVER_DOWN(result)) { ldc->reason = "ldap_simple_bind_s() to check user credentials " "failed with server down"; ldap_msgfree(res); @@ -1689,10 +1693,11 @@ start_over: } /* try do the search */ - if (AP_LDAP_IS_SERVER_DOWN(result = ldap_search_ext_s(ldc->ldap, - (char *)basedn, scope, - (char *)filter, attrs, 0, - NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res))) + result = ldap_search_ext_s(ldc->ldap, + (char *)basedn, scope, + (char *)filter, attrs, 0, + NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res); + if (AP_LDAP_IS_SERVER_DOWN(result)) { ldc->reason = "ldap_search_ext_s() for user failed with server down"; uldap_connection_unbind(ldc);