{
Entry *entry = NULL;
struct berval dn = { 0, NULL };
- struct berval *pdn = NULL;
- struct berval *ndn = NULL;
+ struct berval pdn = { 0, NULL };
+ struct berval ndn = { 0, NULL };
struct berval desc = { 0, NULL };
struct berval value = { 0, NULL };
struct berval *nvalue;
goto cleanup;
}
- rc = dnPretty( NULL, &dn, &pdn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "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.bv_val, 0, 0 );
-#endif
- send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
- "invalid DN", NULL, NULL );
- goto cleanup;
- }
-
- rc = dnNormalize( NULL, &dn, &ndn );
+ rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
ava.aa_value = nvalue;
- if( strcasecmp( ndn->bv_val, LDAP_ROOT_DSE ) == 0 ) {
+ if( strcasecmp( ndn.bv_val, LDAP_ROOT_DSE ) == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
"do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, pdn->bv_val,
+ conn->c_connid, pdn.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",
- pdn->bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
+ pdn.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, pdn->bv_val,
+ op->o_connid, op->o_opid, pdn.bv_val,
ava.aa_desc->ad_cname.bv_val, 0 );
rc = backend_check_restrictions( NULL, conn, op, NULL, &text ) ;
goto cleanup;
}
- } else if ( strcasecmp( ndn->bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
+ } else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
"do_compare: conn %d dn (%s) attr(%s) value (%s)\n",
- conn->c_connid, pdn->bv_val, ava.aa_desc->ad_cname.bv_val,
+ conn->c_connid, pdn.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",
- pdn->bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
+ pdn.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, pdn->bv_val,
+ op->o_connid, op->o_opid, pdn.bv_val,
ava.aa_desc->ad_cname.bv_val, 0 );
rc = backend_check_restrictions( NULL, conn, op, NULL, &text ) ;
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
+ if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, pdn, LDAP_SCOPE_DEFAULT );
+ NULL, &pdn, 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, pdn, ndn );
+ rc = backend_check_referrals( be, conn, op, &pdn, &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, pdn->bv_val, ava.aa_desc->ad_cname.bv_val,
+ conn->c_connid, pdn.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",
- pdn->bv_val, ava.aa_desc->ad_cname.bv_val, ava.aa_value->bv_val );
+ pdn.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, pdn->bv_val,
+ op->o_connid, op->o_opid, pdn.bv_val,
ava.aa_desc->ad_cname.bv_val, 0 );
/* deref suffix alias if appropriate */
- suffix_alias( be, ndn );
+ suffix_alias( be, &ndn );
if ( be->be_compare ) {
- (*be->be_compare)( be, conn, op, pdn, ndn, &ava );
+ (*be->be_compare)( be, conn, op, &pdn, &ndn, &ava );
} else {
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "operation not supported within namingContext",
cleanup:
free( dn.bv_val );
- ber_bvfree( pdn );
- ber_bvfree( ndn );
+ free( pdn.bv_val );
+ free( ndn.bv_val );
free( desc.bv_val );
free( value.bv_val );
if ( load_ucdata( NULL ) < 0 ) return 1;
{
- struct berval dn, *pdn, *ndn;
+ struct berval dn;
dn.bv_val = cargv[1];
dn.bv_len = strlen( dn.bv_val );
- rc = dnPretty( NULL, &dn, &pdn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: defaultSearchBase DN is invalid.\n",
- fname, lineno ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: defaultSearchBase DN is invalid\n",
- fname, lineno, 0 );
-#endif
- return( 1 );
- }
+ rc = dnPrettyNormal( NULL, &dn,
+ &default_search_base,
+ &default_search_nbase );
- rc = dnNormalize( NULL, &dn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
"%s: line %d: defaultSearchBase DN is invalid\n",
fname, lineno, 0 );
#endif
- ber_bvfree( ndn );
return( 1 );
}
-
- default_search_base = *pdn;
- default_search_nbase = *ndn;
-
- free( pdn );
- free( ndn );
}
/* set maximum threads in thread pool */
dn.bv_val = cargv[1];
dn.bv_len = strlen( cargv[1] );
+ pdn = ch_malloc( sizeof( struct berval ));
+ ndn = ch_malloc( sizeof( struct berval ));
- rc = dnPretty( NULL, &dn, &pdn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: suffix DN is invalid.\n",
- fname, lineno ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: suffix DN is invalid\n",
- fname, lineno, 0 );
-#endif
- return( 1 );
- }
-
- rc = dnNormalize( NULL, &dn, &ndn );
+ rc = dnPrettyNormal( NULL, &dn, pdn, ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
"%s: line %d: suffix DN is invalid\n",
fname, lineno, 0 );
#endif
- ber_bvfree( ndn );
return( 1 );
}
/* set database suffixAlias */
} else if ( strcasecmp( cargv[0], "suffixAlias" ) == 0 ) {
Backend *tmp_be;
- struct berval alias, *palias, *nalias;
- struct berval aliased, *paliased, *naliased;
+ struct berval alias, *palias, nalias;
+ struct berval aliased, *paliased, naliased;
if ( cargc < 2 ) {
#ifdef NEW_LOGGING
alias.bv_val = cargv[1];
alias.bv_len = strlen( cargv[1] );
+ palias = ch_malloc(sizeof(struct berval));
- rc = dnPretty( NULL, &alias, &palias );
+ rc = dnPrettyNormal( NULL, &alias, palias, &nalias );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
return( 1 );
}
- rc = dnNormalize( NULL, &alias, &nalias );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: alias DN is invalid.\n",
- fname, lineno ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: alias DN is invalid\n",
- fname, lineno, 0 );
-#endif
- ber_bvfree( palias );
- return( 1 );
- }
-
- tmp_be = select_backend( nalias, 0, 0 );
- ber_bvfree( nalias );
+ tmp_be = select_backend( &nalias, 0, 0 );
+ free( nalias.bv_val );
if ( tmp_be != be ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_INFO,
aliased.bv_val = cargv[2];
aliased.bv_len = strlen( cargv[2] );
+ paliased = ch_malloc(sizeof(struct berval));
- rc = dnPretty( NULL, &aliased, &paliased );
+ rc = dnPrettyNormal( NULL, &aliased, paliased, &naliased );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
return( 1 );
}
- rc = dnNormalize( NULL, &aliased, &naliased );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: aliased DN is invalid.\n",
- fname, lineno ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: aliased DN is invalid\n",
- fname, lineno, 0 );
-#endif
- ber_bvfree( palias );
- ber_bvfree( paliased );
- return( 1 );
- }
-
- tmp_be = select_backend( naliased, 0, 0 );
- ber_bvfree( naliased );
+ tmp_be = select_backend( &naliased, 0, 0 );
+ free( naliased.bv_val );
if ( tmp_be != be ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_INFO,
#endif
} else {
- struct berval dn, *pdn = NULL, *ndn = NULL;
+ struct berval dn;
if ( load_ucdata( NULL ) < 0 ) return 1;
dn.bv_val = cargv[1];
dn.bv_len = strlen( cargv[1] );
- rc = dnPretty( NULL, &dn, &pdn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
- "%s: line %d: rootdn DN is invalid.\n",
- fname, lineno ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "%s: line %d: rootdn DN is invalid\n",
- fname, lineno, 0 );
-#endif
- return( 1 );
- }
+ rc = dnPrettyNormal( NULL, &dn,
+ &be->be_rootdn,
+ &be->be_rootndn );
- rc = dnNormalize( NULL, &dn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
"%s: line %d: rootdn DN is invalid\n",
fname, lineno, 0 );
#endif
- ber_bvfree( ndn );
return( 1 );
}
-
- be->be_rootdn = *pdn;
- be->be_rootndn = *ndn;
-
- free( pdn );
- free( ndn );
}
/* set super-secret magic database password */
)
{
struct berval dn = { 0, NULL };
- struct berval *ndn = NULL;
- struct berval *pdn = NULL;
+ struct berval pdn = { 0, NULL };
+ struct berval ndn = { 0, NULL };
const char *text;
Backend *be;
int rc;
goto cleanup;
}
- rc = dnPretty( NULL, &dn, &pdn );
+ rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
goto cleanup;
}
- rc = dnNormalize( NULL, &dn, &ndn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "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.bv_val, 0, 0 );
-#endif
- send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
- "invalid DN", NULL, NULL );
- goto cleanup;
- }
-
- if( ndn->bv_len == 0 ) {
+ if( ndn.bv_len == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_delete: conn %d: "
"Attempt to delete root DSE.\n", conn->c_connid ));
#ifdef SLAPD_SCHEMA_DN
- } else if ( strcasecmp( ndn->bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
+ } else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO, "do_delete: conn %d: "
"Attempt to delete subschema subentry.\n", conn->c_connid ));
}
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d DEL dn=\"%s\"\n",
- op->o_connid, op->o_opid, pdn->bv_val, 0, 0 );
+ op->o_connid, op->o_opid, pdn.bv_val, 0, 0 );
manageDSAit = get_manageDSAit( op );
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
+ if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, pdn, LDAP_SCOPE_DEFAULT );
+ NULL, &pdn, 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, pdn, ndn );
+ rc = backend_check_referrals( be, conn, op, &pdn, &ndn );
if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
/* deref suffix alias if appropriate */
- suffix_alias( be, ndn );
+ suffix_alias( be, &ndn );
/*
* do the delete if 1 && (2 || 3)
if ( !be->be_update_ndn.bv_len || repl_user )
#endif
{
- if ( (*be->be_delete)( be, conn, op, pdn, ndn ) == 0 ) {
+ if ( (*be->be_delete)( be, conn, op, &pdn, &ndn ) == 0 ) {
#ifdef SLAPD_MULTIMASTER
if ( !be->be_update_ndn.bv_len || !repl_user )
#endif
{
- replog( be, op, pdn, ndn, NULL );
+ replog( be, op, &pdn, &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, pdn, LDAP_SCOPE_DEFAULT );
+ NULL, &pdn, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
cleanup:
free( dn.bv_val );
- if( pdn != NULL ) ber_bvfree( pdn );
- if( ndn != NULL ) ber_bvfree( ndn );
+ if( pdn.bv_val != NULL ) ber_bvfree( pdn.bv_val );
+ if( ndn.bv_val != NULL ) ber_bvfree( ndn.bv_val );
return rc;
}
return NULL;
}
- rc = dnPretty( NULL, &value, &pdn );
+ rc = dnPrettyNormal( NULL, &value, &e->e_name, &e->e_nname );
free( value.bv_val );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
entry_free( e );
return NULL;
}
-
- e->e_name.bv_val = ( pdn->bv_val != NULL )
- ? pdn->bv_val : ch_strdup( "" );
- e->e_name.bv_len = pdn->bv_len;
- free( pdn );
continue;
}
return( NULL );
}
- /* generate normalized dn */
- {
- struct berval *ndn = NULL;
-
- rc = dnNormalize( NULL, &e->e_name, &ndn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "str2entry: entry %ld has invalid dn: %s\n",
- (long) e->e_id, e->e_dn ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "str2entry: entry %ld has invalid dn: %s\n",
- (long) e->e_id, e->e_dn, 0 );
-#endif
- entry_free( e );
- return NULL;
- }
-
- e->e_nname = *ndn;
- free( ndn );
- }
-
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL2,
"str2entry(%s) -> 0x%lx\n", e->e_dn, (unsigned long)e ));
Operation *op )
{
struct berval dn = { 0, NULL };
- struct berval *pdn = NULL;
- struct berval *ndn = NULL;
+ struct berval pdn = { 0, NULL };
+ struct berval ndn = { 0, NULL };
char *last;
ber_tag_t tag;
ber_len_t len;
goto cleanup;
}
- rc = dnPretty( NULL, &dn, &pdn );
+ rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
goto cleanup;
}
- rc = dnNormalize( NULL, &dn, &ndn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_modify: conn %d invalid dn (%s)\n",
- conn->c_connid, dn.bv_val ));
-#else
- 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,
- "invalid DN", NULL, NULL );
- goto cleanup;
- }
-
- if( ndn->bv_len == 0 ) {
+ if( ndn.bv_len == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
"do_modify: attempt to modify root DSE.\n" ));
goto cleanup;
#if defined( SLAPD_SCHEMA_DN )
- } else if ( strcasecmp( ndn->bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
+ } else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
"do_modify: attempt to modify subschema subentry.\n" ));
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
+ if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, pdn, LDAP_SCOPE_DEFAULT );
+ NULL, &pdn, 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, pdn, ndn );
+ rc = backend_check_referrals( be, conn, op, &pdn, &ndn );
if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
/* deref suffix alias if appropriate */
- suffix_alias( be, ndn );
+ suffix_alias( be, &ndn );
/*
* do the modify if 1 && (2 || 3)
}
}
- if ( (*be->be_modify)( be, conn, op, pdn, ndn, mods ) == 0
+ if ( (*be->be_modify)( be, conn, op, &pdn, &ndn, mods ) == 0
#ifdef SLAPD_MULTIMASTER
&& !repl_user
#endif
) {
/* but we log only the ones not from a replicator user */
- replog( be, op, pdn, ndn, mods );
+ replog( be, op, &pdn, &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, pdn, LDAP_SCOPE_DEFAULT );
+ NULL, &pdn, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
cleanup:
free( dn.bv_val );
- if( pdn != NULL ) ber_bvfree( pdn );
- if( ndn != NULL ) ber_bvfree( ndn );
+ free( pdn.bv_val );
+ free( ndn.bv_val );
if ( modlist != NULL )
slap_modlist_free( modlist );
if ( mods != NULL )
struct berval newSuperior = { 0, NULL };
ber_int_t deloldrdn;
- struct berval *pdn = NULL;
- struct berval *pnewrdn = NULL;
- struct berval *pnewSuperior = NULL;
+ struct berval pdn = { 0, NULL };
+ struct berval pnewrdn = { 0, NULL };
+ struct berval pnewSuperior = { 0, NULL };
- struct berval *ndn = NULL;
- struct berval *nnewrdn = NULL;
- struct berval *nnewSuperior = NULL;
+ struct berval ndn = { 0, NULL };
+ struct berval nnewrdn = { 0, NULL };
+ struct berval nnewSuperior = { 0, NULL };
Backend *be;
Backend *newSuperior_be = NULL;
goto cleanup;
}
- rc = dnPretty( NULL, &dn, &pdn );
+ rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
goto cleanup;
}
- rc = dnNormalize( NULL, &dn, &ndn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_modrdn: conn %d invalid dn (%s)\n",
- conn->c_connid, pdn->bv_val ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "do_modrdn: invalid dn (%s)\n", pdn->bv_val, 0, 0 );
-#endif
- send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
- "invalid DN", NULL, NULL );
- goto cleanup;
- }
-
- if( ndn->bv_len == 0 ) {
+ if( ndn.bv_len == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
"do_modrdn: attempt to modify root DSE.\n" ));
goto cleanup;
#ifdef SLAPD_SCHEMA_DN
- } else if ( strcasecmp( ndn->bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
+ } else if ( strcasecmp( ndn.bv_val, SLAPD_SCHEMA_DN ) == 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
"do_modrdn: attempt to modify subschema subentry\n" ));
/* FIXME: should have/use rdnPretty / rdnNormalize routines */
- rc = dnPretty( NULL, &newrdn, &pnewrdn );
+ rc = dnPrettyNormal( NULL, &newrdn, &pnewrdn, &nnewrdn );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
goto cleanup;
}
- rc = dnNormalize( NULL, &newrdn, &nnewrdn );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_modrdn: conn %d invalid newrdn (%s)\n",
- conn->c_connid, pnewrdn->bv_val ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "do_modrdn: invalid newrdn (%s)\n", pnewrdn->bv_val, 0, 0 );
-#endif
- send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
- "invalid new RDN", NULL, NULL );
- goto cleanup;
- }
-
- if( rdnValidate( pnewrdn ) != LDAP_SUCCESS ) {
+ if( rdnValidate( &pnewrdn ) != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
- "do_modrdn: invalid rdn (%s).\n", pnewrdn->bv_val ));
+ "do_modrdn: invalid rdn (%s).\n", pnewrdn.bv_val ));
#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid rdn (%s)\n",
- pnewrdn->bv_val, 0, 0 );
+ pnewrdn.bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
}
if( newSuperior.bv_len ) {
- rc = dnPretty( NULL, &newSuperior, &pnewSuperior );
+ rc = dnPrettyNormal( NULL, &newSuperior, &pnewSuperior,
+ &nnewSuperior );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
Debug( LDAP_DEBUG_ANY,
"do_modrdn: invalid newSuperior (%s)\n",
newSuperior.bv_val, 0, 0 );
-#endif
- send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
- "invalid newSuperior", NULL, NULL );
- goto cleanup;
- }
-
- rc = dnNormalize( NULL, &newSuperior, &nnewSuperior );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
- "do_modrdn: conn %d invalid newSuperior (%s)\n",
- conn->c_connid, pnewSuperior->bv_val ));
-#else
- Debug( LDAP_DEBUG_ANY,
- "do_modrdn: invalid newSuperior (%s)\n",
- pnewSuperior->bv_val, 0, 0 );
#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid newSuperior", NULL, NULL );
}
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n",
- op->o_connid, op->o_opid, pdn->bv_val, 0, 0 );
+ op->o_connid, op->o_opid, pdn.bv_val, 0, 0 );
manageDSAit = get_manageDSAit( op );
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
+ if ( (be = select_backend( &ndn, manageDSAit, 0 )) == NULL ) {
struct berval **ref = referral_rewrite( default_referral,
- NULL, pdn, LDAP_SCOPE_DEFAULT );
+ NULL, &pdn, 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, pdn, ndn );
+ rc = backend_check_referrals( be, conn, op, &pdn, &ndn );
if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
* the same backend, otherwise we return an error.
*/
if( newSuperior.bv_len ) {
- newSuperior_be = select_backend( nnewSuperior, 0, 0 );
+ newSuperior_be = select_backend( &nnewSuperior, 0, 0 );
if ( newSuperior_be != be ) {
/* newSuperior is in same backend */
}
/* deref suffix alias if appropriate */
- suffix_alias( be, nnewSuperior );
+ suffix_alias( be, &nnewSuperior );
}
/* deref suffix alias if appropriate */
- suffix_alias( be, ndn );
+ suffix_alias( be, &ndn );
/*
* do the add if 1 && (2 || 3)
if ( !be->be_update_ndn.bv_len || repl_user )
#endif
{
- if ( (*be->be_modrdn)( be, conn, op, pdn, ndn,
- pnewrdn, nnewrdn, deloldrdn,
- pnewSuperior, nnewSuperior ) == 0
+ if ( (*be->be_modrdn)( be, conn, op, &pdn, &ndn,
+ &pnewrdn, &nnewrdn, deloldrdn,
+ &pnewSuperior, &nnewSuperior ) == 0
#ifdef SLAPD_MULTIMASTER
&& ( !be->be_update_ndn.bv_len || !repl_user )
#endif
) {
struct slap_replog_moddn moddn;
- moddn.newrdn = pnewrdn;
+ moddn.newrdn = &pnewrdn;
moddn.deloldrdn = deloldrdn;
- moddn.newsup = pnewSuperior;
+ moddn.newsup = &pnewSuperior;
- replog( be, op, pdn, ndn, &moddn );
+ replog( be, op, &pdn, &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, pdn, LDAP_SCOPE_DEFAULT );
+ NULL, &pdn, LDAP_SCOPE_DEFAULT );
send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
ref ? ref : defref, NULL );
cleanup:
free( dn.bv_val );
- if( pdn != NULL ) ber_bvfree( pdn );
- if( ndn != NULL ) ber_bvfree( ndn );
+ free( pdn.bv_val );
+ free( ndn.bv_val );
free( newrdn.bv_val );
- if( pnewrdn != NULL ) ber_bvfree( pnewrdn );
- if( nnewrdn != NULL ) ber_bvfree( nnewrdn );
+ free( pnewrdn.bv_val );
+ free( nnewrdn.bv_val );
free( newSuperior.bv_val );
- if ( pnewSuperior != NULL ) ber_bvfree( pnewSuperior );
- if ( nnewSuperior != NULL ) ber_bvfree( nnewSuperior );
+ free( pnewSuperior.bv_val );
+ free( nnewSuperior.bv_val );
return rc;
}