Author: tridge
Date: 2004-12-06 06:45:51 +0000 (Mon, 06 Dec 2004)
New Revision: 4071

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4071

Log:
- 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




Modified:
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c
   branches/SAMBA_4_0/source/lib/ldb/tests/test-modify.ldif
   branches/SAMBA_4_0/source/lib/ldb/tests/test.ldif


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c 2004-12-05 16:29:27 UTC 
(rev 4070)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c 2004-12-06 06:45:51 UTC 
(rev 4071)
@@ -516,8 +516,13 @@
                           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;

Modified: branches/SAMBA_4_0/source/lib/ldb/tests/test-modify.ldif
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/tests/test-modify.ldif    2004-12-05 
16:29:27 UTC (rev 4070)
+++ branches/SAMBA_4_0/source/lib/ldb/tests/test-modify.ldif    2004-12-06 
06:45:51 UTC (rev 4071)
@@ -4,6 +4,9 @@
 add: drink
 drink: mango lassi
 -
+add: drink
+drink: lemonade
+-
 delete: pager
 -
 replace: telephonenumber

Modified: branches/SAMBA_4_0/source/lib/ldb/tests/test.ldif
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/tests/test.ldif   2004-12-05 16:29:27 UTC 
(rev 4070)
+++ branches/SAMBA_4_0/source/lib/ldb/tests/test.ldif   2004-12-06 06:45:51 UTC 
(rev 4071)
@@ -409,8 +409,8 @@
 seealso: cn=All Staff,ou=Groups,o=University of Michigan,c=US
 homepostaladdress: 123 Anystreet $ Ann Arbor, MI 48104
 mail: [EMAIL PROTECTED]
-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

Reply via email to