summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-06 19:11:58 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-07 08:59:28 +0200
commitc9da3122c845054e93f25c723f4dd9791bfbd853 (patch)
tree8701c8240136249c945df3f61d6d63f0c0e65d1b
parent321bb40a2e597e46101949737d0bec0561a877ea (diff)
downloadsamba-c9da3122c845054e93f25c723f4dd9791bfbd853.tar.gz
samba-c9da3122c845054e93f25c723f4dd9791bfbd853.tar.bz2
samba-c9da3122c845054e93f25c723f4dd9791bfbd853.zip
s4:dsdb/common/util.c - provide message set functions for integer types
They will be used by the samldb LDB module
-rw-r--r--source4/dsdb/common/util.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index faf2fb5f96..71215212fc 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1102,6 +1102,37 @@ int samdb_msg_set_string(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struc
}
/*
+ * sets a signed integer in a message
+ */
+int samdb_msg_set_int(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx,
+ struct ldb_message *msg, const char *attr_name, int v)
+{
+ struct ldb_message_element *el;
+
+ el = ldb_msg_find_element(msg, attr_name);
+ if (el) {
+ el->num_values = 0;
+ }
+ return samdb_msg_add_int(sam_ldb, mem_ctx, msg, attr_name, v);
+}
+
+/*
+ * sets an unsigned integer in a message
+ */
+int samdb_msg_set_uint(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx,
+ struct ldb_message *msg, const char *attr_name,
+ unsigned int v)
+{
+ struct ldb_message_element *el;
+
+ el = ldb_msg_find_element(msg, attr_name);
+ if (el) {
+ el->num_values = 0;
+ }
+ return samdb_msg_add_uint(sam_ldb, mem_ctx, msg, attr_name, v);
+}
+
+/*
* Handle ldb_request in transaction
*/
static int dsdb_autotransaction_request(struct ldb_context *sam_ldb,