/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* 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"
{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")},
{LDAP_RESULTS_TOO_LARGE, N_("Results too large")},
{LDAP_AFFECTS_MULTIPLE_DSAS, N_("Operation affects multiple DSAs")},
- {LDAP_OTHER, N_("Internal (implementation specific) error")},
+ {LDAP_OTHER, N_("Other (e.g., implementation specific) error")},
+
+ {LDAP_CANCELLED, N_("Cancelled")},
+ {LDAP_NO_SUCH_OPERATION, N_("No Operation to Cancel")},
+ {LDAP_TOO_LATE, N_("Too Late to Cancel")},
+ {LDAP_CANNOT_CANCEL, N_("Cannot Cancel")},
+
+ {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)")},
+
+ {LDAP_X_NO_OPERATION, N_("No Operation (X)")},
+
+ {LDAP_CUP_RESOURCES_EXHAUSTED, N_("LCUP Resources Exhausted")},
+ {LDAP_CUP_SECURITY_VIOLATION, N_("LCUP Security Violation")},
+ {LDAP_CUP_INVALID_DATA, N_("LCUP Invalid Data")},
+ {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")},
{LDAP_CLIENT_LOOP, N_("Client Loop")},
{LDAP_REFERRAL_LIMIT_EXCEEDED, N_("Referral Limit Exceeded")},
- {LDAP_SYNC_REFRESH_REQUIRED, N_("Content Sync Refresh Required")},
-
- {LDAP_NO_OPERATION, N_("No Operation")},
- {LDAP_ASSERTION_FAILED, N_("Assertion Failed")},
-
- {LDAP_CUP_RESOURCES_EXHAUSTED, N_("LCUP Resources Exhausted")},
- {LDAP_CUP_SECURITY_VIOLATION, N_("LCUP Security Violation")},
- {LDAP_CUP_INVALID_DATA, N_("LCUP Invalid Data")},
- {LDAP_CUP_UNSUPPORTED_SCHEME, N_("LCUP Unsupported Scheme")},
- {LDAP_CUP_RELOAD_REQUIRED, N_("LCUP Reload Required")},
-
- {LDAP_CANCELLED, N_("Cancelled")},
- {LDAP_NO_SUCH_OPERATION, N_("No Operation to Cancel")},
- {LDAP_TOO_LATE, N_("Too Late to Cancel")},
- {LDAP_CANNOT_CANCEL, N_("Cannot Cancel")},
-
{0, NULL}
};
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
- assert( str );
+ assert( str != NULL );
e = ldap_int_error( ld->ld_errno );
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
#endif
- /* Find the next result... */
- if ( r->lm_chain == NULL ) {
- if ((r->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
- (r->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
- (r->lm_msgtype == LDAP_RES_INTERMEDIATE)) {
- lm = NULL;
- } else {
- lm = r;
- }
- } else {
- if ((r->lm_chain_tail->lm_chain->lm_msgtype
- == LDAP_RES_SEARCH_ENTRY) ||
- (r->lm_chain_tail->lm_chain->lm_msgtype
- == LDAP_RES_SEARCH_REFERENCE) ||
- (r->lm_chain_tail->lm_chain->lm_msgtype
- == LDAP_RES_INTERMEDIATE)) {
+ /* Find the result, last msg in chain... */
+ lm = r->lm_chain_tail;
+ /* 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;
- } else {
- lm = r->lm_chain_tail->lm_chain;
+ break;
+
+ default:
+ break;
}
}
ber = ber_dup( lm->lm_ber );
if ( ld->ld_version < LDAP_VERSION2 ) {
- tag = ber_scanf( ber, "{ia}",
+ tag = ber_scanf( ber, "{iA}",
&ld->ld_errno, &ld->ld_error );
+
} else {
ber_len_t len;
- tag = ber_scanf( ber, "{iaa" /*}*/,
+
+ tag = ber_scanf( ber, "{iAA" /*}*/,
&ld->ld_errno, &ld->ld_matched, &ld->ld_error );
if( tag != LBER_ERROR ) {
}
if ( errcode == LDAP_SUCCESS ) {
if( matcheddnp != NULL ) {
- *matcheddnp = LDAP_STRDUP( ld->ld_matched );
+ if ( ld->ld_matched )
+ {
+ *matcheddnp = LDAP_STRDUP( ld->ld_matched );
+ }
}
if( errmsgp != NULL ) {
- *errmsgp = LDAP_STRDUP( ld->ld_error );
+ if ( ld->ld_error )
+ {
+ *errmsgp = LDAP_STRDUP( ld->ld_error );
+ }
}
if( referralsp != NULL) {
*referralsp = ldap_value_dup( ld->ld_referrals );
}
-
- /* Find the next result... */
- lm = lm->lm_chain;
- if ( lm ) {
- if ( lm->lm_chain == NULL ) {
- if ((lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) &&
- (lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE) &&
- (lm->lm_msgtype != LDAP_RES_INTERMEDIATE)) {
- /* more results to return */
- errcode = LDAP_MORE_RESULTS_TO_RETURN;
- }
- } else {
- if ((lm->lm_chain_tail->lm_chain->lm_msgtype
- != LDAP_RES_SEARCH_ENTRY) &&
- (lm->lm_chain_tail->lm_chain->lm_msgtype
- != LDAP_RES_SEARCH_REFERENCE) &&
- (lm->lm_chain_tail->lm_chain->lm_msgtype
- != LDAP_RES_INTERMEDIATE)) {
- errcode = LDAP_MORE_RESULTS_TO_RETURN;
- }
- }
- }
}
if ( freeit ) {