summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-22 00:52:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:51 -0500
commit054453b5849d97bb244e3e45b5d5f92155311f8b (patch)
tree55ed24e234074b7c737730f34ee758b9779acd6c /source4/lib/ldb/ldb_tdb
parentb047b71b45d8a7718373d336b52365f884716b65 (diff)
downloadsamba-054453b5849d97bb244e3e45b5d5f92155311f8b.tar.gz
samba-054453b5849d97bb244e3e45b5d5f92155311f8b.tar.bz2
samba-054453b5849d97bb244e3e45b5d5f92155311f8b.zip
r811: make the ldb_modify REPLACE semantics better match LDAP (ie. no error
on the attribute not existing and allow an empty replace) (This used to be commit 1418b667d9041430786089713eafee63dd7b4a28)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 09d1618ffc..d60504ff17 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -501,13 +501,12 @@ int ltdb_modify_internal(struct ldb_context *ldb, const struct ldb_message *msg)
case LDB_FLAG_MOD_REPLACE:
/* replace all elements of this attribute name with the elements
- listed */
- if (msg_delete_attribute(ldb, &msg2, msg->elements[i].name) != 0) {
- ltdb->last_err_string = "No such attribute";
- goto failed;
- }
- /* add the replacement element */
- if (msg_add_element(ldb, &msg2, &msg->elements[i]) != 0) {
+ listed. The attribute not existing is not an error */
+ msg_delete_attribute(ldb, &msg2, msg->elements[i].name);
+
+ /* add the replacement element, if not empty */
+ if (msg->elements[i].num_values != 0 &&
+ msg_add_element(ldb, &msg2, &msg->elements[i]) != 0) {
goto failed;
}
break;