1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

s4-dsdb: added dsdb_modify_permissive()

This will be used in the drsuapi server
This commit is contained in:
Andrew Tridgell 2010-02-15 17:38:16 +11:00
parent 6ec6fa0ac4
commit 4694b4677a

View File

@ -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;
}