summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-01-16 01:21:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:51 -0500
commit1be1d8046dd198d5038240f4bf1c884db1b74fb6 (patch)
tree92429fe63e05f29cdae22125265a80fe14584e03
parent8ea26bf2fdad4440d65b020943e19128c34c4ed9 (diff)
downloadsamba-1be1d8046dd198d5038240f4bf1c884db1b74fb6.tar.gz
samba-1be1d8046dd198d5038240f4bf1c884db1b74fb6.tar.bz2
samba-1be1d8046dd198d5038240f4bf1c884db1b74fb6.zip
r4766: Add another useful helper function: samdb_msg_set_value()
Andrew Bartlett (This used to be commit a43f7392f791081f227a0e05aeed894885f33232)
-rw-r--r--source4/dsdb/samdb/samdb.c15
1 files changed, 15 insertions, 0 deletions
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
@@ -890,6 +890,21 @@ int samdb_msg_add_value(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, struct ld
}
/*
+ 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
*/
int samdb_msg_set_string(struct ldb_wrap *sam_ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,