diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-12-06 06:45:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:06:22 -0500 |
commit | a42dba94d0d6d8203d845f771817d4e48b8c5205 (patch) | |
tree | 112ad4bd4338c28eadc2283979b07d9e60a650bb | |
parent | f99c93ec57691a393b4ae5ba57176b98f33efc17 (diff) | |
download | samba-a42dba94d0d6d8203d845f771817d4e48b8c5205.tar.gz samba-a42dba94d0d6d8203d845f771817d4e48b8c5205.tar.bz2 samba-a42dba94d0d6d8203d845f771817d4e48b8c5205.zip |
r4071: - ldap does allow adding additional attribute values with a modify
operation, but not if the value already exists
- fixed syntax of test.ldif for ldap backend
(This used to be commit 29225d0bec39038e42e68849bd9378898f062081)
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 9 | ||||
-rw-r--r-- | source4/lib/ldb/tests/test-modify.ldif | 3 | ||||
-rw-r--r-- | source4/lib/ldb/tests/test.ldif | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 4049900a23..6623fd0052 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -516,8 +516,13 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms already exists */ ret = find_element(&msg2, msg->elements[i].name); if (ret != -1) { - ltdb->last_err_string = "Attribute exists"; - goto failed; + for (j=0;j<msg->elements[i].num_values;j++) { + if (ldb_msg_find_val(&msg2.elements[ret], + &msg->elements[i].values[j])) { + ltdb->last_err_string = "Type or value exists"; + goto failed; + } + } } if (msg_add_element(ldb, &msg2, &msg->elements[i]) != 0) { goto failed; diff --git a/source4/lib/ldb/tests/test-modify.ldif b/source4/lib/ldb/tests/test-modify.ldif index 78d8353d3c..37ef8293e6 100644 --- a/source4/lib/ldb/tests/test-modify.ldif +++ b/source4/lib/ldb/tests/test-modify.ldif @@ -4,6 +4,9 @@ changetype: modify add: drink drink: mango lassi - +add: drink +drink: lemonade +- delete: pager - replace: telephonenumber diff --git a/source4/lib/ldb/tests/test.ldif b/source4/lib/ldb/tests/test.ldif index b9afad8b63..8d6c0c750e 100644 --- a/source4/lib/ldb/tests/test.ldif +++ b/source4/lib/ldb/tests/test.ldif @@ -409,8 +409,8 @@ postaladdress: Alumni Association $ 111 Maple St $ Ann Arbor, MI 48109 seealso: cn=All Staff,ou=Groups,o=University of Michigan,c=US homepostaladdress: 123 Anystreet $ Ann Arbor, MI 48104 mail: uham@mail.alumni.example.com -seeAlso: a long attribute name, longer than 128 bytes so that we - trigger sign extension problems in tdb_pack, no thats not long enough +description: a long attribute name, longer than 128 bytes so that we + trigger sign extension problems in tdb_pack, no thats not long enough yet, maybe this is. I'll just keep going till it triggers the error homephone: +1 313 555 8421 pager: +1 313 555 2844 |