Commit d918bc99 authored by Howard Chu's avatar Howard Chu
Browse files

ITS#4375 rework statslog, debug log info

parent b06a5b84
......@@ -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 ) {