]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/error.c
ITS#5360 move tls option setup
[openldap] / libraries / libldap / error.c
index e7f0867386350b0fc72e86b8c4fd1e13948506a2..250f2b9f1adef00c3b5018396d4b91074dc84fc9 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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"
 
@@ -65,7 +62,6 @@ static struct ldaperror ldap_builtin_errlist[] = {
        {LDAP_IS_LEAF,                                  N_("Entry is a leaf")},
        {LDAP_ALIAS_DEREF_PROBLEM,              N_("Alias dereferencing problem")},
 
-       {LDAP_PROXY_AUTHZ_FAILURE,              N_("Proxy Authorization Failure")},
        {LDAP_INAPPROPRIATE_AUTH,               N_("Inappropriate authentication")},
        {LDAP_INVALID_CREDENTIALS,              N_("Invalid credentials")},
        {LDAP_INSUFFICIENT_ACCESS,              N_("Insufficient access")},
@@ -93,6 +89,9 @@ static struct ldaperror ldap_builtin_errlist[] = {
        {LDAP_ASSERTION_FAILED,                 N_("Assertion Failed")},
        {LDAP_X_ASSERTION_FAILED,               N_("Assertion Failed (X)")},
 
+       {LDAP_PROXIED_AUTHORIZATION_DENIED, N_("Proxied Authorization Denied")},
+       {LDAP_X_PROXY_AUTHZ_FAILURE,            N_("Proxy Authorization Failure (X)")},
+
        {LDAP_SYNC_REFRESH_REQUIRED,    N_("Content Sync Refresh Required")},
        {LDAP_X_SYNC_REFRESH_REQUIRED,  N_("Content Sync Refresh Required (X)")},
 
@@ -104,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")},
@@ -279,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 ) {
@@ -311,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 */
@@ -389,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 );
                        }