]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/modrdn.c
add new ber dump routine (behind NEW_LOGGING)
[openldap] / servers / slapd / modrdn.c
index 384a6a044719a57d4fd1c4511e5d6583eecd891a..7bcf98ecf63bf35daa8d821dc38252ffeeba6475 100644 (file)
@@ -53,7 +53,8 @@ do_modrdn(
        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 );
 
@@ -150,35 +151,40 @@ do_modrdn(
                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;
        }
 
@@ -186,7 +192,7 @@ do_modrdn(
         * 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 */