]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-mdb/modify.c
ITS#7906 better fix
[openldap] / servers / slapd / back-mdb / modify.c
index 44805b6e4e25f21856c48a5a57d375489ab13b12..c08e95cc695e3828c7a734ac194eff8b76bf1432 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2013 The OpenLDAP Foundation.
+ * Copyright 2000-2014 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -389,6 +389,7 @@ int mdb_modify_internal(
                                        ap->a_nvals,
                                        e->e_id, SLAP_INDEX_ADD_OP );
                        } else {
+                               int found = 0;
                                /* if this was only an add, we only need to index
                                 * the added values.
                                 */
@@ -396,6 +397,7 @@ int mdb_modify_internal(
                                        struct berval *vals;
                                        if ( ml->sml_desc != ap->a_desc || !ml->sml_numvals )
                                                continue;
+                                       found = 1;
                                        switch( ml->sml_op ) {
                                        case LDAP_MOD_ADD:
                                        case LDAP_MOD_REPLACE:
@@ -415,6 +417,15 @@ int mdb_modify_internal(
                                        if ( rc )
                                                break;
                                }
+                               /* This attr was affected by a modify of a subtype, so
+                                * there was no direct match in the modlist. Just readd
+                                * all of its values.
+                                */
+                               if ( !found ) {
+                                       rc = mdb_index_values( op, tid, ap->a_desc,
+                                               ap->a_nvals,
+                                               e->e_id, SLAP_INDEX_ADD_OP );
+                               }
                        }
                        if ( rc != LDAP_SUCCESS ) {
                                Debug( LDAP_DEBUG_ANY,