summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2004-12-26 18:02:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:39 -0500
commit77529ae7926e2d299e7703c5f1b84cb849b4563b (patch)
treec5ea5655b243b8941d1aa2c1c655d133699338ef /source4/dsdb/samdb
parentb29b10e48ee351c19cb7a0e9766718fa1715f747 (diff)
downloadsamba-77529ae7926e2d299e7703c5f1b84cb849b4563b.tar.gz
samba-77529ae7926e2d299e7703c5f1b84cb849b4563b.tar.bz2
samba-77529ae7926e2d299e7703c5f1b84cb849b4563b.zip
r4367: Implement samr_AddGroupMember, samr_DeleteGroupMember and
samr_QueryGroupMember. Volker (This used to be commit 43581c3711d2eeb901094acebea294a3b87d4c0b)
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/samdb.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 209599b9dc..2fcc71a8a9 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -711,6 +711,60 @@ int samdb_msg_add_delete(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg
}
/*
+ add a add attribute value to a message
+*/
+int samdb_msg_add_addval(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
+ const char *attr_name, const char *value)
+{
+ struct ldb_wrap *sam_ctx = ctx;
+ struct ldb_message_element *el;
+ char *a, *v;
+ int ret;
+ a = talloc_strdup(mem_ctx, attr_name);
+ if (a == NULL)
+ return -1;
+ v = talloc_strdup(mem_ctx, value);
+ if (v == NULL)
+ return -1;
+ ldb_set_alloc(sam_ctx->ldb, talloc_realloc_fn, mem_ctx);
+ ret = ldb_msg_add_string(sam_ctx->ldb, msg, a, v);
+ if (ret != 0)
+ return ret;
+ el = ldb_msg_find_element(msg, a);
+ if (el == NULL)
+ return -1;
+ el->flags = LDB_FLAG_MOD_ADD;
+ return 0;
+}
+
+/*
+ add a delete attribute value to a message
+*/
+int samdb_msg_add_delval(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
+ const char *attr_name, const char *value)
+{
+ struct ldb_wrap *sam_ctx = ctx;
+ struct ldb_message_element *el;
+ char *a, *v;
+ int ret;
+ a = talloc_strdup(mem_ctx, attr_name);
+ if (a == NULL)
+ return -1;
+ v = talloc_strdup(mem_ctx, value);
+ if (v == NULL)
+ return -1;
+ ldb_set_alloc(sam_ctx->ldb, talloc_realloc_fn, mem_ctx);
+ ret = ldb_msg_add_string(sam_ctx->ldb, msg, a, v);
+ if (ret != 0)
+ return ret;
+ el = ldb_msg_find_element(msg, a);
+ if (el == NULL)
+ return -1;
+ el->flags = LDB_FLAG_MOD_DELETE;
+ return 0;
+}
+
+/*
add a uint_t element to a message
*/
int samdb_msg_add_uint(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,