summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/util.c
diff options
context:
space:
mode:
authorAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2010-05-04 11:49:18 +0200
committerAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2010-05-04 18:32:18 +0200
commitf84aeea7399eec38f7906dedaf3652af48c3d184 (patch)
tree1bd0d1f8757053ab5b2fa779d5c5464626b42994 /source4/dsdb/samdb/ldb_modules/util.c
parentbcdaa23798f74cdec8973201a849f562929ea416 (diff)
downloadsamba-f84aeea7399eec38f7906dedaf3652af48c3d184.tar.gz
samba-f84aeea7399eec38f7906dedaf3652af48c3d184.tar.bz2
samba-f84aeea7399eec38f7906dedaf3652af48c3d184.zip
s4/rodc: Support read-only database
Check on modify if we are RODC and return referral. On the ldap backend side now we pass context and ldb_modify_default_callback to propagate the referral error to the client.
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/util.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 18631c4350..c233df7216 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -243,12 +243,18 @@ int dsdb_module_modify(struct ldb_module *module,
int ret;
struct ldb_context *ldb = ldb_module_get_ctx(module);
TALLOC_CTX *tmp_ctx = talloc_new(module);
+ struct ldb_result *res;
+
+ res = talloc_zero(tmp_ctx, struct ldb_result);
+ if (!res) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
ret = ldb_build_mod_req(&mod_req, ldb, tmp_ctx,
message,
NULL,
- NULL,
- ldb_op_default_callback,
+ res,
+ ldb_modify_default_callback,
NULL);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
@@ -292,13 +298,19 @@ int dsdb_module_rename(struct ldb_module *module,
int ret;
struct ldb_context *ldb = ldb_module_get_ctx(module);
TALLOC_CTX *tmp_ctx = talloc_new(module);
+ struct ldb_result *res;
+
+ res = talloc_zero(tmp_ctx, struct ldb_result);
+ if (!res) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
ret = ldb_build_rename_req(&req, ldb, tmp_ctx,
olddn,
newdn,
NULL,
- NULL,
- ldb_op_default_callback,
+ res,
+ ldb_modify_default_callback,
NULL);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
@@ -340,12 +352,18 @@ int dsdb_module_add(struct ldb_module *module,
int ret;
struct ldb_context *ldb = ldb_module_get_ctx(module);
TALLOC_CTX *tmp_ctx = talloc_new(module);
+ struct ldb_result *res;
+
+ res = talloc_zero(tmp_ctx, struct ldb_result);
+ if (!res) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
ret = ldb_build_add_req(&req, ldb, tmp_ctx,
message,
NULL,
- NULL,
- ldb_op_default_callback,
+ res,
+ ldb_modify_default_callback,
NULL);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
@@ -717,6 +735,7 @@ int dsdb_module_save_partition_usn(struct ldb_module *module, struct ldb_dn *dn,
struct ldb_message *msg;
struct dsdb_control_current_partition *p_ctrl;
int ret;
+ struct ldb_result *res;
msg = ldb_msg_new(module);
if (msg == NULL) {
@@ -729,6 +748,11 @@ int dsdb_module_save_partition_usn(struct ldb_module *module, struct ldb_dn *dn,
return LDB_ERR_OPERATIONS_ERROR;
}
+ res = talloc_zero(msg, struct ldb_result);
+ if (!res) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
ret = ldb_msg_add_fmt(msg, "uSNHighest", "%llu", (unsigned long long)uSN);
if (ret != LDB_SUCCESS) {
talloc_free(msg);
@@ -754,11 +778,11 @@ int dsdb_module_save_partition_usn(struct ldb_module *module, struct ldb_dn *dn,
}
p_ctrl->version = DSDB_CONTROL_CURRENT_PARTITION_VERSION;
p_ctrl->dn = dn;
-
ret = ldb_build_mod_req(&req, ldb, msg,
msg,
NULL,
- NULL, ldb_op_default_callback,
+ res,
+ ldb_modify_default_callback,
NULL);
again:
if (ret != LDB_SUCCESS) {
@@ -784,7 +808,8 @@ again:
ret = ldb_build_add_req(&req, ldb, msg,
msg,
NULL,
- NULL, ldb_op_default_callback,
+ res,
+ ldb_modify_default_callback,
NULL);
goto again;
}