mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
better error handling when returning results
This commit is contained in:
parent
84fe0ad051
commit
c4a8a3dce5
@ -48,7 +48,7 @@
|
||||
#undef ldap_debug /* silence a warning in ldap-int.h */
|
||||
#include "../../../libraries/libldap/ldap-int.h"
|
||||
|
||||
static void ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
|
||||
static int ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
|
||||
LDAPMessage *e, AttributeName *attrs, int attrsonly );
|
||||
|
||||
int
|
||||
@ -272,8 +272,9 @@ fail:;
|
||||
ldap_pvt_thread_yield();
|
||||
} else if (rc == LDAP_RES_SEARCH_ENTRY) {
|
||||
e = ldap_first_entry(lc->ld,res);
|
||||
ldap_send_entry(be, op, lc, e, attrs, attrsonly);
|
||||
count++;
|
||||
if ( ldap_send_entry(be, op, lc, e, attrs, attrsonly) == LDAP_SUCCESS ) {
|
||||
count++;
|
||||
}
|
||||
ldap_msgfree(res);
|
||||
} else {
|
||||
sres = ldap_result2error(lc->ld, res, 1);
|
||||
@ -353,7 +354,7 @@ finish:;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
ldap_send_entry(
|
||||
Backend *be,
|
||||
Operation *op,
|
||||
@ -373,7 +374,7 @@ ldap_send_entry(
|
||||
const char *text;
|
||||
|
||||
if ( ber_scanf( &ber, "{m{", &bdn ) == LBER_ERROR ) {
|
||||
return;
|
||||
return LDAP_DECODING_ERROR;
|
||||
}
|
||||
#ifdef ENABLE_REWRITE
|
||||
|
||||
@ -400,7 +401,7 @@ ldap_send_entry(
|
||||
|
||||
case REWRITE_REGEXEC_ERR:
|
||||
case REWRITE_REGEXEC_UNWILLING:
|
||||
return;
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
#else /* !ENABLE_REWRITE */
|
||||
ldap_back_dn_massage( li, &bdn, &ent.e_name, 0, 0 );
|
||||
@ -414,7 +415,7 @@ ldap_send_entry(
|
||||
* FIXME: should we log anything, or delegate to dnNormalize2?
|
||||
*/
|
||||
if ( dnNormalize2( NULL, &ent.e_name, &ent.e_nname ) != LDAP_SUCCESS ) {
|
||||
return;
|
||||
return LDAP_INVALID_DN_SYNTAX;
|
||||
}
|
||||
|
||||
ent.e_id = 0;
|
||||
@ -560,4 +561,6 @@ ldap_send_entry(
|
||||
free( ent.e_dn );
|
||||
if ( ent.e_ndn )
|
||||
free( ent.e_ndn );
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@
|
||||
#include "ldap_log.h"
|
||||
#include "../../../libraries/libldap/ldap-int.h"
|
||||
|
||||
static void
|
||||
static int
|
||||
meta_send_entry(
|
||||
Backend *be,
|
||||
Operation *op,
|
||||
@ -445,9 +445,10 @@ meta_back_search(
|
||||
goto finish;
|
||||
} else if ( rc == LDAP_RES_SEARCH_ENTRY ) {
|
||||
e = ldap_first_entry( lsc->ld, res );
|
||||
meta_send_entry(be, op, lc, i, e, attrs,
|
||||
attrsonly);
|
||||
count++;
|
||||
if ( meta_send_entry( be, op, lc, i, e, attrs,
|
||||
attrsonly ) == LDAP_SUCCESS ) {
|
||||
count++;
|
||||
}
|
||||
ldap_msgfree( res );
|
||||
gotit = 1;
|
||||
} else {
|
||||
@ -569,7 +570,7 @@ finish:;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
meta_send_entry(
|
||||
Backend *be,
|
||||
Operation *op,
|
||||
@ -590,7 +591,7 @@ meta_send_entry(
|
||||
const char *text;
|
||||
|
||||
if ( ber_scanf( &ber, "{m{", &bdn ) == LBER_ERROR ) {
|
||||
return;
|
||||
return LDAP_DECODING_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -617,7 +618,7 @@ meta_send_entry(
|
||||
|
||||
case REWRITE_REGEXEC_ERR:
|
||||
case REWRITE_REGEXEC_UNWILLING:
|
||||
return;
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -628,7 +629,7 @@ meta_send_entry(
|
||||
* FIXME: should we log anything, or delegate to dnNormalize2?
|
||||
*/
|
||||
if ( dnNormalize2( NULL, &ent.e_name, &ent.e_nname ) != LDAP_SUCCESS ) {
|
||||
return;
|
||||
return LDAP_INVALID_DN_SYNTAX;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -782,6 +783,8 @@ meta_send_entry(
|
||||
if ( ent.e_ndn ) {
|
||||
free( ent.e_ndn );
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user