[Date Prev][Date Next] [Chronological] [Thread] [Top]

assert() in back-ldbm/modify.c (ITS#1833)



Full_Name: Simon Wilkinson
Version: 2.1.1beta1
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (213.122.44.35)


In both 2.1.1beta1 and CVS head attempting to create by modify an entry
containing 
duplicate values in an attribute where the syntax forbids it results in an 
assert in back-ldbm/modify.c at line 113.

To reproduce, do the following:

[host]sxw: ldapadd -h ldapmaster
dn: cn=test,ou=Capabilities,dc=inf,dc=ed,dc=ac,dc=uk
objectClass: top
objectClass: groupOfNames
cn: test
member: uid=sxw, ou=People, dc=inf,dc=ed,dc=ac,dc=uk

[host]sxw: ldapmodify -r -h stapag.inf.ed.ac.uk
dn: cn=test,ou=Capabilities,dc=inf,dc=ed,dc=ac,dc=uk
member: uid=sxw, ou=People,dc=inf,dc=ed,dc=ac,dc=uk
member: uid=sxw, ou=People,dc=inf,dc=ed,dc=ac,dc=uk

At this point the LDAP server assert()s in back-ldbm/modify.c:113

A simple fix would appear to be to remove the assertion, which seems
to result in the error code being passed back to the user, as would
seem correct.

--- back-ldbm/modify.c~ Mon Apr 15 16:22:01 2002
+++ back-ldbm/modify.c  Wed May 22 19:27:20 2002
@@ -110,7 +110,6 @@
 #endif
 
                        rc = modify_replace_values( e, mod, text, textbuf,
textlen );
-                       assert( rc != LDAP_TYPE_OR_VALUE_EXISTS );
                        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,

There's also some additional fixes which can return better errors to the user,
but there seems to be a lot of duplicated code between add.c (which has the
better messages) and mods.c (which doesn't).