]> git.sur5r.net Git - openldap/commitdiff
Fix a4c7943d39df0140edacb5774e977be3f72b694c
authorHoward Chu <hyc@openldap.org>
Wed, 20 Jul 2016 23:34:25 +0000 (00:34 +0100)
committerHoward Chu <hyc@openldap.org>
Wed, 20 Jul 2016 23:36:32 +0000 (00:36 +0100)
Modify/replace was broken if attr didn't already exist

servers/slapd/back-mdb/modify.c

index 0f8706a4bfeb99216b0b780f55d43fc16c396c69..fcabb2acfee4b869fd6290f4a8e9e1d24818065d 100644 (file)
@@ -277,14 +277,19 @@ do_del:
                                        err = mdb_mval_del( op, mvc, e->e_id, anew );
                                        if (err)
                                                break;
-                                       anew = attr_find( e->e_attrs, mod->sm_desc );
-                                       if (mod->sm_numvals >= mdb->mi_multi_lo) {
-                                               anew->a_flags |= SLAP_ATTR_BIG_MULTI;
-                                               err = mdb_mval_put(op, mvc, e->e_id, anew);
-                                       } else if (anew) {
-                                               /* revert back to normal attr */
-                                               anew->a_flags &= ~SLAP_ATTR_BIG_MULTI;
+                               }
+                               anew = attr_find( e->e_attrs, mod->sm_desc );
+                               if (mod->sm_numvals >= mdb->mi_multi_lo) {
+                                       anew->a_flags |= SLAP_ATTR_BIG_MULTI;
+                                       if (!mvc) {
+                                               err = mdb_cursor_open( tid, mdb->mi_dbis[MDB_ID2VAL], &mvc );
+                                               if (err)
+                                                       break;
                                        }
+                                       err = mdb_mval_put(op, mvc, e->e_id, anew);
+                               } else if (anew) {
+                                       /* revert back to normal attr */
+                                       anew->a_flags &= ~SLAP_ATTR_BIG_MULTI;
                                }
                        }
                        break;