- /* Remove old rdn value if required */
- if ( deleteoldrdn ) {
- /* Get value of old rdn */
- if ( old_rdn == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: can't figure out old RDN value(s) from old RDN\n" ));
-#else
- Debug( LDAP_DEBUG_TRACE,
- "ldbm_back_modrdn: can't figure out oldRDN value(s) from old RDN\n",
- 0, 0, 0 );
-#endif
-
- send_ldap_result( conn, op, LDAP_OTHER,
- NULL, "could not parse value(s) from old RDN", NULL, NULL );
- goto return_results;
- }
-
- for ( d_cnt = 0; old_rdn[0][d_cnt]; d_cnt++ ) {
- int rc;
- AttributeDescription *desc = NULL;
- Modifications *mod_tmp;
-
- rc = slap_bv2ad( &old_rdn[0][d_cnt]->la_attr, &desc, &text );
-
- if ( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: %s: %s (old)\n",
- text, old_rdn[0][d_cnt]->la_attr.bv_val ));
-#else
- Debug( LDAP_DEBUG_TRACE,
- "ldbm_back_modrdn: %s: %s (old)\n",
- text, old_rdn[0][d_cnt]->la_attr.bv_val, 0 );
-#endif
-
- send_ldap_result( conn, op, rc,
- NULL, text, NULL, NULL );
-
- goto return_results;
- }
-
- if ( ! access_allowed( be, conn, op, e,
- desc, &old_rdn[0][d_cnt]->la_value, ACL_WRITE ) ) {
-#ifdef NEW_LOGGING
- LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
- "ldbm_back_modrdn: access "
- "not allowed to attr \"%s\"\n",
- old_rdn[0][d_cnt]->la_attr.bv_val ));
-#else
- Debug( LDAP_DEBUG_TRACE,
- "ldbm_back_modrdn: access not allowed "
- "to attr \"%s\"\n%s%s",
- old_rdn[0][d_cnt]->la_attr.bv_val, "", "" );
-#endif
- send_ldap_result( conn, op,
- LDAP_INSUFFICIENT_ACCESS,
- NULL, NULL, NULL, NULL );
-
- goto return_results;
- }
-
- /* Remove old value of rdn as an attribute. */
- mod_tmp = (Modifications *)ch_malloc( sizeof( Modifications )
- + 2 * sizeof( struct berval ) );
- mod_tmp->sml_desc = desc;
- mod_tmp->sml_bvalues = (BerVarray)(mod_tmp+1);
- mod_tmp->sml_bvalues[0] = old_rdn[0][d_cnt]->la_value;
- mod_tmp->sml_bvalues[1].bv_val = NULL;
- mod_tmp->sml_op = LDAP_MOD_DELETE;
- mod_tmp->sml_next = mod;
- mod = mod_tmp;
-