]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/error.c
ITS#4726 call ldap_pvt_tls_init() in init_ctx() to make sure initialization
[openldap] / libraries / libldap / error.c
index b102d4ab77e376e599cd2ec07c52dca94d2c79f9..59200249037b1a65c7990159f006b9611d0dfc4d 100644 (file)
@@ -12,9 +12,6 @@
  * top-level directory of the distribution or, alternatively, at
  * <http://www.OpenLDAP.org/license.html>.
  */
-/* Portions Copyright (C) The Internet Society (1997)
- * ASN.1 fragments are from RFC 2251; see RFC for full legal notices.
- */
 
 #include "portable.h"
 
@@ -106,6 +103,10 @@ static struct ldaperror ldap_builtin_errlist[] = {
        {LDAP_CUP_UNSUPPORTED_SCHEME,   N_("LCUP Unsupported Scheme")},
        {LDAP_CUP_RELOAD_REQUIRED,              N_("LCUP Reload Required")},
 
+#ifdef LDAP_X_TXN
+       {LDAP_X_TXN_SPECIFY_OKAY,               N_("TXN specify okay")},
+       {LDAP_X_TXN_ID_INVALID,                 N_("TXN ID is invalid")},
+#endif
 
        /* API ResultCodes */
        {LDAP_SERVER_DOWN,                              N_("Can't contact LDAP server")},
@@ -281,10 +282,19 @@ ldap_parse_result(
 #endif
        /* Find the result, last msg in chain... */
        lm = r->lm_chain_tail;
-       if ((lm->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
-               (lm->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
-               (lm->lm_msgtype == LDAP_RES_INTERMEDIATE)) {
-               lm = NULL;      
+       /* FIXME: either this is not possible (assert?)
+        * or it should be handled */
+       if ( lm != NULL ) {
+               switch ( lm->lm_msgtype ) {
+               case LDAP_RES_SEARCH_ENTRY:
+               case LDAP_RES_SEARCH_REFERENCE:
+               case LDAP_RES_INTERMEDIATE:
+                       lm = NULL;
+                       break;
+
+               default:
+                       break;
+               }
        }
 
        if( lm == NULL ) {
@@ -313,24 +323,14 @@ ldap_parse_result(
        ber = ber_dup( lm->lm_ber );
 
        if ( ld->ld_version < LDAP_VERSION2 ) {
-#ifdef LDAP_NULL_IS_NULL
                tag = ber_scanf( ber, "{iA}",
                        &ld->ld_errno, &ld->ld_error );
-#else /* ! LDAP_NULL_IS_NULL */
-               tag = ber_scanf( ber, "{ia}",
-                       &ld->ld_errno, &ld->ld_error );
-#endif /* ! LDAP_NULL_IS_NULL */
 
        } else {
                ber_len_t len;
 
-#ifdef LDAP_NULL_IS_NULL
                tag = ber_scanf( ber, "{iAA" /*}*/,
                        &ld->ld_errno, &ld->ld_matched, &ld->ld_error );
-#else /* ! LDAP_NULL_IS_NULL */
-               tag = ber_scanf( ber, "{iaa" /*}*/,
-                       &ld->ld_errno, &ld->ld_matched, &ld->ld_error );
-#endif /* ! LDAP_NULL_IS_NULL */
 
                if( tag != LBER_ERROR ) {
                        /* peek for referrals */
@@ -391,17 +391,13 @@ ldap_parse_result(
        }
        if ( errcode == LDAP_SUCCESS ) {
                if( matcheddnp != NULL ) {
-#ifdef LDAP_NULL_IS_NULL
                        if ( ld->ld_matched )
-#endif /* LDAP_NULL_IS_NULL */
                        {
                                *matcheddnp = LDAP_STRDUP( ld->ld_matched );
                        }
                }
                if( errmsgp != NULL ) {
-#ifdef LDAP_NULL_IS_NULL
                        if ( ld->ld_error )
-#endif /* LDAP_NULL_IS_NULL */
                        {
                                *errmsgp = LDAP_STRDUP( ld->ld_error );
                        }