diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-08-28 20:02:13 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-08-28 23:38:59 +0300 |
commit | b5ed9c2c4d7cec930a9bb4d1a79561d012879bd1 (patch) | |
tree | f3d857e1339bf83d00e50c310eabc8922e585c48 /source4/dsdb | |
parent | b954834ad1a60f006d0d391f17edbcaac9ed48f2 (diff) | |
download | samba-b5ed9c2c4d7cec930a9bb4d1a79561d012879bd1.tar.gz samba-b5ed9c2c4d7cec930a9bb4d1a79561d012879bd1.tar.bz2 samba-b5ed9c2c4d7cec930a9bb4d1a79561d012879bd1.zip |
s4-kcc: Notify dreplsrv that Topology has changed
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/kcc/kcc_periodic.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c index 4deb9124eb..0955c99354 100644 --- a/source4/dsdb/kcc/kcc_periodic.c +++ b/source4/dsdb/kcc/kcc_periodic.c @@ -33,6 +33,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "librpc/gen_ndr/ndr_drsuapi.h" #include "librpc/gen_ndr/ndr_drsblobs.h" +#include "librpc/gen_ndr/ndr_irpc.h" #include "param/param.h" /* @@ -97,6 +98,24 @@ static bool check_MasterNC(struct kccsrv_partition *p, struct repsFromToBlob *r, } +/** + * Force dreplsrv to update its state as topology is changed + */ +static void kccsrv_notify_drepl_server(struct kccsrv_service *s, + TALLOC_CTX *mem_ctx) +{ + struct dreplsrv_refresh r; + struct server_id *drepl_srv; + + drepl_srv = irpc_servers_byname(s->task->msg_ctx, mem_ctx, "dreplsrv"); + if (!drepl_srv) { + /* dreplsrv is not running yet */ + return; + } + + IRPC_CALL(s->task->msg_ctx, drepl_srv[0], irpc, DREPLSRV_REFRESH, &r, mem_ctx); +} + /* * add any missing repsFrom structures to our partitions */ @@ -105,6 +124,7 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct struct ldb_result *res) { struct kccsrv_partition *p; + bool notify_dreplsrv = false; /* update the repsFrom on all partitions */ for (p=s->partitions; p; p=p->next) { @@ -151,6 +171,8 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct ldb_dn_get_linearized(p->dn), ldb_errstring(s->samdb))); return NT_STATUS_INTERNAL_DB_CORRUPTION; } + /* dreplsrv should refresh its state */ + notify_dreplsrv = true; } werr = dsdb_loadreps(s->samdb, mem_ctx, p->dn, "repsTo", &reps_to, &to_count); @@ -179,9 +201,16 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct ldb_dn_get_linearized(p->dn), ldb_errstring(s->samdb))); return NT_STATUS_INTERNAL_DB_CORRUPTION; } + /* dreplsrv should refresh its state */ + notify_dreplsrv = true; } } + /* notify dreplsrv toplogy has changed */ + if (notify_dreplsrv) { + kccsrv_notify_drepl_server(s, mem_ctx); + } + return NT_STATUS_OK; } |