summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/ldb/common/ldb_msg.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 5681d5228e..a2a1ba8110 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -187,15 +187,21 @@ int ldb_msg_add(struct ldb_message *msg,
const struct ldb_message_element *el,
int flags)
{
+ int ret;
+ struct ldb_message_element *el_new;
/* We have to copy this, just in case *el is a pointer into
* what ldb_msg_add_empty() is about to realloc() */
struct ldb_message_element el_copy = *el;
- if (ldb_msg_add_empty(msg, el->name, flags, NULL) != LDB_SUCCESS) {
- return LDB_ERR_OPERATIONS_ERROR;
+
+ ret = _ldb_msg_add_el(msg, &el_new);
+ if (ret != LDB_SUCCESS) {
+ return ret;
}
- msg->elements[msg->num_elements-1] = el_copy;
- msg->elements[msg->num_elements-1].flags = flags;
+ el_new->flags = flags;
+ el_new->name = el_copy.name;
+ el_new->num_values = el_copy.num_values;
+ el_new->values = el_copy.values;
return LDB_SUCCESS;
}