"a" (char **)... another step towards BerValue DNs.
do_add( Connection *conn, Operation *op )
{
BerElement *ber = op->o_ber;
- char *dn, *last;
+ char *last;
+ struct berval dn;
ber_len_t len;
ber_tag_t tag;
Entry *e;
*/
/* get the name */
- if ( ber_scanf( ber, "{a", /*}*/ &dn ) == LBER_ERROR ) {
+ if ( ber_scanf( ber, "{o", /*}*/ &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
"do_add: conn %d ber_scanf failed\n", conn->c_connid ));
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
- e->e_dn = dn_pretty( dn );
- e->e_ndn = dn_normalize( dn );
+ e->e_dn = dn_pretty( dn.bv_val );
+ e->e_ndn = dn_normalize( dn.bv_val );
e->e_attrs = NULL;
e->e_private = NULL;
if ( e->e_ndn == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_add: conn %d invalid dn (%s)\n", conn->c_connid, dn ));
+ "do_add: conn %d invalid dn (%s)\n", conn->c_connid,
+ dn.bv_val ));
#else
- Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
ber_int_t version;
ber_tag_t method;
char *mech;
- char *dn;
+ struct berval dn = { 0, NULL };
char *ndn;
ber_tag_t tag;
int rc = LDAP_SUCCESS;
Backend *be;
#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, "do_bind: conn %d\n", conn->c_connid ));
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_bind: conn %d\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
#endif
- dn = NULL;
ndn = NULL;
mech = NULL;
cred.bv_val = NULL;
* }
*/
- tag = ber_scanf( ber, "{iat" /*}*/, &version, &dn, &method );
+ tag = ber_scanf( ber, "{iot" /*}*/, &version, &dn, &method );
if ( tag == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_bind: conn %d ber_scanf failed\n", conn->c_connid ));
+ "do_bind: conn %d ber_scanf failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
#endif
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_bind: conn %d get_ctrls failed\n", conn->c_connid ));
+ "do_bind: conn %d get_ctrls failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "do_bind: get_ctrls failed\n", 0, 0, 0 );
#endif
goto cleanup;
}
- ndn = ch_strdup( dn );
+ ndn = ch_strdup( dn.bv_val );
if ( dn_normalize( ndn ) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_bind: conn %d invalid dn (%s)\n", conn->c_connid, dn ));
+ "do_bind: conn %d invalid dn (%s)\n",
+ conn->c_connid, dn.bv_val ));
#else
- Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n",
+ dn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
if( method == LDAP_AUTH_SASL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "do_sasl_bind: conn %d dn (%s) mech %s\n", conn->c_connid,
- dn, mech ));
+ "do_sasl_bind: conn %d dn (%s) mech %s\n", conn->c_connid,
+ dn.bv_val, mech ));
#else
Debug( LDAP_DEBUG_TRACE, "do_sasl_bind: dn (%s) mech %s\n",
- dn, mech, NULL );
+ dn.bv_val, mech, NULL );
#endif
} else {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "do_bind: conn %d version=%ld dn=\"%s\" method=%ld\n",
- conn->c_connid, (unsigned long) version, dn, (unsigned long)method ));
+ "do_bind: conn %d version=%ld dn=\"%s\" method=%ld\n",
+ conn->c_connid, (unsigned long) version,
+ dn.bv_val, (unsigned long)method ));
#else
- Debug( LDAP_DEBUG_TRACE, "do_bind: version=%ld dn=\"%s\" method=%ld\n",
- (unsigned long) version, dn, (unsigned long) method );
+ Debug( LDAP_DEBUG_TRACE,
+ "do_bind: version=%ld dn=\"%s\" method=%ld\n",
+ (unsigned long) version,
+ dn.bv_val, (unsigned long) method );
#endif
}
if ( version < LDAP_VERSION_MIN || version > LDAP_VERSION_MAX ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_bind: conn %d unknown version = %ld\n",
- conn->c_connid, (unsigned long)version ));
+ "do_bind: conn %d unknown version = %ld\n",
+ conn->c_connid, (unsigned long)version ));
#else
Debug( LDAP_DEBUG_ANY, "do_bind: unknown version=%ld\n",
(unsigned long) version, 0, 0 );
if ( version < LDAP_VERSION3 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_bind: conn %d sasl with LDAPv%ld\n",
- conn->c_connid, (unsigned long)version ));
+ "do_bind: conn %d sasl with LDAPv%ld\n",
+ conn->c_connid, (unsigned long)version ));
#else
Debug( LDAP_DEBUG_ANY, "do_bind: sasl with LDAPv%ld\n",
(unsigned long) version, 0, 0 );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
edn = NULL;
- rc = slap_sasl_bind( conn, op, dn, ndn, &cred, &edn, &ssf );
+ rc = slap_sasl_bind( conn, op, dn.bv_val, ndn, &cred, &edn, &ssf );
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
if( rc == LDAP_SUCCESS ) {
if ( (be = select_backend( ndn, 0, 0 )) == NULL ) {
if ( default_referral ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
/* deref suffix alias if appropriate */
ndn = suffix_alias( be, ndn );
- ret = (*be->be_bind)( be, conn, op, dn, ndn,
+ ret = (*be->be_bind)( be, conn, op, dn.bv_val, ndn,
method, &cred, &edn );
if ( ret == 0 ) {
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
- conn->c_cdn = dn;
- dn = NULL;
+ conn->c_cdn = dn.bv_val;
+ dn.bv_val = NULL;
+ dn.bv_len = 0;
if(edn != NULL) {
conn->c_dn = edn;
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "do_bind: conn %d v%d bind: \"%s\" to \"%s\" \n",
- conn->c_connid, version, conn->c_cdn, conn->c_dn ));
+ "do_bind: conn %d v%d bind: \"%s\" to \"%s\" \n",
+ conn->c_connid, version, conn->c_cdn, conn->c_dn ));
#else
Debug( LDAP_DEBUG_TRACE, "do_bind: v%d bind: \"%s\" to \"%s\"\n",
- version, conn->c_cdn, conn->c_dn );
+ version, conn->c_cdn, conn->c_dn );
#endif
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
}
cleanup:
- if( dn != NULL ) {
- free( dn );
- }
+ free( dn.bv_val );
if( ndn != NULL ) {
free( ndn );
}
)
{
Entry *entry = NULL;
- char *dn = NULL, *ndn=NULL;
+ struct berval dn = { 0, NULL };
+ char *ndn = NULL;
struct berval desc;
struct berval value;
struct berval *nvalue;
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_compare: conn %d\n", conn->c_connid ));
+ "do_compare: conn %d\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
#endif
* }
*/
- if ( ber_scanf( op->o_ber, "{a" /*}*/, &dn ) == LBER_ERROR ) {
+ if ( ber_scanf( op->o_ber, "{o" /*}*/, &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_compare: conn %d ber_scanf failed\n", conn->c_connid ));
+ "do_compare: conn %d ber_scanf failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
if ( ber_scanf( op->o_ber, "{oo}", &desc, &value ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_compare: conn %d get ava failed\n", conn->c_connid ));
+ "do_compare: conn %d get ava failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "do_compare: get ava failed\n", 0, 0, 0 );
#endif
if ( ber_scanf( op->o_ber, /*{*/ "}" ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_compare: conn %d ber_scanf failed\n", conn->c_connid ));
+ "do_compare: conn %d ber_scanf failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
if( ( rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_compare: conn %d get_ctrls failed\n", conn->c_connid ));
+ "do_compare: conn %d get_ctrls failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "do_compare: get_ctrls failed\n", 0, 0, 0 );
#endif
goto cleanup;
}
- ndn = ch_strdup( dn );
+ ndn = ch_strdup( dn.bv_val );
if( dn_normalize( ndn ) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_compare: conn %d invalid dn (%s)\n",
- conn->c_connid, dn ));
+ "do_compare: conn %d invalid dn (%s)\n",
+ conn->c_connid, dn.bv_val ));
#else
- Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_ANY,
+ "do_compare: invalid dn (%s)\n", dn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
"do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, dn, ava.aa_desc->ad_cname.bv_val,
+ conn->c_connid, dn.bv_val, ava.aa_desc->ad_cname.bv_val,
ava.aa_value->bv_val ));
#else
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
- dn, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
+ dn.bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
#endif
Statslog( LDAP_DEBUG_STATS,
"conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n",
- op->o_connid, op->o_opid, dn, ava.aa_desc->ad_cname.bv_val, 0 );
+ op->o_connid, op->o_opid, dn.bv_val,
+ ava.aa_desc->ad_cname.bv_val, 0 );
rc = backend_check_restrictions( NULL, conn, op, NULL, &text ) ;
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
"do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, dn, ava.aa_desc->ad_cname.bv_val,
+ conn->c_connid, dn.bv_val, ava.aa_desc->ad_cname.bv_val,
ava.aa_value->bv_val ));
#else
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
- dn, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
+ dn.bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
#endif
Statslog( LDAP_DEBUG_STATS,
"conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n",
- op->o_connid, op->o_opid, dn, ava.aa_desc->ad_cname.bv_val, 0 );
+ op->o_connid, op->o_opid, dn.bv_val,
+ ava.aa_desc->ad_cname.bv_val, 0 );
rc = backend_check_restrictions( NULL, conn, op, NULL, &text ) ;
if( rc != LDAP_SUCCESS ) {
*/
if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
}
/* check for referrals */
- rc = backend_check_referrals( be, conn, op, dn, ndn );
+ rc = backend_check_referrals( be, conn, op, dn.bv_val, ndn );
if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, dn, ava.aa_desc->ad_cname.bv_val,
- ava.aa_value->bv_val ));
+ "do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
+ conn->c_connid, dn.bv_val, ava.aa_desc->ad_cname.bv_val,
+ ava.aa_value->bv_val ));
#else
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
- dn, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
+ dn.bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
#endif
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n",
ndn = suffix_alias( be, ndn );
if ( be->be_compare ) {
- (*be->be_compare)( be, conn, op, dn, ndn, &ava );
+ (*be->be_compare)( be, conn, op, dn.bv_val, ndn, &ava );
} else {
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "operation not supported within namingContext", NULL, NULL );
}
cleanup:
- free( dn );
+ free( dn.bv_val );
free( ndn );
free( desc.bv_val );
free( value.bv_val );
Operation *op
)
{
- char *dn, *ndn = NULL;
+ struct berval dn = { 0, NULL };
+ char *ndn = NULL;
const char *text;
Backend *be;
int rc;
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_delete: conn %d\n", conn->c_connid ));
+ "do_delete: conn %d\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
#endif
* DelRequest := DistinguishedName
*/
- if ( ber_scanf( op->o_ber, "a", &dn ) == LBER_ERROR ) {
+ if ( ber_scanf( op->o_ber, "o", &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_delete: conn: %d ber_scanf failed\n", conn->c_connid ));
+ "do_delete: conn: %d ber_scanf failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
if( ( rc = get_ctrls( conn, op, 1 ) ) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "oepration", LDAP_LEVEL_ERR,
- "do_delete: conn %d get_ctrls failed\n", conn->c_connid ));
+ "do_delete: conn %d get_ctrls failed\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "do_delete: get_ctrls failed\n", 0, 0, 0 );
#endif
goto cleanup;
}
- ndn = ch_strdup( dn );
+ ndn = ch_strdup( dn.bv_val );
if( dn_normalize( ndn ) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_delete: conn %d invalid dn (%s).\n", conn->c_connid, dn ));
+ "do_delete: conn %d invalid dn (%s).\n",
+ conn->c_connid, dn.bv_val ));
#else
- Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n",
+ dn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
}
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d DEL dn=\"%s\"\n",
- op->o_connid, op->o_opid, dn, 0, 0 );
+ op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
manageDSAit = get_manageDSAit( op );
*/
if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
}
/* check for referrals */
- rc = backend_check_referrals( be, conn, op, dn, ndn );
+ rc = backend_check_referrals( be, conn, op, dn.bv_val, ndn );
if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
if ( be->be_update_ndn == NULL || repl_user )
#endif
{
- if ( (*be->be_delete)( be, conn, op, dn, ndn ) == 0 ) {
+ if ( (*be->be_delete)( be, conn, op, dn.bv_val, ndn ) == 0 ) {
#ifdef SLAPD_MULTIMASTER
if (be->be_update_ndn == NULL || !repl_user )
#endif
{
- replog( be, op, dn, ndn, NULL );
+ replog( be, op, dn.bv_val, ndn, NULL );
}
}
#ifndef SLAPD_MULTIMASTER
struct berval **defref = be->be_update_refs
? be->be_update_refs : default_referral;
struct berval **ref = referral_rewrite( default_referral,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "operation not supported within namingContext", NULL, NULL );
}
+
cleanup:
if( ndn != NULL ) free( ndn );
- free( dn );
+ free( dn.bv_val );
return rc;
}
Connection *conn,
Operation *op )
{
- char *dn, *ndn = NULL;
+ struct berval dn = { 0, NULL };
+ char *ndn = NULL;
char *last;
ber_tag_t tag;
ber_len_t len;
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_modify: enter\n" ));
+ "do_modify: enter\n" ));
#else
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
#endif
* }
*/
- if ( ber_scanf( op->o_ber, "{a" /*}*/, &dn ) == LBER_ERROR ) {
+ if ( ber_scanf( op->o_ber, "{o" /*}*/, &dn ) == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: ber_scanf failed\n" ));
+ "do_modify: ber_scanf failed\n" ));
#else
Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 );
#endif
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_modify: dn (%s)\n", dn ));
+ "do_modify: dn (%s)\n", dn.bv_val ));
#else
- Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn.bv_val, 0, 0 );
#endif
if ( (*modtail)->ml_bvalues == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: modify/add operation (%ld) requires values\n",
- (long)mop ));
+ "do_modify: modify/add operation (%ld) requires values\n",
+ (long)mop ));
#else
Debug( LDAP_DEBUG_ANY,
"do_modify: modify/add operation (%ld) requires values\n",
default: {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: invalid modify operation (%ld)\n",
- (long)mop ));
+ "do_modify: invalid modify operation (%ld)\n",
+ (long)mop ));
#else
Debug( LDAP_DEBUG_ANY,
"do_modify: invalid modify operation (%ld)\n",
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: get_ctrls failed\n" ));
+ "do_modify: get_ctrls failed\n" ));
#else
Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
#endif
goto cleanup;
}
- ndn = ch_strdup( dn );
+ ndn = ch_strdup( dn.bv_val );
if( dn_normalize( ndn ) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: invalid dn (%s)\n", dn ));
+ "do_modify: invalid dn (%s)\n", dn.bv_val ));
#else
- Debug( LDAP_DEBUG_ANY, "do_modify: invalid dn (%s)\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_ANY,
+ "do_modify: invalid dn (%s)\n",
+ dn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
if( *ndn == '\0' ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modify: attempt to modify root DSE.\n" ));
+ "do_modify: attempt to modify root DSE.\n" ));
#else
Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
#endif
for ( tmp = modlist; tmp != NULL; tmp = tmp->ml_next ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
- "\t%s: %s\n", tmp->ml_op == LDAP_MOD_ADD ?
- "add" : (tmp->ml_op == LDAP_MOD_DELETE ?
- "delete" : "replace"), tmp->ml_type ));
+ "\t%s: %s\n", tmp->ml_op == LDAP_MOD_ADD ?
+ "add" : (tmp->ml_op == LDAP_MOD_DELETE ?
+ "delete" : "replace"), tmp->ml_type ));
if ( tmp->ml_bvalues == NULL ) {
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
#endif
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MOD dn=\"%s\"\n",
- op->o_connid, op->o_opid, dn, 0, 0 );
+ op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
manageDSAit = get_manageDSAit( op );
*/
if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
}
/* check for referrals */
- rc = backend_check_referrals( be, conn, op, dn, ndn );
+ rc = backend_check_referrals( be, conn, op, dn.bv_val, ndn );
if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
}
}
- if ( (*be->be_modify)( be, conn, op, dn, ndn, mods ) == 0
+ if ( (*be->be_modify)( be, conn, op, dn.bv_val, ndn, mods ) == 0
#ifdef SLAPD_MULTIMASTER
&& !repl_user
#endif
) {
/* but we log only the ones not from a replicator user */
- replog( be, op, dn, ndn, mods );
+ replog( be, op, dn.bv_val, ndn, mods );
}
#ifndef SLAPD_MULTIMASTER
struct berval **defref = be->be_update_refs
? be->be_update_refs : default_referral;
struct berval **ref = referral_rewrite( defref,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
}
cleanup:
- free( dn );
+ free( dn.bv_val );
if( ndn != NULL ) free( ndn );
if ( modlist != NULL )
slap_modlist_free( modlist );
Operation *op
)
{
- char *dn, *ndn = NULL, *newrdn;
+ struct berval dn = { 0, NULL };
+ struct berval newrdn = { 0, NULL };
+ struct berval newSuperior = { 0, NULL };
ber_int_t deloldrdn;
- Backend *be;
- /* Vars for LDAP v3 newSuperior support */
- char *newSuperior = NULL;
+
+ char *ndn = NULL;
char *nnewSuperior = NULL;
+
+ Backend *be;
Backend *newSuperior_be = NULL;
ber_len_t length;
int rc;
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_modrdn: begin\n" ));
+ "do_modrdn: begin\n" ));
#else
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
#endif
* }
*/
- if ( ber_scanf( op->o_ber, "{aab", &dn, &newrdn, &deloldrdn )
- == LBER_ERROR ) {
+ if ( ber_scanf( op->o_ber, "{oob", &dn, &newrdn, &deloldrdn )
+ == LBER_ERROR )
+ {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: ber_scanf failed\n" ));
+ "do_modrdn: ber_scanf failed\n" ));
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
#endif
*/
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: (v2) invalid field newSuperior.\n" ));
+ "do_modrdn: (v2) invalid field newSuperior.\n" ));
#else
Debug( LDAP_DEBUG_ANY,
- "modrdn(v2): invalid field newSuperior!\n",
- 0, 0, 0 );
+ "modrdn(v2): invalid field newSuperior!\n",
+ 0, 0, 0 );
#endif
send_ldap_disconnect( conn, op,
goto cleanup;
}
- if ( ber_scanf( op->o_ber, "a", &newSuperior )
+ if ( ber_scanf( op->o_ber, "o", &newSuperior )
== LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: ber_scanf(\"a\") failed\n" ));
+ "do_modrdn: ber_scanf(\"a\") failed\n" ));
#else
Debug( LDAP_DEBUG_ANY, "ber_scanf(\"a\") failed\n",
- 0, 0, 0 );
+ 0, 0, 0 );
#endif
send_ldap_disconnect( conn, op,
goto cleanup;
}
- nnewSuperior = ch_strdup( newSuperior );
+ nnewSuperior = ch_strdup( newSuperior.bv_val );
if( dn_normalize( nnewSuperior ) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: invalid new superior (%s)\n", newSuperior ));
+ "do_modrdn: invalid new superior (%s)\n",
+ newSuperior.bv_val ));
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid new superior (%s)\n",
- newSuperior, 0, 0 );
+ newSuperior.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_modrdn: dn (%s) newrdn (%s) newsuperior(%s)\n",
- dn, newrdn, newSuperior != NULL ? newSuperior : "" ));
+ "do_modrdn: dn (%s) newrdn (%s) newsuperior(%s)\n",
+ dn.bv_val, newrdn.bv_val,
+ newSuperior.bv_len ? newSuperior.bv_val : "" ));
#else
Debug( LDAP_DEBUG_ARGS,
"do_modrdn: dn (%s) newrdn (%s) newsuperior (%s)\n",
- dn, newrdn,
- newSuperior != NULL ? newSuperior : "" );
+ dn.bv_val, newrdn.bv_val,
+ newSuperior.bv_len ? newSuperior.bv_val : "" );
#endif
if ( ber_scanf( op->o_ber, /*{*/ "}") == LBER_ERROR ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: ber_scanf failed\n" ));
+ "do_modrdn: ber_scanf failed\n" ));
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: ber_scanf failed\n", 0, 0, 0 );
#endif
send_ldap_disconnect( conn, op,
- LDAP_PROTOCOL_ERROR, "decoding error" );
+ LDAP_PROTOCOL_ERROR, "decoding error" );
rc = SLAPD_DISCONNECT;
goto cleanup;
}
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: get_ctrls failed\n" ));
+ "do_modrdn: get_ctrls failed\n" ));
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: get_ctrls failed\n", 0, 0, 0 );
#endif
goto cleanup;
}
- ndn = ch_strdup( dn );
+ ndn = ch_strdup( dn.bv_val );
if( dn_normalize( ndn ) == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: invalid dn (%s)\n", dn ));
+ "do_modrdn: invalid dn (%s)\n", dn.bv_val ));
#else
- Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n", dn, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n",
+ dn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
goto cleanup;
}
- if( !rdn_validate( newrdn ) ) {
+ if( !rdn_validate( newrdn.bv_val ) ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: invalid rdn (%s).\n", newrdn ));
+ "do_modrdn: invalid rdn (%s).\n", newrdn.bv_val ));
#else
- Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid rdn (%s)\n", newrdn, 0, 0 );
+ Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid rdn (%s)\n",
+ newrdn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
}
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n",
- op->o_connid, op->o_opid, dn, 0, 0 );
+ op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
manageDSAit = get_manageDSAit( op );
*/
if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
}
/* check for referrals */
- rc = backend_check_referrals( be, conn, op, dn, ndn );
+ rc = backend_check_referrals( be, conn, op, dn.bv_val, ndn );
if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
/* Make sure that the entry being changed and the newSuperior are in
* the same backend, otherwise we return an error.
*/
- if( newSuperior != NULL ) {
+ if( newSuperior.bv_len ) {
newSuperior_be = select_backend( nnewSuperior, 0, 0 );
if ( newSuperior_be != be ) {
if ( be->be_update_ndn == NULL || repl_user )
#endif
{
- if ( (*be->be_modrdn)( be, conn, op, dn, ndn, newrdn,
- deloldrdn, newSuperior ) == 0
+ if ( (*be->be_modrdn)( be, conn, op, dn.bv_val, ndn,
+ newrdn.bv_val, deloldrdn, newSuperior.bv_val ) == 0
#ifdef SLAPD_MULTIMASTER
&& ( be->be_update_ndn == NULL || !repl_user )
#endif
) {
struct replog_moddn moddn;
- moddn.newrdn = newrdn;
+ moddn.newrdn = newrdn.bv_val;
moddn.deloldrdn = deloldrdn;
- moddn.newsup = newSuperior;
+ moddn.newsup = newSuperior.bv_val;
- replog( be, op, dn, ndn, &moddn );
+ replog( be, op, dn.bv_val, ndn, &moddn );
}
#ifndef SLAPD_MULTIMASTER
} else {
struct berval **defref = be->be_update_refs
? be->be_update_refs : default_referral;
struct berval **ref = referral_rewrite( defref,
- NULL, dn, LDAP_SCOPE_DEFAULT );
+ NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
}
} else {
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
- NULL, "operation not supported within namingContext", NULL, NULL );
+ NULL, "operation not supported within namingContext",
+ NULL, NULL );
}
cleanup:
- free( dn );
+ free( dn.bv_val );
+ free( newrdn.bv_val );
+ free( newSuperior.bv_val );
+
if( ndn != NULL ) free( ndn );
- free( newrdn );
- if ( newSuperior != NULL )
- free( newSuperior );
- if ( nnewSuperior != NULL )
- free( nnewSuperior );
+ if ( nnewSuperior != NULL ) free( nnewSuperior );
return rc;
}
Operation *op /* info about the op to which we're responding */
) {
int i;
- ber_int_t scope, deref, attrsonly;
- ber_int_t sizelimit, timelimit;
- char *base = NULL, *nbase = NULL, *fstr = NULL;
+ ber_int_t scope, deref, attrsonly;
+ ber_int_t sizelimit, timelimit;
+ struct berval base = { 0, NULL };
+ char *nbase = NULL, *fstr = NULL;
Filter *filter = NULL;
char **attrs = NULL;
Backend *be;
int rc;
- const char *text;
+ const char *text;
int manageDSAit;
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
- "do_search: conn %d\n", conn->c_connid ));
+ "do_search: conn %d\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
#endif
*/
/* baseObject, scope, derefAliases, sizelimit, timelimit, attrsOnly */
- if ( ber_scanf( op->o_ber, "{aiiiib" /*}*/,
+ if ( ber_scanf( op->o_ber, "{oiiiib" /*}*/,
&base, &scope, &deref, &sizelimit,
- &timelimit, &attrsonly ) == LBER_ERROR ) {
+ &timelimit, &attrsonly ) == LBER_ERROR )
+ {
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = SLAPD_DISCONNECT;
goto return_results;
}
- nbase = ch_strdup( base );
+ nbase = ch_strdup( base.bv_val );
if( dn_normalize( nbase ) == NULL ) {
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX,
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search \"%s\" %d %d %d %d %d\n", base, scope,
- deref, sizelimit, timelimit, attrsonly ));
+ "do_search \"%s\" %d %d %d %d %d\n", base.bv_val, scope,
+ deref, sizelimit, timelimit, attrsonly ));
#else
- Debug( LDAP_DEBUG_ARGS, "SRCH \"%s\" %d %d", base, scope, deref );
+ Debug( LDAP_DEBUG_ARGS, "SRCH \"%s\" %d %d", base.bv_val, scope, deref );
Debug( LDAP_DEBUG_ARGS, " %d %d %d\n", sizelimit, timelimit,
attrsonly);
#endif
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search: conn %d filter: %s\n", conn->c_connid, fstr ));
+ "do_search: conn %d filter: %s\n", conn->c_connid, fstr ));
#else
Debug( LDAP_DEBUG_ARGS, " filter: %s\n", fstr, 0, 0 );
#endif
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_search: conn %d get_ctrls failed (%d)\n",
- conn->c_connid, rc ));
+ "do_search: conn %d get_ctrls failed (%d)\n",
+ conn->c_connid, rc ));
#else
Debug( LDAP_DEBUG_ANY, "do_search: get_ctrls failed\n", 0, 0, 0 );
#endif
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search: conn %d attrs:", conn->c_connid ));
+ "do_search: conn %d attrs:", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ARGS, " attrs:", 0, 0, 0 );
#endif
for ( i = 0; attrs[i] != NULL; i++ ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
- "do_search: %s", attrs[i] ));
+ "do_search: %s", attrs[i] ));
#else
Debug( LDAP_DEBUG_ARGS, " %s", attrs[i], 0, 0 );
#endif
Statslog( LDAP_DEBUG_STATS,
"conn=%ld op=%d SRCH base=\"%s\" scope=%d filter=\"%s\"\n",
- op->o_connid, op->o_opid, base, scope, fstr );
+ op->o_connid, op->o_opid, base.bv_val, scope, fstr );
manageDSAit = get_manageDSAit( op );
}
if( nbase[0] == '\0' && default_search_nbase != NULL ) {
- ch_free( base );
+ ch_free( base.bv_val );
ch_free( nbase );
- base = ch_strdup( default_search_base );
+ base.bv_val = ch_strdup( default_search_base );
+ base.bv_len = strlen( default_search_nbase );
nbase = ch_strdup( default_search_nbase );
}
*/
if ( (be = select_backend( nbase, manageDSAit, 1 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, base, scope );
+ NULL, base.bv_val, scope );
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, ref ? ref : default_referral, NULL );
}
/* check for referrals */
- rc = backend_check_referrals( be, conn, op, base, nbase );
+ rc = backend_check_referrals( be, conn, op, base.bv_val, nbase );
if ( rc != LDAP_SUCCESS ) {
goto return_results;
}
/* actually do the search and send the result(s) */
if ( be->be_search ) {
- (*be->be_search)( be, conn, op, base, nbase, scope, deref, sizelimit,
+ (*be->be_search)( be, conn, op, base.bv_val, nbase,
+ scope, deref, sizelimit,
timelimit, filter, fstr, attrs, attrsonly );
} else {
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
}
return_results:;
- if( base != NULL) free( base );
+ free( base.bv_val );
if( nbase != NULL) free( nbase );
if( fstr != NULL) free( fstr );
if( filter != NULL) filter_free( filter );