svn commit: samba r4766 - in branches/SAMBA_4_0/source/dsdb/samdb: .

abartlet at samba.org abartlet at samba.org
Sun Jan 16 01:22:00 GMT 2005


Author: abartlet
Date: 2005-01-16 01:21:58 +0000 (Sun, 16 Jan 2005)
New Revision: 4766

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4766

Log:
Add another useful helper function: samdb_msg_set_value()

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/samdb.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/samdb.c	2005-01-16 01:21:18 UTC (rev 4765)
+++ branches/SAMBA_4_0/source/dsdb/samdb/samdb.c	2005-01-16 01:21:58 UTC (rev 4766)
@@ -890,6 +890,21 @@
 }
 
 /*
+  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,



More information about the samba-cvs mailing list