Commit 760f527a authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#5328 - cosmetic cleanup

parent 9aa70639
......@@ -65,8 +65,8 @@ dn2entry_retry:
case 0:
break;
case LDAP_BUSY:
send_ldap_error( op, rs, LDAP_BUSY, "ldap server busy" );
LOCK_ID_FREE ( bdb->bi_dbenv, locker );
rs->sr_text = "ldap server busy";
return LDAP_BUSY;
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
......@@ -76,13 +76,13 @@ dn2entry_retry:
LDAP_XSTRING(bdb_referrals)
": dn2entry failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
LOCK_ID_FREE ( bdb->bi_dbenv, locker );
return rs->sr_err;
rs->sr_text = "internal error";
return LDAP_OTHER;
}
if ( rc == DB_NOTFOUND ) {
rc = 0;
rc = LDAP_SUCCESS;
rs->sr_matched = NULL;
if ( e != NULL ) {
Debug( LDAP_DEBUG_TRACE,
......@@ -117,9 +117,7 @@ dn2entry_retry:
ber_bvarray_free( rs->sr_ref );
rs->sr_ref = NULL;
} else if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
rs->sr_text = rs->sr_matched ? "bad referral object" : NULL;
send_ldap_result( op, rs );
}
LOCK_ID_FREE ( bdb->bi_dbenv, locker );
......@@ -148,8 +146,8 @@ dn2entry_retry:
ber_bvarray_free( rs->sr_ref );
rs->sr_ref = NULL;
} else {
send_ldap_error( op, rs, LDAP_OTHER, "bad referral object" );
rc = rs->sr_err;
rc = LDAP_OTHER;
rs->sr_text = "bad referral object";
}
rs->sr_matched = NULL;
......
......@@ -298,7 +298,7 @@ ldap_distproc_operational( Operation *op, SlapReply *rs )
* database. This fix is likely to intercept also entries
* generated by back-perl and so. */
if ( rs->sr_entry->e_private == NULL ) {
return 0;
return LDAP_SUCCESS;
}
return SLAP_CB_CONTINUE;
......
......@@ -777,9 +777,7 @@ ldif_back_referrals( Operation *op, SlapReply *rs )
rs->sr_ref = NULL;
} else if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
rs->sr_text = rs->sr_matched ? "bad referral object" : NULL;
send_ldap_result( op, rs );
}
if ( rs->sr_matched ) {
......@@ -810,8 +808,8 @@ ldif_back_referrals( Operation *op, SlapReply *rs )
rs->sr_ref = NULL;
} else {
send_ldap_error( op, rs, LDAP_OTHER, "bad referral object" );
rc = rs->sr_err;
rc = LDAP_OTHER;
rs->sr_text = "bad referral object";
}
rs->sr_matched = NULL;
......@@ -1212,6 +1210,7 @@ int ldif_back_entry_get(
{
struct ldif_info *li = (struct ldif_info *) op->o_bd->be_private;
struct berval op_dn = op->o_req_dn, op_ndn = op->o_req_ndn;
int rc = LDAP_NO_SUCH_OBJECT;
assert( ndn != NULL );
assert( !BER_BVISNULL( ndn ) );
......@@ -1224,12 +1223,16 @@ int ldif_back_entry_get(
op->o_req_ndn = op_ndn;
ldap_pvt_thread_rdwr_runlock( &li->li_rdwr );
if ( *ent && oc && !is_entry_objectclass_or_sub( *ent, oc ) ) {
entry_free( *ent );
*ent = NULL;
if ( *ent ) {
rc = LDAP_SUCCESS;
if ( oc && !is_entry_objectclass_or_sub( *ent, oc ) ) {
rc = LDAP_NO_SUCH_ATTRIBUTE;
entry_free( *ent );
*ent = NULL;
}
}
return ( *ent == NULL ? 1 : 0 );
return rc;
}
static int ldif_tool_entry_open(BackendDB *be, int mode) {
......
......@@ -62,6 +62,6 @@ monitor_back_operational(
ap = &(*ap)->a_next;
}
return 0;
return LDAP_SUCCESS;
}
......@@ -70,7 +70,8 @@ null_back_false( Operation *op, SlapReply *rs )
/* for overlays */
int null_back_entry_get(
static int
null_back_entry_get(
Operation *op,
struct berval *ndn,
ObjectClass *oc,
......@@ -78,8 +79,10 @@ int null_back_entry_get(
int rw,
Entry **ent )
{
*ent = NULL;
return 1;
assert( *ent == NULL );
/* don't admit the object isn't there */
return oc || at ? LDAP_NO_SUCH_ATTRIBUTE : LDAP_BUSY;
}
......
......@@ -431,7 +431,7 @@ relay_back_chk_referrals( Operation *op, SlapReply *rs )
}
}
return relay_back_op( op, rs, bd, bd->be_chk_referrals, 0 );
return relay_back_op( op, rs, bd, bd->be_chk_referrals, LDAP_SUCCESS );
}
int
......
......@@ -1830,7 +1830,7 @@ fe_aux_operational(
SlapReply *rs )
{
Attribute **ap;
int rc = 0;
int rc = LDAP_SUCCESS;
for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
/* just count them */ ;
......
......@@ -5298,18 +5298,23 @@ int config_back_entry_get(
{
CfBackInfo *cfb;
CfEntryInfo *ce, *last;
int rc = LDAP_NO_SUCH_OBJECT;
cfb = (CfBackInfo *)op->o_bd->be_private;
ce = config_find_base( cfb->cb_root, ndn, &last );
if ( ce ) {
*ent = ce->ce_entry;
if ( *ent && oc && !is_entry_objectclass_or_sub( *ent, oc ) ) {
*ent = NULL;
if ( *ent ) {
rc = LDAP_SUCCESS;
if ( oc && !is_entry_objectclass_or_sub( *ent, oc ) ) {
rc = LDAP_NO_SUCH_ATTRIBUTE;
*ent = NULL;
}
}
}
return ( *ent == NULL ? 1 : 0 );
return rc;
}
static void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment