mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-01 14:15:49 +08:00
Updates index for rdn attribute type avoiding the 'dissapearing entry'
problem reported in IT78. Index files will still be stale if the modrdn uses deleteoldrdn.
This commit is contained in:
parent
58afabdf00
commit
a88bf50b31
@ -362,6 +362,10 @@ bdb2i_back_modrdn_internal(
|
|||||||
|
|
||||||
attr_merge( e, new_rdn_type, bvals );
|
attr_merge( e, new_rdn_type, bvals );
|
||||||
|
|
||||||
|
/* Update new_rdn_type if it is an index */
|
||||||
|
|
||||||
|
bdb2i_index_add_values( be, new_rdn_type, bvals, e->e_id );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,12 +223,6 @@ ldbm_back_modrdn(
|
|||||||
}
|
}
|
||||||
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
|
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
|
||||||
|
|
||||||
/* add new one */
|
|
||||||
if ( dn2id_add( be, new_ndn, e->e_id ) != 0 ) {
|
|
||||||
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
|
|
||||||
goto return_results;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* delete old one */
|
/* delete old one */
|
||||||
if ( dn2id_delete( be, e->e_ndn ) != 0 ) {
|
if ( dn2id_delete( be, e->e_ndn ) != 0 ) {
|
||||||
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
|
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
|
||||||
@ -241,6 +235,14 @@ ldbm_back_modrdn(
|
|||||||
e->e_dn = new_dn;
|
e->e_dn = new_dn;
|
||||||
e->e_ndn = new_ndn;
|
e->e_ndn = new_ndn;
|
||||||
|
|
||||||
|
/* add new one */
|
||||||
|
if ( dn2id_add( be, e->e_ndn, e->e_id ) != 0 ) {
|
||||||
|
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );
|
||||||
|
goto return_results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Get attribute type and attribute value of our new rdn, we will
|
/* Get attribute type and attribute value of our new rdn, we will
|
||||||
* need to add that to our new entry
|
* need to add that to our new entry
|
||||||
*/
|
*/
|
||||||
@ -266,7 +268,7 @@ ldbm_back_modrdn(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE,
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
"ldbm_back_modrdn: new_rdn_val=%s, new_rdn_type=%s\n",
|
"ldbm_back_modrdn: new_rdn_val=\"%s\", new_rdn_type=\"%s\"\n",
|
||||||
new_rdn_val, new_rdn_type, 0 );
|
new_rdn_val, new_rdn_type, 0 );
|
||||||
|
|
||||||
/* Retrieve the old rdn from the entry's dn */
|
/* Retrieve the old rdn from the entry's dn */
|
||||||
@ -308,6 +310,7 @@ ldbm_back_modrdn(
|
|||||||
bvals[0] = &bv; /* Array of bervals */
|
bvals[0] = &bv; /* Array of bervals */
|
||||||
bvals[1] = NULL;
|
bvals[1] = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Remove old rdn value if required */
|
/* Remove old rdn value if required */
|
||||||
|
|
||||||
if (deleteoldrdn) {
|
if (deleteoldrdn) {
|
||||||
@ -373,13 +376,17 @@ ldbm_back_modrdn(
|
|||||||
|
|
||||||
|
|
||||||
Debug( LDAP_DEBUG_TRACE,
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
"ldbm_back_modrdn: adding new rdn attr val =%s\n",
|
"ldbm_back_modrdn: adding new rdn attr val =\"%s\"\n",
|
||||||
new_rdn_val, 0, 0 );
|
new_rdn_val, 0, 0 );
|
||||||
|
|
||||||
/* No need to normalize new_rdn_type, attr_merge does it */
|
/* No need to normalize new_rdn_type, attr_merge does it */
|
||||||
|
|
||||||
attr_merge( e, new_rdn_type, bvals );
|
attr_merge( e, new_rdn_type, bvals );
|
||||||
|
|
||||||
|
/* Update new_rdn_type if it is an index */
|
||||||
|
|
||||||
|
index_add_values( be, new_rdn_type, bvals, e->e_id );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user