]> git.sur5r.net Git - openldap/commitdiff
allow empty modlist
authorPierangelo Masarati <ando@openldap.org>
Tue, 25 Apr 2006 19:51:38 +0000 (19:51 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 25 Apr 2006 19:51:38 +0000 (19:51 +0000)
servers/slapd/back-ldif/ldif.c

index 3cd9bcb78a1002ea599ea72ca6bd44494e559d89..a8a5f56c325926d0f5b1ca5ae6ad268c78f16cc4 100644 (file)
@@ -509,7 +509,8 @@ static int apply_modify_to_entry(Entry * entry,
                                SlapReply * rs)
 {
        char textbuf[SLAP_TEXT_BUFLEN];
-       int rc = LDAP_UNWILLING_TO_PERFORM;
+       int rc = modlist ? LDAP_UNWILLING_TO_PERFORM : LDAP_SUCCESS;
+       int is_oc = 0;
        Modification *mods = NULL;
 
        if (!acl_check_modlist(op, entry, modlist)) {
@@ -519,6 +520,9 @@ static int apply_modify_to_entry(Entry * entry,
        for (; modlist != NULL; modlist = modlist->sml_next) {
                mods = &modlist->sml_mod;
 
+               if ( mods->sm_desc == slap_schema.si_ad_objectClass ) {
+                       is_oc = 1;
+               }
                switch (mods->sm_op) {
                case LDAP_MOD_ADD:
                        rc = modify_add_values(entry, mods,
@@ -568,13 +572,14 @@ static int apply_modify_to_entry(Entry * entry,
        }
        
        if(rc == LDAP_SUCCESS) {
-               if ( mods->sm_desc == slap_schema.si_ad_objectClass ) {
+               if ( is_oc ) {
                        entry->e_ocflags = 0;
                }
                /* check that the entry still obeys the schema */
-               rc = entry_schema_check(op, entry, NULL, 0,
+               rc = entry_schema_check( op, entry, NULL, 0,
                          &rs->sr_text, textbuf, sizeof( textbuf ) );
        }
+
        return rc;
 }