summaryrefslogtreecommitdiff
path: root/source4/dsdb/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-16 14:29:07 +1100
committerAndrew Tridgell <tridge@samba.org>2010-02-16 21:10:50 +1100
commitc6d85d67f9b52e4071c84749a1f55de646a5451c (patch)
treed28b42d5183e54ad1ec16d8ebd9f28ecce6f5723 /source4/dsdb/common
parent67950c27e473ebf8f7f81ef0ef92d2bd7931622a (diff)
downloadsamba-c6d85d67f9b52e4071c84749a1f55de646a5451c.tar.gz
samba-c6d85d67f9b52e4071c84749a1f55de646a5451c.tar.bz2
samba-c6d85d67f9b52e4071c84749a1f55de646a5451c.zip
s4-dsdb: replace dsdb_modify_permissive() with dsdb_modify() and dsdb_flags
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r--source4/dsdb/common/util.c78
-rw-r--r--source4/dsdb/common/util.h1
2 files changed, 41 insertions, 38 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index dab46f01e5..12185f999d 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3362,44 +3362,6 @@ int dsdb_load_udv_v1(struct ldb_context *samdb, struct ldb_dn *dn, TALLOC_CTX *m
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;
-}
-
-
-
/*
add a set of controls to a ldb_request structure based on a set of
flags. See util.h for a list of available flags
@@ -3465,5 +3427,45 @@ int dsdb_request_add_controls(struct ldb_request *req, uint32_t dsdb_flags)
}
}
+ if (dsdb_flags & DSDB_MODIFY_PERMISSIVE) {
+ ret = ldb_request_add_control(req, LDB_CONTROL_PERMISSIVE_MODIFY_OID, false, NULL);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+
return LDB_SUCCESS;
}
+
+/*
+ a modify with a set of controls
+*/
+int dsdb_modify(struct ldb_context *ldb, const struct ldb_message *message,
+ uint32_t dsdb_flags)
+{
+ 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 = dsdb_request_add_controls(req, dsdb_flags);
+ 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;
+}
diff --git a/source4/dsdb/common/util.h b/source4/dsdb/common/util.h
index 9152ac4220..590653acc2 100644
--- a/source4/dsdb/common/util.h
+++ b/source4/dsdb/common/util.h
@@ -29,3 +29,4 @@
#define DSDB_SEARCH_REVEAL_INTERNALS 0x0008
#define DSDB_SEARCH_SHOW_EXTENDED_DN 0x0010
#define DSDB_MODIFY_RELAX 0x0020
+#define DSDB_MODIFY_PERMISSIVE 0x0040