1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

repl_meta_data: Cope with the strange but unusual case of isDeleted: FALSE in replmd_process_linked_attribute()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13448

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2018-05-30 10:06:54 +12:00
parent 9564adb66f
commit 5ea111471a

View File

@ -7249,6 +7249,19 @@ linked_attributes[0]:
return LDB_ERR_OPERATIONS_ERROR;
}
/*
* All attributes listed here must be dealt with in some way
* by replmd_process_linked_attribute() otherwise in the case
* of isDeleted: FALSE the modify will fail with:
*
* Failed to apply linked attribute change 'attribute 'isDeleted':
* invalid modify flags on
* 'CN=g1_1527570609273,CN=Users,DC=samba,DC=example,DC=com':
* 0x0'
*
* This is becaue isDeleted is a Boolean, so FALSE is a
* legitimate value (set by Samba's deletetest.py)
*/
attrs[0] = attr->lDAPDisplayName;
attrs[1] = "isDeleted";
attrs[2] = "isRecycled";
@ -7629,6 +7642,9 @@ static int replmd_process_linked_attribute(struct ldb_module *module,
* recycled and tombstone objects. We don't have to delete
* any existing link, that should have happened when the
* object deletion was replicated or initiated.
*
* This needs isDeleted and isRecycled to be included as
* attributes in the search and so in msg if set.
*/
replmd_deletion_state(module, msg, &deletion_state, NULL);
@ -7637,6 +7653,24 @@ static int replmd_process_linked_attribute(struct ldb_module *module,
return LDB_SUCCESS;
}
/*
* Now that we know the deletion_state, remove the extra
* attributes added for that purpose. We need to do this
* otherwise in the case of isDeleted: FALSE the modify will
* fail with:
*
* Failed to apply linked attribute change 'attribute 'isDeleted':
* invalid modify flags on
* 'CN=g1_1527570609273,CN=Users,DC=samba,DC=example,DC=com':
* 0x0'
*
* This is becaue isDeleted is a Boolean, so FALSE is a
* legitimate value (set by Samba's deletetest.py)
*/
ldb_msg_remove_attr(msg, "isDeleted");
ldb_msg_remove_attr(msg, "isRecycled");
old_el = ldb_msg_find_element(msg, attr->lDAPDisplayName);
if (old_el == NULL) {
ret = ldb_msg_add_empty(msg, attr->lDAPDisplayName, LDB_FLAG_MOD_REPLACE, &old_el);