diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-06-25 04:34:42 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-06-25 04:51:59 +0300 |
commit | 163ed44903fd6d9bf3047d0987bcbb8f0a28e7e2 (patch) | |
tree | ab03776e80ddfbcf78ca9a6825fca76a2b8325c2 /source4 | |
parent | e40635c48d4b5853cbf463455e2ec90178375100 (diff) | |
download | samba-163ed44903fd6d9bf3047d0987bcbb8f0a28e7e2.tar.gz samba-163ed44903fd6d9bf3047d0987bcbb8f0a28e7e2.tar.bz2 samba-163ed44903fd6d9bf3047d0987bcbb8f0a28e7e2.zip |
s4/drs: DsReplicaSync should search partition to Sync
by any valid DSName attribute given, be it - partition DN,
partition GUID or partition SID
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/repl/drepl_out_pull.c | 29 | ||||
-rw-r--r-- | source4/dsdb/repl/drepl_service.c | 15 |
2 files changed, 38 insertions, 6 deletions
diff --git a/source4/dsdb/repl/drepl_out_pull.c b/source4/dsdb/repl/drepl_out_pull.c index 329b298d94..c82b48dcbe 100644 --- a/source4/dsdb/repl/drepl_out_pull.c +++ b/source4/dsdb/repl/drepl_out_pull.c @@ -32,6 +32,7 @@ #include "librpc/gen_ndr/ndr_drsuapi.h" #include "librpc/gen_ndr/ndr_drsblobs.h" #include "libcli/composite/composite.h" +#include "libcli/security/dom_sid.h" WERROR dreplsrv_schedule_partition_pull_source(struct dreplsrv_service *s, struct dreplsrv_partition_source_dsa *source, @@ -99,6 +100,34 @@ WERROR dreplsrv_schedule_partition_pull_by_guid(struct dreplsrv_service *s, TALL return WERR_NOT_FOUND; } +/* force an immediate of the specified partition by Naming Context */ +WERROR dreplsrv_schedule_partition_pull_by_nc(struct dreplsrv_service *s, TALLOC_CTX *mem_ctx, + struct drsuapi_DsReplicaObjectIdentifier *nc) +{ + struct dreplsrv_partition *p; + bool valid_sid, valid_guid; + struct dom_sid null_sid; + ZERO_STRUCT(null_sid); + + valid_sid = !dom_sid_equal(&null_sid, &nc->sid); + valid_guid = !GUID_all_zero(&nc->guid); + + if (!valid_sid && !valid_guid && !nc->dn) { + return WERR_DS_DRA_INVALID_PARAMETER; + } + + for (p = s->partitions; p; p = p->next) { + if ((valid_guid && GUID_equal(&p->nc.guid, &nc->guid)) + || strequal(p->nc.dn, nc->dn) + || (valid_sid && dom_sid_equal(&p->nc.sid, &nc->sid))) { + return dreplsrv_schedule_partition_pull(s, p, mem_ctx); + } + } + + return WERR_DS_DRA_BAD_NC; +} + + static void dreplsrv_pending_op_callback(struct tevent_req *subreq) { struct dreplsrv_out_operation *op = tevent_req_callback_data(subreq, diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 59436d6c0c..e48ae3e563 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -110,16 +110,19 @@ static NTSTATUS drepl_replica_sync(struct irpc_message *msg, { struct dreplsrv_service *service = talloc_get_type(msg->private_data, struct dreplsrv_service); - struct GUID *guid = &r->in.req->req1.naming_context->guid; + struct drsuapi_DsReplicaObjectIdentifier *nc = r->in.req->req1.naming_context; - r->out.result = dreplsrv_schedule_partition_pull_by_guid(service, msg, guid); + r->out.result = dreplsrv_schedule_partition_pull_by_nc(service, msg, nc); if (W_ERROR_IS_OK(r->out.result)) { - DEBUG(3,("drepl_replica_sync: forcing sync of partition %s\n", - GUID_string(msg, guid))); + DEBUG(3,("drepl_replica_sync: forcing sync of partition (%s, %s)\n", + GUID_string(msg, &nc->guid), + nc->dn)); dreplsrv_run_pending_ops(service); } else { - DEBUG(3,("drepl_replica_sync: failed setup of sync of partition %s - %s\n", - GUID_string(msg, guid), win_errstr(r->out.result))); + DEBUG(3,("drepl_replica_sync: failed setup of sync of partition (%s, %s) - %s\n", + GUID_string(msg, &nc->guid), + nc->dn, + win_errstr(r->out.result))); } return NT_STATUS_OK; } |