diff options
author | Eric Covener <covener@apache.org> | 2007-12-31 20:20:25 +0100 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2007-12-31 20:20:25 +0100 |
commit | 7c9503a556b7d64fe69583a288e2c1b288c8a742 (patch) | |
tree | 72c4eaf6de9aac2d160f7df23171c0f6f752184c /modules/ldap | |
parent | updated NetWare OpenSSL build section. (diff) | |
download | apache2-7c9503a556b7d64fe69583a288e2c1b288c8a742.tar.xz apache2-7c9503a556b7d64fe69583a288e2c1b288c8a742.zip |
When using the MS SDK, re-establish LDAP backend connections on a
return code of LDAP_UNAVAILABLE as if it were LDAP_SERVER_DOWN.
With this SDK, LDAP_UNAVAIALBLE is returned when the socket had been closed
between LDAP API calls.
PR 39095
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@607766 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/ldap')
-rw-r--r-- | modules/ldap/util_ldap.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index ca5c6ffeb6..ed5d6595f3 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -430,7 +430,7 @@ static int uldap_connection_open(request_rec *r, rc = ldap_simple_bind_s(ldc->ldap, (char *)ldc->binddn, (char *)ldc->bindpw); - if (LDAP_SERVER_DOWN != rc) { + if (!AP_LDAP_IS_SERVER_DOWN(rc)) { break; } else if (failures == 5) { /* attempt to init the connection once again */ @@ -733,10 +733,9 @@ start_over: } /* search for reqdn */ - if ((result = ldap_search_ext_s(ldc->ldap, (char *)reqdn, LDAP_SCOPE_BASE, + 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)) - == LDAP_SERVER_DOWN) + NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res))) { ldc->reason = "DN Comparison ldap_search_ext_s() " "failed with server down"; @@ -873,11 +872,10 @@ start_over: return result; } - if ((result = ldap_compare_s(ldc->ldap, + if (AP_LDAP_IS_SERVER_DOWN(result = ldap_compare_s(ldc->ldap, (char *)dn, (char *)attrib, - (char *)value)) - == LDAP_SERVER_DOWN) { + (char *)value))) { /* connection failed - try again */ ldc->reason = "ldap_compare_s() failed with server down"; uldap_connection_unbind(ldc); @@ -977,7 +975,7 @@ start_over: result = ldap_search_ext_s(ldc->ldap, (char *)dn, LDAP_SCOPE_BASE, (char *)"cn=*", subgroupAttrs, 0, NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &sga_res); - if (result == LDAP_SERVER_DOWN) { + if (AP_LDAP_IS_SERVER_DOWN(result)) { ldc->reason = "ldap_search_ext_s() for subgroups failed with server" " down"; uldap_connection_unbind(ldc); @@ -1443,11 +1441,10 @@ start_over: } /* try do the search */ - if ((result = ldap_search_ext_s(ldc->ldap, + 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)) - == LDAP_SERVER_DOWN) + NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res))) { ldc->reason = "ldap_search_ext_s() for user failed with server down"; uldap_connection_unbind(ldc); @@ -1501,9 +1498,9 @@ start_over: * fails, it means that the password is wrong (the dn obviously * exists, since we just retrieved it) */ - if ((result = ldap_simple_bind_s(ldc->ldap, + if (AP_LDAP_IS_SERVER_DOWN(result = ldap_simple_bind_s(ldc->ldap, (char *)*binddn, - (char *)bindpw)) == LDAP_SERVER_DOWN) { + (char *)bindpw))) { ldc->reason = "ldap_simple_bind_s() to check user credentials " "failed with server down"; ldap_msgfree(res); @@ -1692,11 +1689,10 @@ start_over: } /* try do the search */ - if ((result = ldap_search_ext_s(ldc->ldap, + 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)) - == LDAP_SERVER_DOWN) + NULL, NULL, NULL, APR_LDAP_SIZELIMIT, &res))) { ldc->reason = "ldap_search_ext_s() for user failed with server down"; uldap_connection_unbind(ldc); |