From 3d5601e0ba256a40a57db41c9ae75f5bef5f5bc2 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 21 Jul 2016 00:34:25 +0100 Subject: [PATCH] Fix a4c7943d39df0140edacb5774e977be3f72b694c Modify/replace was broken if attr didn't already exist --- servers/slapd/back-mdb/modify.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/servers/slapd/back-mdb/modify.c b/servers/slapd/back-mdb/modify.c index 0f8706a4bf..fcabb2acfe 100644 --- a/servers/slapd/back-mdb/modify.c +++ b/servers/slapd/back-mdb/modify.c @@ -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; -- 2.39.5