mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
ITS#4375 rework statslog, debug log info
This commit is contained in:
parent
b06a5b8498
commit
d918bc9983
@ -37,7 +37,8 @@ do_abandon( Operation *op, SlapReply *rs )
|
||||
ber_int_t id;
|
||||
Operation *o;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_abandon\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
/*
|
||||
* Parse the abandon request. It looks like this:
|
||||
@ -46,7 +47,8 @@ do_abandon( Operation *op, SlapReply *rs )
|
||||
*/
|
||||
|
||||
if ( ber_scanf( op->o_ber, "i", &id ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_abandon: ber_scanf failed\n", 0, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_abandon: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
@ -55,15 +57,17 @@ do_abandon( Operation *op, SlapReply *rs )
|
||||
op->o_log_prefix, (long) id, 0, 0, 0 );
|
||||
|
||||
if( get_ctrls( op, rs, 0 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_abandon: get_ctrls failed\n", 0, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_abandon: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS, "do_abandon: id=%ld\n", (long) id, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ARGS, "%s do_abandon: id=%ld\n",
|
||||
op->o_log_prefix, (long) id, 0 );
|
||||
|
||||
if( id <= 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_abandon: bad msgid %ld\n", (long) id, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_abandon: bad msgid %ld\n",
|
||||
op->o_log_prefix, (long) id, 0 );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
@ -102,8 +106,9 @@ do_abandon( Operation *op, SlapReply *rs )
|
||||
|
||||
ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_abandon: op=%ld %sfound\n",
|
||||
(long) id, o ? "" : "not ", 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_abandon: op=%ld %sfound\n",
|
||||
op->o_log_prefix,
|
||||
(long) id, o ? "" : "not " );
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,9 @@ do_add( Operation *op, SlapReply *rs )
|
||||
int rc = 0;
|
||||
int freevals = 1;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_add\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
/*
|
||||
* Parse the add request. It looks like this:
|
||||
*
|
||||
@ -64,26 +66,31 @@ do_add( Operation *op, SlapReply *rs )
|
||||
|
||||
/* get the name */
|
||||
if ( ber_scanf( ber, "{m", /*}*/ &dn ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_add: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
op->ora_e = entry_alloc();
|
||||
|
||||
rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn,
|
||||
op->o_tmpmemctx );
|
||||
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_add: invalid dn (%s)\n",
|
||||
op->o_log_prefix, dn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
|
||||
goto done;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s ADD dn=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
|
||||
|
||||
op->ora_e = entry_alloc();
|
||||
ber_dupbv( &op->ora_e->e_name, &op->o_req_dn );
|
||||
ber_dupbv( &op->ora_e->e_nname, &op->o_req_ndn );
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS, "do_add: dn (%s)\n", op->ora_e->e_dn, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ARGS, "%s do_add: dn (%s)\n",
|
||||
op->o_log_prefix, op->ora_e->e_dn, 0 );
|
||||
|
||||
/* get the attrs */
|
||||
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
|
||||
@ -97,15 +104,16 @@ do_add( Operation *op, SlapReply *rs )
|
||||
rtag = ber_scanf( ber, "{m{W}}", &tmp.sml_type, &tmp.sml_values );
|
||||
|
||||
if ( rtag == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_add: decoding error\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_add: decoding error\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( tmp.sml_values == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "no values for type %s\n",
|
||||
tmp.sml_type.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_add: no values for type %s\n",
|
||||
op->o_log_prefix, tmp.sml_type.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
|
||||
"no values for attribute type" );
|
||||
goto done;
|
||||
@ -125,14 +133,16 @@ do_add( Operation *op, SlapReply *rs )
|
||||
}
|
||||
|
||||
if ( ber_scanf( ber, /*{*/ "}") == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_add: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_add: get_ctrls failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_add: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -142,9 +152,6 @@ do_add( Operation *op, SlapReply *rs )
|
||||
goto done;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s ADD dn=\"%s\"\n",
|
||||
op->o_log_prefix, op->ora_e->e_name.bv_val, 0, 0, 0 );
|
||||
|
||||
if ( dn_match( &op->ora_e->e_nname, &slap_empty_bv ) ) {
|
||||
/* protocolError may be a more appropriate error */
|
||||
send_ldap_error( op, rs, LDAP_ALREADY_EXISTS,
|
||||
|
@ -46,10 +46,11 @@ do_bind(
|
||||
ber_tag_t tag;
|
||||
Backend *be = NULL;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_bind\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
/*
|
||||
* Force to connection to "anonymous" until bind succeeds.
|
||||
* Force the connection to "anonymous" until bind succeeds.
|
||||
*/
|
||||
ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
|
||||
if ( op->o_conn->c_sasl_bind_in_progress ) {
|
||||
@ -101,7 +102,8 @@ do_bind(
|
||||
tag = ber_scanf( ber, "{imt" /*}*/, &version, &dn, &method );
|
||||
|
||||
if ( tag == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_bind: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
goto cleanup;
|
||||
@ -134,13 +136,16 @@ do_bind(
|
||||
}
|
||||
|
||||
if ( tag == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_bind: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_bind: get_ctrls failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_bind: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -151,14 +156,18 @@ do_bind(
|
||||
rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn,
|
||||
op->o_tmpmemctx );
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n",
|
||||
dn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_bind: invalid dn (%s)\n",
|
||||
op->o_log_prefix, dn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s BIND dn=\"%s\" method=%ld\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val,
|
||||
(unsigned long) op->orb_method, 0, 0 );
|
||||
|
||||
if( op->orb_method == LDAP_AUTH_SASL ) {
|
||||
Debug( LDAP_DEBUG_TRACE, "do_sasl_bind: dn (%s) mech %s\n",
|
||||
Debug( LDAP_DEBUG_TRACE, "do_bind: dn (%s) SASL mech %s\n",
|
||||
op->o_req_dn.bv_val, mech.bv_val, NULL );
|
||||
|
||||
} else {
|
||||
@ -168,13 +177,9 @@ do_bind(
|
||||
(unsigned long) op->orb_method );
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s BIND dn=\"%s\" method=%ld\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val,
|
||||
(unsigned long) op->orb_method, 0, 0 );
|
||||
|
||||
if ( version < LDAP_VERSION_MIN || version > LDAP_VERSION_MAX ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_bind: unknown version=%ld\n",
|
||||
(unsigned long) version, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_bind: unknown version=%ld\n",
|
||||
op->o_log_prefix, (unsigned long) version, 0 );
|
||||
send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
|
||||
"requested protocol version not supported" );
|
||||
goto cleanup;
|
||||
|
@ -56,14 +56,14 @@ int cancel_extop( Operation *op, SlapReply *rs )
|
||||
|
||||
(void) ber_free( ber, 1 );
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s CANCEL msg=%d\n",
|
||||
op->o_log_prefix, opid, 0, 0, 0 );
|
||||
|
||||
if ( opid < 0 ) {
|
||||
rs->sr_text = "message ID invalid";
|
||||
return LDAP_PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s CANCEL msg=%d\n",
|
||||
op->o_log_prefix, opid, 0, 0, 0 );
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
|
||||
LDAP_STAILQ_FOREACH( o, &op->o_conn->c_pending_ops, o_next ) {
|
||||
if ( o->o_msgid == opid ) {
|
||||
|
@ -44,15 +44,10 @@ do_compare(
|
||||
struct berval dn = BER_BVNULL;
|
||||
struct berval desc = BER_BVNULL;
|
||||
struct berval value = BER_BVNULL;
|
||||
#ifdef LDAP_COMP_MATCH
|
||||
AttributeAssertion ava = { NULL, BER_BVNULL, NULL };
|
||||
#else
|
||||
AttributeAssertion ava = { NULL, BER_BVNULL };
|
||||
#endif
|
||||
AttributeAssertion ava = { 0 };
|
||||
|
||||
ava.aa_desc = NULL;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_compare\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/*
|
||||
* Parse the compare request. It looks like this:
|
||||
*
|
||||
@ -66,37 +61,46 @@ do_compare(
|
||||
*/
|
||||
|
||||
if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_compare: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
if ( ber_scanf( op->o_ber, "{mm}", &desc, &value ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_compare: get ava failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_compare: get ava failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
if ( ber_scanf( op->o_ber, /*{*/ "}" ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_compare: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_compare: get_ctrls failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_compare: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn,
|
||||
op->o_tmpmemctx );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_compare: invalid dn (%s)\n", dn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_compare: invalid dn (%s)\n",
|
||||
op->o_log_prefix, dn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS,
|
||||
"%s CMP dn=\"%s\" attr=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val,
|
||||
desc.bv_val, 0, 0 );
|
||||
|
||||
rs->sr_err = slap_bv2ad( &desc, &ava.aa_desc, &rs->sr_text );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
rs->sr_err = slap_bv2undef_ad( &desc, &ava.aa_desc,
|
||||
@ -119,6 +123,11 @@ do_compare(
|
||||
|
||||
op->orc_ava = &ava;
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS,
|
||||
"do_compare: dn (%s) attr (%s) value (%s)\n",
|
||||
op->o_req_dn.bv_val,
|
||||
ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
|
||||
|
||||
op->o_bd = frontendDB;
|
||||
rs->sr_err = frontendDB->be_compare( op, rs );
|
||||
|
||||
@ -136,19 +145,9 @@ int
|
||||
fe_op_compare( Operation *op, SlapReply *rs )
|
||||
{
|
||||
Entry *entry = NULL;
|
||||
AttributeAssertion ava = *op->orc_ava;
|
||||
AttributeAssertion *ava = op->orc_ava;
|
||||
BackendDB *bd = op->o_bd;
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS,
|
||||
"do_compare: dn (%s) attr (%s) value (%s)\n",
|
||||
op->o_req_dn.bv_val,
|
||||
ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS,
|
||||
"%s CMP dn=\"%s\" attr=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val,
|
||||
ava.aa_desc->ad_cname.bv_val, 0, 0 );
|
||||
|
||||
if( strcasecmp( op->o_req_ndn.bv_val, LDAP_ROOT_DSE ) == 0 ) {
|
||||
if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
|
||||
send_ldap_result( op, rs );
|
||||
@ -177,7 +176,7 @@ fe_op_compare( Operation *op, SlapReply *rs )
|
||||
}
|
||||
|
||||
if( entry ) {
|
||||
rs->sr_err = compare_entry( op, entry, &ava );
|
||||
rs->sr_err = compare_entry( op, entry, ava );
|
||||
entry_free( entry );
|
||||
|
||||
send_ldap_result( op, rs );
|
||||
@ -222,23 +221,21 @@ fe_op_compare( Operation *op, SlapReply *rs )
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
op->orc_ava = &ava;
|
||||
|
||||
if ( SLAP_SHADOW(op->o_bd) && get_dontUseCopy(op) ) {
|
||||
/* don't use shadow copy */
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"copy not used" );
|
||||
|
||||
} else if ( ava.aa_desc == slap_schema.si_ad_entryDN ) {
|
||||
} else if ( ava->aa_desc == slap_schema.si_ad_entryDN ) {
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"entryDN compare not supported" );
|
||||
|
||||
} else if ( ava.aa_desc == slap_schema.si_ad_subschemaSubentry ) {
|
||||
} else if ( ava->aa_desc == slap_schema.si_ad_subschemaSubentry ) {
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"subschemaSubentry compare not supported" );
|
||||
|
||||
#ifndef SLAP_COMPARE_IN_FRONTEND
|
||||
} else if ( ava.aa_desc == slap_schema.si_ad_hasSubordinates
|
||||
} else if ( ava->aa_desc == slap_schema.si_ad_hasSubordinates
|
||||
&& op->o_bd->be_has_subordinates )
|
||||
{
|
||||
int rc, hasSubordinates = LDAP_SUCCESS;
|
||||
@ -246,7 +243,7 @@ fe_op_compare( Operation *op, SlapReply *rs )
|
||||
rc = be_entry_get_rw( op, &op->o_req_ndn, NULL, NULL, 0, &entry );
|
||||
if ( rc == 0 && entry ) {
|
||||
if ( ! access_allowed( op, entry,
|
||||
ava.aa_desc, &ava.aa_value, ACL_COMPARE, NULL ) )
|
||||
ava->aa_desc, &ava->aa_value, ACL_COMPARE, NULL ) )
|
||||
{
|
||||
rc = rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
|
||||
|
||||
@ -260,7 +257,7 @@ fe_op_compare( Operation *op, SlapReply *rs )
|
||||
if ( rc == 0 ) {
|
||||
int asserted;
|
||||
|
||||
asserted = bvmatch( &ava.aa_value, &slap_true_bv )
|
||||
asserted = bvmatch( &ava->aa_value, &slap_true_bv )
|
||||
? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE;
|
||||
if ( hasSubordinates == asserted ) {
|
||||
rs->sr_err = LDAP_COMPARE_TRUE;
|
||||
@ -309,7 +306,7 @@ fe_op_compare( Operation *op, SlapReply *rs )
|
||||
int rc = LDAP_OTHER;
|
||||
|
||||
rs->sr_err = backend_attribute( op, NULL, &op->o_req_ndn,
|
||||
ava.aa_desc, &vals, ACL_COMPARE );
|
||||
ava->aa_desc, &vals, ACL_COMPARE );
|
||||
switch ( rs->sr_err ) {
|
||||
default:
|
||||
/* return error only if "disclose"
|
||||
@ -327,7 +324,7 @@ fe_op_compare( Operation *op, SlapReply *rs )
|
||||
if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
|
||||
SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
|
||||
SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
|
||||
vals, &ava.aa_value, op->o_tmpmemctx ) == 0 )
|
||||
vals, &ava->aa_value, op->o_tmpmemctx ) == 0 )
|
||||
{
|
||||
rs->sr_err = LDAP_COMPARE_TRUE;
|
||||
break;
|
||||
|
@ -41,8 +41,8 @@ do_delete(
|
||||
{
|
||||
struct berval dn = BER_BVNULL;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_delete\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/*
|
||||
* Parse the delete request. It looks like this:
|
||||
*
|
||||
@ -50,43 +50,47 @@ do_delete(
|
||||
*/
|
||||
|
||||
if ( ber_scanf( op->o_ber, "m", &dn ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_delete: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_delete: get_ctrls failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_delete: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn,
|
||||
op->o_tmpmemctx );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_delete: invalid dn (%s)\n", dn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_delete: invalid dn (%s)\n",
|
||||
op->o_log_prefix, dn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s DEL dn=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
|
||||
|
||||
if( op->o_req_ndn.bv_len == 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_delete: root dse!\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_delete: root dse!\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/* protocolError would likely be a more appropriate error */
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"cannot delete the root DSE" );
|
||||
goto cleanup;
|
||||
|
||||
} else if ( bvmatch( &op->o_req_ndn, &frontendDB->be_schemandn ) ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_delete: subschema subentry!\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_delete: subschema subentry!\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/* protocolError would likely be a more appropriate error */
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"cannot delete the root DSE" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s DEL dn=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
|
||||
|
||||
op->o_bd = frontendDB;
|
||||
rs->sr_err = frontendDB->be_delete( op, rs );
|
||||
|
||||
|
@ -123,19 +123,20 @@ do_extended(
|
||||
ber_tag_t tag;
|
||||
ber_len_t len;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_extended\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_extended\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
if( op->o_protocol < LDAP_VERSION3 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_extended: protocol version (%d) too low\n",
|
||||
op->o_protocol, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_extended: protocol version (%d) too low\n",
|
||||
op->o_log_prefix, op->o_protocol, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "requires LDAPv3" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( ber_scanf( op->o_ber, "{m" /*}*/, &op->ore_reqoid ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_extended: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
goto done;
|
||||
@ -145,7 +146,8 @@ do_extended(
|
||||
|
||||
if( ber_peek_tag( op->o_ber, &len ) == LDAP_TAG_EXOP_REQ_VALUE ) {
|
||||
if( ber_scanf( op->o_ber, "m", &reqdata ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_extended: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
goto done;
|
||||
@ -153,14 +155,16 @@ do_extended(
|
||||
}
|
||||
|
||||
if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_extended: get_ctrls failed\n", 0, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_extended: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s EXT oid=%s\n",
|
||||
op->o_log_prefix, op->ore_reqoid.bv_val, 0, 0, 0 );
|
||||
|
||||
/* check for controls inappropriate for all extended operations */
|
||||
if( get_manageDSAit( op ) == SLAP_CONTROL_CRITICAL ) {
|
||||
Statslog( LDAP_DEBUG_STATS, "%s EXT oid=%s\n",
|
||||
op->o_log_prefix, op->ore_reqoid.bv_val, 0, 0, 0 );
|
||||
send_ldap_error( op, rs,
|
||||
LDAP_UNAVAILABLE_CRITICAL_EXTENSION,
|
||||
"manageDSAit control inappropriate" );
|
||||
@ -203,10 +207,8 @@ fe_extended( Operation *op, SlapReply *rs )
|
||||
|
||||
ext = find_extop(supp_ext_list, &op->ore_reqoid );
|
||||
if ( ext == NULL ) {
|
||||
Statslog( LDAP_DEBUG_STATS, "%s EXT oid=%s\n",
|
||||
op->o_log_prefix, op->ore_reqoid.bv_val, 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "do_extended: unsupported operation \"%s\"\n",
|
||||
op->ore_reqoid.bv_val, 0 ,0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_extended: unsupported operation \"%s\"\n",
|
||||
op->o_log_prefix, op->ore_reqoid.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
|
||||
"unsupported extended operation" );
|
||||
goto done;
|
||||
|
@ -43,9 +43,12 @@ do_modify(
|
||||
struct berval dn = BER_BVNULL;
|
||||
char textbuf[ SLAP_TEXT_BUFLEN ];
|
||||
size_t textlen = sizeof( textbuf );
|
||||
#ifdef LDAP_DEBUG
|
||||
Modifications *tmp;
|
||||
#endif
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_modify\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/*
|
||||
* Parse the modify request. It looks like this:
|
||||
*
|
||||
@ -66,90 +69,42 @@ do_modify(
|
||||
*/
|
||||
|
||||
if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modify: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ARGS, "%s do_modify: dn (%s)\n",
|
||||
op->o_log_prefix, dn.bv_val, 0 );
|
||||
|
||||
rs->sr_err = slap_parse_modlist( op, rs, op->o_ber, &op->oq_modify );
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modify: slap_parse_modlist failed err=%d msg=%s\n",
|
||||
rs->sr_err, rs->sr_text, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modify: slap_parse_modlist failed err=%d msg=%s\n",
|
||||
op->o_log_prefix, rs->sr_err, rs->sr_text );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modify: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn,
|
||||
op->o_tmpmemctx );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_modify: invalid dn (%s)\n", dn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modify: invalid dn (%s)\n",
|
||||
op->o_log_prefix, dn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
op->orm_no_opattrs = 0;
|
||||
|
||||
rs->sr_err = slap_mods_check( op, op->orm_modlist,
|
||||
&rs->sr_text, textbuf, textlen, NULL );
|
||||
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||
send_ldap_result( op, rs );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
op->o_bd = frontendDB;
|
||||
rs->sr_err = frontendDB->be_modify( op, rs );
|
||||
|
||||
#ifdef LDAP_X_TXN
|
||||
if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
|
||||
/* skip cleanup */
|
||||
return rs->sr_err;
|
||||
}
|
||||
#endif
|
||||
|
||||
cleanup:
|
||||
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
|
||||
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
|
||||
if ( op->orm_modlist != NULL ) slap_mods_free( op->orm_modlist, 1 );
|
||||
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
||||
int
|
||||
fe_op_modify( Operation *op, SlapReply *rs )
|
||||
{
|
||||
#ifdef LDAP_DEBUG
|
||||
Modifications *tmp;
|
||||
#endif
|
||||
BackendDB *op_be, *bd = op->o_bd;
|
||||
char textbuf[ SLAP_TEXT_BUFLEN ];
|
||||
size_t textlen = sizeof( textbuf );
|
||||
|
||||
if ( BER_BVISEMPTY( &op->o_req_ndn ) ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
|
||||
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"modify upon the root DSE not supported" );
|
||||
goto cleanup;
|
||||
|
||||
} else if ( bvmatch( &op->o_req_ndn, &frontendDB->be_schemandn ) ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modify: subschema subentry!\n", 0, 0, 0 );
|
||||
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"modification of subschema subentry not supported" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ARGS, "%s modifications:\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
for ( tmp = op->orm_modlist; tmp != NULL; tmp = tmp->sml_next ) {
|
||||
Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
|
||||
@ -208,6 +163,54 @@ fe_op_modify( Operation *op, SlapReply *rs )
|
||||
}
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
rs->sr_err = slap_mods_check( op, op->orm_modlist,
|
||||
&rs->sr_text, textbuf, textlen, NULL );
|
||||
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||
send_ldap_result( op, rs );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
op->o_bd = frontendDB;
|
||||
rs->sr_err = frontendDB->be_modify( op, rs );
|
||||
|
||||
#ifdef LDAP_X_TXN
|
||||
if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
|
||||
/* skip cleanup */
|
||||
return rs->sr_err;
|
||||
}
|
||||
#endif
|
||||
|
||||
cleanup:
|
||||
op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
|
||||
op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
|
||||
if ( op->orm_modlist != NULL ) slap_mods_free( op->orm_modlist, 1 );
|
||||
|
||||
return rs->sr_err;
|
||||
}
|
||||
|
||||
int
|
||||
fe_op_modify( Operation *op, SlapReply *rs )
|
||||
{
|
||||
BackendDB *op_be, *bd = op->o_bd;
|
||||
char textbuf[ SLAP_TEXT_BUFLEN ];
|
||||
size_t textlen = sizeof( textbuf );
|
||||
|
||||
if ( BER_BVISEMPTY( &op->o_req_ndn ) ) {
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modify: root dse!\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"modify upon the root DSE not supported" );
|
||||
goto cleanup;
|
||||
|
||||
} else if ( bvmatch( &op->o_req_ndn, &frontendDB->be_schemandn ) ) {
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modify: subschema subentry!\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"modification of subschema subentry not supported" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* We could be serving multiple database backends. Select the
|
||||
* appropriate one, or send a referral to our "referral server"
|
||||
@ -1037,10 +1040,6 @@ slap_parse_modlist(
|
||||
switch( mop ) {
|
||||
case LDAP_MOD_ADD:
|
||||
if ( mod->sml_values == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "slap_parse_modlist: "
|
||||
"modify/add operation (%ld) requires values\n",
|
||||
(long) mop, 0, 0 );
|
||||
|
||||
rs->sr_text = "modify/add operation requires values";
|
||||
rs->sr_err = LDAP_PROTOCOL_ERROR;
|
||||
goto done;
|
||||
@ -1056,20 +1055,12 @@ slap_parse_modlist(
|
||||
if( op->o_protocol >= LDAP_VERSION3 ) {
|
||||
ms->rs_increment++;
|
||||
if ( mod->sml_values == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "slap_parse_modlist: "
|
||||
"modify/increment operation (%ld) requires value\n",
|
||||
(long) mop, 0, 0 );
|
||||
|
||||
rs->sr_text = "modify/increment operation requires value";
|
||||
rs->sr_err = LDAP_PROTOCOL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if ( !BER_BVISNULL( &mod->sml_values[ 1 ] ) ) {
|
||||
Debug( LDAP_DEBUG_ANY, "slap_parse_modlist: modify/increment "
|
||||
"operation (%ld) requires single value\n",
|
||||
(long) mop, 0, 0 );
|
||||
|
||||
rs->sr_text = "modify/increment operation requires single value";
|
||||
rs->sr_err = LDAP_PROTOCOL_ERROR;
|
||||
goto done;
|
||||
@ -1080,10 +1071,6 @@ slap_parse_modlist(
|
||||
/* fall thru */
|
||||
|
||||
default:
|
||||
Debug( LDAP_DEBUG_ANY, "slap_parse_modlist: "
|
||||
"unrecognized modify operation (%ld)\n",
|
||||
(long) mop, 0, 0 );
|
||||
|
||||
rs->sr_text = "unrecognized modify operation";
|
||||
rs->sr_err = LDAP_PROTOCOL_ERROR;
|
||||
goto done;
|
||||
|
@ -57,9 +57,8 @@ do_modrdn(
|
||||
|
||||
ber_len_t length;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
|
||||
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_modrdn\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/*
|
||||
* Parse the modrdn request. It looks like this:
|
||||
*
|
||||
@ -74,8 +73,8 @@ do_modrdn(
|
||||
if ( ber_scanf( op->o_ber, "{mmb", &dn, &newrdn, &deloldrdn )
|
||||
== LBER_ERROR )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs, LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
@ -84,12 +83,12 @@ do_modrdn(
|
||||
|
||||
if ( ber_peek_tag( op->o_ber, &length ) == LDAP_TAG_NEWSUPERIOR ) {
|
||||
if ( op->o_protocol < LDAP_VERSION3 ) {
|
||||
/* Conection record indicates v2 but field
|
||||
/* Connection record indicates v2 but field
|
||||
* newSuperior is present: report error.
|
||||
*/
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"modrdn(v2): invalid field newSuperior!\n",
|
||||
0, 0, 0 );
|
||||
"%s do_modrdn: newSuperior requires LDAPv3\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
send_ldap_discon( op, rs,
|
||||
LDAP_PROTOCOL_ERROR, "newSuperior requires LDAPv3" );
|
||||
@ -100,8 +99,8 @@ do_modrdn(
|
||||
if ( ber_scanf( op->o_ber, "m", &newSuperior )
|
||||
== LBER_ERROR ) {
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "ber_scanf(\"m\") failed\n",
|
||||
0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: ber_scanf(\"m\") failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
send_ldap_discon( op, rs,
|
||||
LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
@ -118,8 +117,8 @@ do_modrdn(
|
||||
newSuperior.bv_len ? newSuperior.bv_val : "" );
|
||||
|
||||
if ( ber_scanf( op->o_ber, /*{*/ "}") == LBER_ERROR ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modrdn: ber_scanf failed\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: ber_scanf failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_discon( op, rs,
|
||||
LDAP_PROTOCOL_ERROR, "decoding error" );
|
||||
rs->sr_err = SLAPD_DISCONNECT;
|
||||
@ -127,16 +126,16 @@ do_modrdn(
|
||||
}
|
||||
|
||||
if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modrdn: get_ctrls failed\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/* get_ctrls has sent results. Now clean up. */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_modrdn: invalid dn (%s)\n", dn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: invalid dn (%s)\n",
|
||||
op->o_log_prefix, dn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
|
||||
goto cleanup;
|
||||
}
|
||||
@ -145,16 +144,15 @@ do_modrdn(
|
||||
|
||||
rs->sr_err = dnPrettyNormal( NULL, &newrdn, &op->orr_newrdn, &op->orr_nnewrdn, op->o_tmpmemctx );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_modrdn: invalid newrdn (%s)\n", newrdn.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: invalid newrdn (%s)\n",
|
||||
op->o_log_prefix, newrdn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid new RDN" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if( rdn_validate( &op->orr_newrdn ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid rdn (%s)\n",
|
||||
op->orr_newrdn.bv_val, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: invalid rdn (%s)\n",
|
||||
op->o_log_prefix, op->orr_newrdn.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid new RDN" );
|
||||
goto cleanup;
|
||||
}
|
||||
@ -164,13 +162,16 @@ do_modrdn(
|
||||
&nnewSuperior, op->o_tmpmemctx );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_modrdn: invalid newSuperior (%s)\n",
|
||||
newSuperior.bv_val, 0, 0 );
|
||||
"%s do_modrdn: invalid newSuperior (%s)\n",
|
||||
op->o_log_prefix, newSuperior.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid newSuperior" );
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s MODRDN dn=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
|
||||
|
||||
op->orr_deleteoldrdn = deloldrdn;
|
||||
op->orr_modlist = NULL;
|
||||
|
||||
@ -218,24 +219,21 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
|
||||
BackendDB *op_be, *bd = op->o_bd;
|
||||
|
||||
if( op->o_req_ndn.bv_len == 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modrdn: root dse!\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: root dse!\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"cannot rename the root DSE" );
|
||||
goto cleanup;
|
||||
|
||||
} else if ( bvmatch( &op->o_req_ndn, &frontendDB->be_schemandn ) ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_modrdn: subschema subentry: %s (%ld)\n",
|
||||
frontendDB->be_schemandn.bv_val, (long)frontendDB->be_schemandn.bv_len, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_modrdn: subschema subentry: %s (%ld)\n",
|
||||
op->o_log_prefix, frontendDB->be_schemandn.bv_val, (long)frontendDB->be_schemandn.bv_len );
|
||||
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"cannot rename subschema subentry" );
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Statslog( LDAP_DEBUG_STATS, "%s MODRDN dn=\"%s\"\n",
|
||||
op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
|
||||
|
||||
/*
|
||||
* We could be serving multiple database backends. Select the
|
||||
* appropriate one, or send a referral to our "referral server"
|
||||
@ -388,8 +386,9 @@ slap_modrdn2mods(
|
||||
if ( ldap_bv2rdn_x( &op->oq_modrdn.rs_newrdn, &new_rdn,
|
||||
(char **)&rs->sr_text, LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"slap_modrdn2mods: can't figure out "
|
||||
"type(s)/value(s) of newrdn\n", 0, 0, 0 );
|
||||
"%s slap_modrdn2mods: can't figure out "
|
||||
"type(s)/value(s) of newrdn\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
rs->sr_err = LDAP_INVALID_DN_SYNTAX;
|
||||
rs->sr_text = "unknown type(s) used in RDN";
|
||||
goto done;
|
||||
@ -399,8 +398,9 @@ slap_modrdn2mods(
|
||||
if ( ldap_bv2rdn_x( &op->o_req_dn, &old_rdn,
|
||||
(char **)&rs->sr_text, LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"slap_modrdn2mods: can't figure out "
|
||||
"type(s)/value(s) of oldrdn\n", 0, 0, 0 );
|
||||
"%s slap_modrdn2mods: can't figure out "
|
||||
"type(s)/value(s) of oldrdn\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
rs->sr_err = LDAP_OTHER;
|
||||
rs->sr_text = "cannot parse RDN from old DN";
|
||||
goto done;
|
||||
@ -417,9 +417,10 @@ slap_modrdn2mods(
|
||||
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"slap_modrdn2mods: %s: %s (new)\n",
|
||||
"%s slap_modrdn2mods: %s: %s (new)\n",
|
||||
op->o_log_prefix,
|
||||
rs->sr_text,
|
||||
new_rdn[ a_cnt ]->la_attr.bv_val, 0 );
|
||||
new_rdn[ a_cnt ]->la_attr.bv_val );
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -457,10 +458,10 @@ slap_modrdn2mods(
|
||||
rs->sr_err = slap_bv2ad( &old_rdn[d_cnt]->la_attr, &desc, &rs->sr_text );
|
||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"slap_modrdn2mods: %s: %s (old)\n",
|
||||
"%s slap_modrdn2mods: %s: %s (old)\n",
|
||||
op->o_log_prefix,
|
||||
rs->sr_text,
|
||||
old_rdn[d_cnt]->la_attr.bv_val,
|
||||
0 );
|
||||
old_rdn[d_cnt]->la_attr.bv_val );
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ do_search(
|
||||
struct berval base = BER_BVNULL;
|
||||
ber_len_t siz, off, i;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_search\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
/*
|
||||
* Parse the search request. It looks like this:
|
||||
*
|
||||
@ -112,8 +112,8 @@ do_search(
|
||||
|
||||
rs->sr_err = dnPrettyNormal( NULL, &base, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
|
||||
if( rs->sr_err != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"do_search: invalid dn (%s)\n", base.bv_val, 0, 0 );
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_search: invalid dn (%s)\n",
|
||||
op->o_log_prefix, base.bv_val, 0 );
|
||||
send_ldap_error( op, rs, LDAP_INVALID_DN_SYNTAX, "invalid DN" );
|
||||
goto return_results;
|
||||
}
|
||||
@ -163,8 +163,8 @@ do_search(
|
||||
}
|
||||
|
||||
if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "do_search: get_ctrls failed\n", 0, 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "%s do_search: get_ctrls failed\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
goto return_results;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@
|
||||
int
|
||||
do_unbind( Operation *op, SlapReply *rs )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "do_unbind\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "%s do_unbind\n",
|
||||
op->o_log_prefix, 0, 0 );
|
||||
|
||||
/*
|
||||
* Parse the unbind request. It looks like this:
|
||||
|
Loading…
Reference in New Issue
Block a user