1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s4:dsdb: passdown DSDB_CONTROL_REPLICATED_UPDATE_OID for replicated updates

We need to make sure replicated updates are handled differently
in some situations, e.g. we should bypass the schema checks.

metze
This commit is contained in:
Stefan Metzmacher 2008-09-27 02:27:54 +02:00
parent a9a59f5f3d
commit ee2bcfacdf
4 changed files with 39 additions and 3 deletions

View File

@ -58,6 +58,9 @@ struct replmd_replicated_request {
struct dsdb_extended_replicated_objects *objs;
/* the controls we pass down */
struct ldb_control **controls;
uint32_t index_current;
struct {
@ -700,7 +703,7 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
ar->module->ldb,
ar->sub.mem_ctx,
msg,
NULL,
ar->controls,
ar,
replmd_replicated_apply_add_callback);
if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
@ -951,7 +954,7 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
ar->module->ldb,
ar->sub.mem_ctx,
msg,
NULL,
ar->controls,
ar,
replmd_replicated_apply_merge_callback);
if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
@ -1379,7 +1382,7 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
ar->module->ldb,
ar->sub.mem_ctx,
msg,
NULL,
ar->controls,
ar,
replmd_replicated_uptodate_modify_callback);
if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
@ -1491,6 +1494,8 @@ static int replmd_extended_replicated_objects(struct ldb_module *module, struct
{
struct dsdb_extended_replicated_objects *objs;
struct replmd_replicated_request *ar;
struct ldb_control **ctrls;
int ret;
ldb_debug(module->ldb, LDB_DEBUG_TRACE, "replmd_extended_replicated_objects\n");
@ -1511,6 +1516,22 @@ static int replmd_extended_replicated_objects(struct ldb_module *module, struct
return LDB_ERR_OPERATIONS_ERROR;
}
ctrls = req->controls;
if (req->controls) {
req->controls = talloc_memdup(ar, req->controls,
talloc_get_size(req->controls));
if (!req->controls) return replmd_replicated_request_werror(ar, WERR_NOMEM);
}
ret = ldb_request_add_control(req, DSDB_CONTROL_REPLICATED_UPDATE_OID, false, NULL);
if (ret != LDB_SUCCESS) {
return ret;
}
ar->controls = req->controls;
req->controls = ctrls;
#ifdef REPLMD_FULL_ASYNC /* TODO: activate this code when ldb support full async code */
return replmd_replicated_apply_next(ar);
#else

View File

@ -152,6 +152,16 @@ static int schema_fsmo_add(struct ldb_module *module, struct ldb_request *req)
uint32_t id32;
WERROR status;
/* special objects should always go through */
if (ldb_dn_is_special(req->op.add.message->dn)) {
return ldb_next_request(module, req);
}
/* replicated update should always go through */
if (ldb_request_get_control(req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
return ldb_next_request(module, req);
}
schema = dsdb_get_schema(module->ldb);
if (!schema) {
return ldb_next_request(module, req);

View File

@ -56,6 +56,9 @@ struct dsdb_control_current_partition {
struct ldb_module *module;
};
#define DSDB_CONTROL_REPLICATED_UPDATE_OID "1.3.6.1.4.1.7165.4.3.3"
/* DSDB_CONTROL_REPLICATED_UPDATE_OID has NULL data */
#define DSDB_EXTENDED_REPLICATED_OBJECTS_OID "1.3.6.1.4.1.7165.4.4.1"
struct dsdb_extended_replicated_object {
struct ldb_message *msg;

View File

@ -174,6 +174,8 @@ oMSyntax: 20
#Allocated: DSDB_CONTROL_CURRENT_PARTITION_OID 1.3.6.1.4.1.7165.4.3.2
#Allocated: DSDB_CONTROL_REPLICATED_UPDATE_OID 1.3.6.1.4.1.7165.4.3.3
#Allocated: DSDB_EXTENDED_REPLICATED_OBJECTS_OID 1.3.6.1.4.1.7165.4.4.1
#Allocated: (middleName) attributeID: 1.3.6.1.4.1.7165.4.255.1