From 1be1d8046dd198d5038240f4bf1c884db1b74fb6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 16 Jan 2005 01:21:58 +0000 Subject: r4766: Add another useful helper function: samdb_msg_set_value() Andrew Bartlett (This used to be commit a43f7392f791081f227a0e05aeed894885f33232) --- source4/dsdb/samdb/samdb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source4') diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 81ce05d9fe..4edc1a652a 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -889,6 +889,21 @@ int samdb_msg_add_value(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, struct ld return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, val); } +/* + sets a general value element to a message +*/ +int samdb_msg_set_value(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg, + const char *attr_name, const struct ldb_val *val) +{ + struct ldb_message_element *el; + + el = ldb_msg_find_element(msg, attr_name); + if (el) { + el->num_values = 0; + } + return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, val); +} + /* set a string element in a message */ -- cgit