Backend *newSuperior_be = NULL;
ber_len_t length;
int rc;
- char *text;
+ const char *text;
+ int manageDSAit;
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
goto cleanup;
}
+ if( ndn == '\0' ) {
+ Debug( LDAP_DEBUG_ANY, "do_modrdn: root dse!\n", 0, 0, 0 );
+ send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+ NULL, "cannot rename the root DSE", NULL, NULL );
+ goto cleanup;
+ }
+
Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d MODRDN dn=\"%s\"\n",
op->o_connid, op->o_opid, dn, 0, 0 );
+ manageDSAit = get_manageDSAit( op );
+
/*
* We could be serving multiple database backends. Select the
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
-
- if ( (be = select_backend( ndn )) == NULL ) {
+ if ( (be = select_backend( ndn, manageDSAit )) == NULL ) {
send_ldap_result( conn, op, rc = LDAP_REFERRAL,
NULL, NULL, default_referral, NULL );
goto cleanup;
}
- /* make sure this backend recongizes critical controls */
- rc = backend_check_controls( be, conn, op, &text ) ;
-
+ /* check restrictions */
+ rc = backend_check_restrictions( be, conn, op, NULL, &text ) ;
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc,
NULL, text, NULL, NULL );
goto cleanup;
}
- if ( global_readonly || be->be_readonly ) {
- Debug( LDAP_DEBUG_ANY, "do_modrdn: database is read-only\n",
- 0, 0, 0 );
- send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
- NULL, "database is read-only", NULL, NULL );
+ /* check for referrals */
+ rc = backend_check_referrals( be, conn, op, dn, ndn );
+ if ( rc != LDAP_SUCCESS ) {
goto cleanup;
}
* the same backend, otherwise we return an error.
*/
if( newSuperior != NULL ) {
- newSuperior_be = select_backend( nnewSuperior );
+ newSuperior_be = select_backend( nnewSuperior, 0 );
if ( newSuperior_be != be ) {
/* newSuperior is in same backend */
}
} else {
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
- NULL, "modrdn/moddn function not implemented", NULL, NULL );
+ NULL, "operation not supported within namingContext", NULL, NULL );
}
cleanup: