summaryrefslogtreecommitdiff
path: root/source4/rpc_server/samr/samdb.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-22 00:53:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:51 -0500
commit32de5979810f472d25f8efcd10c15719d48b7393 (patch)
tree8506ef6c3a5ea45580955b160d261687f97b08f0 /source4/rpc_server/samr/samdb.c
parent054453b5849d97bb244e3e45b5d5f92155311f8b (diff)
downloadsamba-32de5979810f472d25f8efcd10c15719d48b7393.tar.gz
samba-32de5979810f472d25f8efcd10c15719d48b7393.tar.bz2
samba-32de5979810f472d25f8efcd10c15719d48b7393.zip
r812: added a new samdb_replace() call that simplifies the code in the main samr server a bit.
(This used to be commit 255d6e77e705bb7a94e6738c9f48f9d8c625883c)
Diffstat (limited to 'source4/rpc_server/samr/samdb.c')
-rw-r--r--source4/rpc_server/samr/samdb.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c
index c9d7d601b2..a0591af451 100644
--- a/source4/rpc_server/samr/samdb.c
+++ b/source4/rpc_server/samr/samdb.c
@@ -705,7 +705,9 @@ int samdb_msg_add_delete(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg
return -1;
}
ldb_set_alloc(sam_ctx->ldb, samdb_alloc, mem_ctx);
- return ldb_msg_add_empty(sam_ctx->ldb, msg, a, LDB_FLAG_MOD_DELETE);
+ /* we use an empty replace rather than a delete, as it allows for
+ samdb_replace() to be used everywhere */
+ return ldb_msg_add_empty(sam_ctx->ldb, msg, a, LDB_FLAG_MOD_REPLACE);
}
/*
@@ -855,6 +857,22 @@ int samdb_modify(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg)
}
/*
+ replace elements in a record
+*/
+int samdb_replace(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg)
+{
+ int i;
+
+ /* mark all the message elements as LDB_FLAG_MOD_REPLACE */
+ for (i=0;i<msg->num_elements;i++) {
+ msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
+ }
+
+ /* modify the samdb record */
+ return samdb_modify(ctx, mem_ctx, msg);
+}
+
+/*
check that a password is sufficiently complex
*/
static BOOL samdb_password_complexity_ok(const char *pass)