&rc, &text, LDAP_SCHEMA_ALLOW_ALL );
if ( !at ) {
Debug( LDAP_DEBUG_ANY,
- "%s AttributeType load failed: %s %s\n",
+ "aci_init: AttributeType \"%s\" parse failed: %s %s\n",
aci_at.name, ldap_scherr2str( rc ), text );
return rc;
}
rc = at_add( at, 0, &sat, &text );
if ( rc != LDAP_SUCCESS ) {
ldap_attributetype_free( at );
- fprintf( stderr, "iMUX_monitor_schema_init: "
- "AttributeType load failed: %s %s\n",
- scherr2str( rc ), text );
+ Debug( LDAP_DEBUG_ANY,
+ "aci_init: AttributeType \"%s\" load failed: %s %s\n",
+ aci_at.name, scherr2str( rc ), text );
return rc;
}
ldap_memfree( at );
aci_at.ad, &text );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
- "unable to find AttributeDescription "
+ "aci_init: unable to find AttributeDescription "
"\"%s\": %d (%s)\n",
aci_at.name, rc, text );
return 1;
int pos )
{
int i;
- char *left, *right, *style, *next;
+ char *left, *right, *style;
struct berval bv;
AccessControl *a;
Access *b;
} else if ( strcasecmp( style, "level" ) == 0 )
{
- char *next;
-
if ( lutil_atoi( &level, style_level ) != 0 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: unable to parse level "
if (e) {
/* safe default */
- int result = -1;
rs->sr_attrs = op->oq_search.rs_attrs;
rs->sr_operational_attrs = NULL;
rs->sr_ctrls = NULL;
rs->sr_flags = 0;
rs->sr_err = LDAP_SUCCESS;
- result = send_search_entry( op, rs );
+ rs->sr_err = send_search_entry( op, rs );
- switch ( result ) {
- case 0: /* entry sent ok */
+ switch ( rs->sr_err ) {
+ case LDAP_SUCCESS: /* entry sent ok */
break;
- case 1: /* entry not sent */
+ default: /* entry not sent */
break;
- default:
+ case LDAP_UNAVAILABLE:
+ case LDAP_SIZELIMIT_EXCEEDED:
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
&bdb->bi_cache, e, &lock);
e = NULL;
rs->sr_entry = NULL;
- switch ( result ) {
- case SLAPD_SEND_SIZELIMIT:
- rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+ if ( rs->sr_err == LDAP_SIZELIMIT_EXCEEDED ) {
rs->sr_ref = rs->sr_v2ref;
send_ldap_result( op, rs );
rs->sr_err = LDAP_SUCCESS;
- break;
- case -1: /* connection closed */
+
+ } else {
rs->sr_err = LDAP_OTHER;
- break;
}
goto done;
}
} else if ( rc == LDAP_RES_SEARCH_ENTRY ) {
Entry ent = { 0 };
struct berval bdn = BER_BVNULL;
- int abort = 0;
do_retry = 0;
rs->sr_attrs = op->ors_attrs;
rs->sr_operational_attrs = NULL;
rs->sr_flags = 0;
- abort = send_search_entry( op, rs );
+ rc = rs->sr_err = send_search_entry( op, rs );
if ( !BER_BVISNULL( &ent.e_name ) ) {
assert( ent.e_name.bv_val != bdn.bv_val );
free( ent.e_name.bv_val );
entry_clean( &ent );
}
ldap_msgfree( res );
- if ( abort ) {
- if ( abort == SLAPD_SEND_SIZELIMIT ) {
- rc = rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+ if ( rc != LDAP_SUCCESS ) {
+ if ( rc == LDAP_UNAVAILABLE ) {
+ rc = rs->sr_err = LDAP_OTHER;
+ } else {
+ ldap_abandon_ext( lc->lc_ld, msgid, NULL, NULL );
}
- ldap_abandon_ext( lc->lc_ld, msgid, NULL, NULL );
goto finish;
}
if ( scopeok ) {
if (e) {
rs->sr_flags = 0;
- result = send_search_entry( op, rs );
-
- switch ( result ) {
- case 0: /* entry sent ok */
- break;
- case 1: /* entry not sent */
- break;
- case -1: /* connection closed */
+ rs->sr_err = send_search_entry( op, rs );
+
+ switch ( rs->sr_err ) {
+ case LDAP_UNAVAILABLE: /* connection closed */
cache_return_entry_r( &li->li_cache, e );
rc = LDAP_SUCCESS;
goto done;
- case SLAPD_SEND_SIZELIMIT:
+ case LDAP_SIZELIMIT_EXCEEDED:
cache_return_entry_r( &li->li_cache, e );
- rc = rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+ rc = rs->sr_err;
rs->sr_entry = NULL;
send_ldap_result( op, rs );
rc = LDAP_SUCCESS;
e = ldap_first_entry( msc->msc_ld, res );
savepriv = op->o_private;
op->o_private = (void *)i;
- rc = meta_send_entry( op, rs, mc, i, e );
+ rs->sr_err = meta_send_entry( op, rs, mc, i, e );
ldap_msgfree( res );
res = NULL;
switch ( rc ) {
- case SLAPD_SEND_SIZELIMIT:
- rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+ case LDAP_SIZELIMIT_EXCEEDED:
savepriv = op->o_private;
op->o_private = (void *)i;
send_ldap_result( op, rs );
op->o_private = savepriv;
+ rs->sr_err = LDAP_SUCCESS;
goto finish;
- case -1:
+ case LDAP_UNAVAILABLE:
rs->sr_err = LDAP_OTHER;
goto finish;
}
rs->sr_entry = &ent;
rs->sr_attrs = op->ors_attrs;
rs->sr_flags = 0;
- switch ( send_search_entry( op, rs ) ) {
- case 0:
- case 1:
- rc = LDAP_SUCCESS;
- break;
- case -1:
+ rc = send_search_entry( op, rs );
+ switch ( rc ) {
+ case LDAP_UNAVAILABLE:
rc = LDAP_OTHER;
break;
- case SLAPD_SEND_SIZELIMIT:
- rc = LDAP_SIZELIMIT_EXCEEDED;
- break;
- default:
- /* trap other values when added... */
- assert( 0 );
}
rs->sr_entry = NULL;
rs->sr_attrs = NULL;
rs->sr_entry = e;
rs->sr_attrs = op->ors_attrs;
rs->sr_flags = REP_ENTRY_MODIFIABLE;
- rc = send_search_entry( op, rs );
- switch ( rc ) {
- case SLAPD_SEND_SIZELIMIT:
+ rs->sr_err = LDAP_SUCCESS;
+ rs->sr_err = send_search_entry( op, rs );
+ if ( rs->sr_err == LDAP_SIZELIMIT_EXCEEDED ) {
rs->sr_entry = NULL;
- rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
goto done;
}
}
rs->sr_entry = e;
rs->sr_flags = ( e == &user_entry ) ? REP_ENTRY_MODIFIABLE : 0;
/* FIXME: need the whole entry (ITS#3480) */
- sres = send_search_entry( op, rs );
+ rs->sr_err = send_search_entry( op, rs );
rs->sr_entry = NULL;
rs->sr_attrs = NULL;
rs->sr_operational_attrs = NULL;
- switch ( sres ) {
- case -1:
+ switch ( rs->sr_err ) {
+ case LDAP_UNAVAILABLE:
/*
* FIXME: send_search_entry failed;
* better stop
"connection lost\n", 0, 0, 0 );
goto end_of_search;
- case SLAPD_SEND_SIZELIMIT:
- rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+ case LDAP_SIZELIMIT_EXCEEDED:
goto send_results;
}
}
BackendInfo *bi0 = op->o_bd->bd_info;
int i;
long stoptime = 0;
- glue_state gs = {0, 0, 0, NULL, 0, NULL};
+ glue_state gs = {0, 0, NULL, 0, NULL};
slap_callback cb = { NULL, glue_op_response, NULL, NULL };
int scope0, tlimit0;
struct berval dn, ndn, *pdn;
static int
config_sizelimit(ConfigArgs *c) {
int i, rc = 0;
- char *next;
struct slap_limits_set *lim = &c->be->be_def_limit;
if (c->op == SLAP_CONFIG_EMIT) {
char buf[8192];
static int
config_timelimit(ConfigArgs *c) {
int i, rc = 0;
- char *next;
struct slap_limits_set *lim = &c->be->be_def_limit;
if (c->op == SLAP_CONFIG_EMIT) {
char buf[8192];
static int
config_loglevel(ConfigArgs *c) {
int i;
- char *next;
if ( loglevel_ops == NULL ) {
loglevel_init();
retcode_item_t *rdi;
for ( rdi = rd->rd_item; rdi != NULL; rdi = rdi->rdi_next ) {
- int rc;
-
if ( op->o_abandon ) {
return rs->sr_err = SLAPD_ABANDON;
}
rs->sr_err = LDAP_SUCCESS;
rs->sr_entry = &rdi->rdi_e;
- rc = send_search_entry( op, rs );
+ rs->sr_err = send_search_entry( op, rs );
+ rs->sr_entry = NULL;
- switch ( rc ) {
- case 0: /* entry sent ok */
- break;
- case 1: /* entry not sent */
- break;
- case -1: /* connection closed */
- rs->sr_entry = NULL;
+ switch ( rs->sr_err ) {
+ case LDAP_UNAVAILABLE: /* connection closed */
rs->sr_err = LDAP_OTHER;
- goto done;
- case SLAPD_SEND_SIZELIMIT:
- rs->sr_entry = NULL;
- rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+ /* fallthru */
+ case LDAP_SIZELIMIT_EXCEEDED:
goto done;
}
}
/*
* returns:
*
- * 0 entry sent
- * 1 entry not sent (other)
- * -1 entry not sent (connection closed)
- * SLAPD_SEND_SIZELIMIT entry not sent (caller must send sizelimitExceeded)
+ * LDAP_SUCCESS entry sent
+ * LDAP_OTHER entry not sent (other)
+ * LDAP_INSUFFICIENT_ACCESS entry not sent (ACL)
+ * LDAP_UNAVAILABLE entry not sent (connection closed)
+ * LDAP_SIZELIMIT_EXCEEDED entry not sent (caller must send sizelimitExceeded)
*/
int
BerElementBuffer berbuf;
BerElement *ber = (BerElement *) &berbuf;
Attribute *a;
- int i, j, rc=-1, bytes;
+ int i, j, rc = LDAP_UNAVAILABLE, bytes;
char *edn;
int userattrs;
AccessControlState acl_state = ACL_STATE_INIT;
char **e_flags = NULL;
if ( op->ors_slimit >= 0 && rs->sr_nentries >= op->ors_slimit ) {
- return SLAPD_SEND_SIZELIMIT;
+ return LDAP_SIZELIMIT_EXCEEDED;
}
rs->sr_type = REP_SEARCH;
"send_search_entry: conn %lu access to entry (%s) not allowed\n",
op->o_connid, rs->sr_entry->e_name.bv_val, 0 );
- rc = 1;
+ rc = LDAP_INSUFFICIENT_ACCESS;
goto error_return;
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER, "encoding DN error" );
+ rc = rs->sr_err;
goto error_return;
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER,
"matched values filtering error" );
+ rc = rs->sr_err;
goto error_return;
}
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER,
"encoding description error");
+ rc = rs->sr_err;
goto error_return;
}
finish = 1;
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER,
"encoding description error");
+ rc = rs->sr_err;
goto error_return;
}
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER,
"encoding values error" );
+ rc = rs->sr_err;
goto error_return;
}
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER, "encode end error" );
+ rc = rs->sr_err;
goto error_return;
}
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER,
"matched values filtering error" );
+ rc = rs->sr_err;
goto error_return;
}
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER,
"encoding description error" );
+ rc = rs->sr_err;
goto error_return;
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER,
"encoding values error" );
+ rc = rs->sr_err;
goto error_return;
}
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER, "encode end error" );
+ rc = rs->sr_err;
goto error_return;
}
}
if ( op->o_res_ber == NULL ) ber_free_buf( ber );
send_ldap_error( op, rs, LDAP_OTHER, "encode entry end error" );
- rc = 1;
+ rc = rs->sr_err;
goto error_return;
}
"send_search_entry: conn %lu ber write failed.\n",
op->o_connid, 0, 0 );
- rc = -1;
+ rc = LDAP_UNAVAILABLE;
goto error_return;
}
rs->sr_nentries++;
Debug( LDAP_DEBUG_TRACE,
"<= send_search_entry: conn %lu exit.\n", op->o_connid, 0, 0 );
- rc = 0;
+ rc = LDAP_SUCCESS;
error_return:;
if ( op->o_callback ) {
/* unknown config file directive */
#define SLAP_CONF_UNKNOWN (-1026)
-/* pseudo error code indicating caller should send sizelimitExceeded */
-#define SLAPD_SEND_SIZELIMIT (-1027)
-
/* We assume "C" locale, that is US-ASCII */
#define ASCII_SPACE(c) ( (c) == ' ' )
#define ASCII_LOWER(c) ( (c) >= 'a' && (c) <= 'z' )