From 0a4746a20085a21bd8f28faf13bc5168f3ad5afb Mon Sep 17 00:00:00 2001 From: Dave Craft Date: Sun, 4 Dec 2011 11:06:47 -0600 Subject: Invocation of samba_kcc from KCC task Modification to periodic and explicit invocation paths of the KCC topology generation code. Managed via samba_runcmd_send() API. The samba_kcc script is invoked if (kccsrv:samba_kcc = true) appears in smb.conf Signed-off-by: Andrew Tridgell --- source4/dsdb/kcc/kcc_service.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'source4/dsdb/kcc/kcc_service.c') diff --git a/source4/dsdb/kcc/kcc_service.c b/source4/dsdb/kcc/kcc_service.c index 5f7b537d14..ac19522698 100644 --- a/source4/dsdb/kcc/kcc_service.c +++ b/source4/dsdb/kcc/kcc_service.c @@ -144,16 +144,18 @@ static WERROR kccsrv_load_partitions(struct kccsrv_service *s) static NTSTATUS kccsrv_execute_kcc(struct irpc_message *msg, struct drsuapi_DsExecuteKCC *r) { TALLOC_CTX *mem_ctx; - NTSTATUS status; + NTSTATUS status = NT_STATUS_OK; struct kccsrv_service *service = talloc_get_type(msg->private_data, struct kccsrv_service); mem_ctx = talloc_new(service); - status = kccsrv_simple_update(service, mem_ctx); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("kccsrv_simple_update failed - %s\n", nt_errstr(status))); - talloc_free(mem_ctx); - return status; + if (service->samba_kcc_code) + status = kccsrv_samba_kcc(service, mem_ctx); + else { + status = kccsrv_simple_update(service, mem_ctx); + if (!NT_STATUS_IS_OK(status)) + DEBUG(0,("kccsrv_execute_kcc failed - %s\n", + nt_errstr(status))); } talloc_free(mem_ctx); @@ -222,10 +224,18 @@ static void kccsrv_task_init(struct task_server *task) return; } - periodic_startup_interval = lpcfg_parm_int(task->lp_ctx, NULL, "kccsrv", - "periodic_startup_interval", 15); /* in seconds */ - service->periodic.interval = lpcfg_parm_int(task->lp_ctx, NULL, "kccsrv", - "periodic_interval", 300); /* in seconds */ + periodic_startup_interval = + lpcfg_parm_int(task->lp_ctx, NULL, "kccsrv", + "periodic_startup_interval", 15); /* in seconds */ + service->periodic.interval = + lpcfg_parm_int(task->lp_ctx, NULL, "kccsrv", + "periodic_interval", 300); /* in seconds */ + + /* (kccsrv:samba_kcc=true) will run newer samba_kcc replication + * topology generation code. + */ + service->samba_kcc_code = lpcfg_parm_bool(task->lp_ctx, NULL, + "kccsrv", "samba_kcc", false); status = kccsrv_periodic_schedule(service, periodic_startup_interval); if (!W_ERROR_IS_OK(status)) { @@ -235,12 +245,6 @@ static void kccsrv_task_init(struct task_server *task) return; } - /* (kccsrv:intrasite=true) will run newer intrasite replication - * topology code. - */ - service->intrasite_code = lpcfg_parm_bool(task->lp_ctx, NULL, "kccsrv", - "intrasite", false); - irpc_add_name(task->msg_ctx, "kccsrv"); IRPC_REGISTER(task->msg_ctx, drsuapi, DRSUAPI_DSEXECUTEKCC, kccsrv_execute_kcc, service); -- cgit