summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-15 17:38:16 +1100
committerAndrew Tridgell <tridge@samba.org>2010-02-15 18:58:40 +1100
commit4694b4677ac58cd99d005d33aaf8c1b154e63b29 (patch)
treef176af064bfa42396aced51d588e406d03f6f581 /source4
parent6ec6fa0ac4e71f9b14a3cbfef328d50e321b0544 (diff)
downloadsamba-4694b4677ac58cd99d005d33aaf8c1b154e63b29.tar.gz
samba-4694b4677ac58cd99d005d33aaf8c1b154e63b29.tar.bz2
samba-4694b4677ac58cd99d005d33aaf8c1b154e63b29.zip
s4-dsdb: added dsdb_modify_permissive()
This will be used in the drsuapi server
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/common/util.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index d659767138..eb021dfc94 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3360,3 +3360,39 @@ int dsdb_load_udv_v1(struct ldb_context *samdb, struct ldb_dn *dn, TALLOC_CTX *m
talloc_free(v2);
return LDB_SUCCESS;
}
+
+
+/*
+ a modify with the 'permissive' control
+ this means no error for entries that already exist on adds, or
+ removal of entries that don't exist
+*/
+int dsdb_modify_permissive(struct ldb_context *ldb,
+ const struct ldb_message *message)
+{
+ struct ldb_request *req;
+ int ret;
+
+ ret = ldb_build_mod_req(&req, ldb, ldb,
+ message,
+ NULL,
+ NULL,
+ ldb_op_default_callback,
+ NULL);
+
+ if (ret != LDB_SUCCESS) return ret;
+
+ ret = ldb_request_add_control(req, LDB_CONTROL_PERMISSIVE_MODIFY_OID, false, NULL);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(req);
+ return ret;
+ }
+
+ ret = ldb_request(ldb, req);
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+
+ talloc_free(req);
+ return ret;
+}