You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bn...@apache.org on 2005/02/01 19:07:05 UTC

svn commit: r149426 - apr/apr-util/trunk/ldap/apr_ldap_init.c

Author: bnicholes
Date: Tue Feb  1 10:07:01 2005
New Revision: 149426

URL: http://svn.apache.org/viewcvs?view=rev&rev=149426
Log:
Make sure that we return some type of LDAP error if the initialization fails so that the caller doesn't look at the LDAP result structure and think that everything is OK

Modified:
    apr/apr-util/trunk/ldap/apr_ldap_init.c

Modified: apr/apr-util/trunk/ldap/apr_ldap_init.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/ldap/apr_ldap_init.c?view=diff&r1=149425&r2=149426
==============================================================================
--- apr/apr-util/trunk/ldap/apr_ldap_init.c (original)
+++ apr/apr-util/trunk/ldap/apr_ldap_init.c Tue Feb  1 10:07:01 2005
@@ -80,7 +80,7 @@
 #endif /* APR_HAS_LDAP_SSL */
 
     if (result->rc != -1) {
-        result->msg = ldap_err2string(result-> rc);
+        result->msg = ldap_err2string(result->rc);
     }
 
     if (LDAP_SUCCESS != result->rc) {
@@ -153,7 +153,13 @@
         return apr_ldap_set_option(pool, *ldap, APR_LDAP_OPT_TLS, &secure, result_err);
     }
     else {
-        return apr_get_os_error();
+        /* handle the error case */
+        apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t));
+        *result_err = result;
+
+        result->reason = "APR LDAP: Unable to initialize the LDAP connection";
+        result->rc = -1;
+        return APR_EGENERAL;
     }
 
 }