From faa9c2374ce284ac23ab42d314da54226ee68c35 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 23 Jan 2007 16:06:47 +0000 Subject: r20974: add basic infrastructure for a DSDB replication service not activated yet... it will handle inbound pull replication and outbound change notification metze (This used to be commit 15eae968b8c72b4ce47071012e4110f3b7f3c3bc) --- source4/dsdb/repl/drepl_service.c | 188 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 source4/dsdb/repl/drepl_service.c (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c new file mode 100644 index 0000000000..e1be7c59a3 --- /dev/null +++ b/source4/dsdb/repl/drepl_service.c @@ -0,0 +1,188 @@ +/* + Unix SMB/CIFS mplementation. + DSDB replication service + + Copyright (C) Stefan Metzmacher 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "includes.h" +#include "dsdb/samdb/samdb.h" +#include "auth/auth.h" +#include "smbd/service.h" +#include "lib/events/events.h" +#include "lib/messaging/irpc.h" +#include "dsdb/repl/drepl_service.h" +#include "lib/ldb/include/ldb_errors.h" +#include "lib/util/dlinklist.h" +#include "librpc/gen_ndr/ndr_misc.h" +#include "librpc/gen_ndr/ndr_drsuapi.h" +#include "librpc/gen_ndr/ndr_drsblobs.h" + +static WERROR dreplsrv_init_creds(struct dreplsrv_service *service) +{ + NTSTATUS status; + + status = auth_system_session_info(service, &service->system_session_info); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + return WERR_OK; +} + +static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service) +{ + service->samdb = samdb_connect(service, service->system_session_info); + if (!service->samdb) { + return WERR_DS_SERVICE_UNAVAILABLE; + } + + return WERR_OK; +} + +static void dreplsrv_periodic_handler_te(struct event_context *ev, struct timed_event *te, + struct timeval t, void *ptr) +{ + struct dreplsrv_service *service = talloc_get_type(ptr, struct dreplsrv_service); + WERROR status; + + service->periodic.te = NULL; + + status = dreplsrv_periodic_schedule(service, service->periodic.interval); + if (!W_ERROR_IS_OK(status)) { + task_server_terminate(service->task, win_errstr(status)); + return; + } +} + +WERROR dreplsrv_periodic_schedule(struct dreplsrv_service *service, uint32_t next_interval) +{ + TALLOC_CTX *tmp_mem; + struct timed_event *new_te; + struct timeval next_time; + + /* prevent looping */ + if (next_interval == 0) next_interval = 1; + + next_time = timeval_current_ofs(next_interval, 5000); + + if (service->periodic.te) { + /* + * if the timestamp of the new event is higher, + * as current next we don't need to reschedule + */ + if (timeval_compare(&next_time, &service->periodic.next_event) > 0) { + return WERR_OK; + } + } + + /* reset the next scheduled timestamp */ + service->periodic.next_event = next_time; + + new_te = event_add_timed(service->task->event_ctx, service, + service->periodic.next_event, + dreplsrv_periodic_handler_te, service); + W_ERROR_HAVE_NO_MEMORY(new_te); + + tmp_mem = talloc_new(service); + DEBUG(4,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n", + next_interval, + (service->periodic.te?"re":""), + nt_time_string(tmp_mem, timeval_to_nttime(&next_time)))); + talloc_free(tmp_mem); + + talloc_free(service->periodic.te); + service->periodic.te = new_te; + + return WERR_OK; +} +/* + startup the dsdb replicator service task +*/ +static void dreplsrv_task_init(struct task_server *task) +{ + WERROR status; + struct dreplsrv_service *service; + + switch (lp_server_role()) { + case ROLE_STANDALONE: + task_server_terminate(task, "dreplsrv: no DSDB replication required in standalone configuration"); + return; + case ROLE_DOMAIN_MEMBER: + task_server_terminate(task, "dreplsrv: no DSDB replication required in domain member configuration"); + return; + case ROLE_DOMAIN_CONTROLLER: + /* Yes, we want DSDB replication */ + break; + } + + task_server_set_title(task, "task[dreplsrv]"); + + service = talloc_zero(task, struct dreplsrv_service); + if (!service) { + task_server_terminate(task, "dreplsrv_task_init: out of memory"); + return; + } + service->task = task; + service->startup_time = timeval_current(); + task->private = service; + + status = dreplsrv_init_creds(service); + if (!W_ERROR_IS_OK(status)) { + task_server_terminate(task, talloc_asprintf(task, + "dreplsrv: Failed to obtain server credentials: %s\n", + win_errstr(status))); + return; + } + + status = dreplsrv_connect_samdb(service); + if (!W_ERROR_IS_OK(status)) { + task_server_terminate(task, talloc_asprintf(task, + "dreplsrv: Failed to connect to local samdb: %s\n", + win_errstr(status))); + return; + } + + service->periodic.interval = 30; /* in seconds */ + + status = dreplsrv_periodic_schedule(service, service->periodic.interval); + if (!W_ERROR_IS_OK(status)) { + task_server_terminate(task, talloc_asprintf(task, + "dreplsrv: Failed to periodic schedule: %s\n", + win_errstr(status))); + return; + } + + irpc_add_name(task->msg_ctx, "dreplsrv"); +} + +/* + initialise the dsdb replicator service + */ +static NTSTATUS dreplsrv_init(struct event_context *event_ctx, const struct model_ops *model_ops) +{ + return task_server_startup(event_ctx, model_ops, dreplsrv_task_init); +} + +/* + register ourselves as a available server +*/ +NTSTATUS server_service_drepl_init(void) +{ + return register_server_service("drepl", dreplsrv_init); +} -- cgit From 9142a00cb7678e9a63177562978307936ed80a83 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 23 Jan 2007 16:22:27 +0000 Subject: r20977: start the 'drepl' service, which currently does nothing by default, but make it less verbose metze (This used to be commit f7e82a0c94fc8996827ea8d8a9b459bcaee029de) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index e1be7c59a3..f1ebac2822 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -100,7 +100,7 @@ WERROR dreplsrv_periodic_schedule(struct dreplsrv_service *service, uint32_t nex W_ERROR_HAVE_NO_MEMORY(new_te); tmp_mem = talloc_new(service); - DEBUG(4,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n", + DEBUG(6,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n", next_interval, (service->periodic.te?"re":""), nt_time_string(tmp_mem, timeval_to_nttime(&next_time)))); -- cgit From ea57190d252713e6e0ab42f46b18a4ae28f6f398 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 23 Jan 2007 16:23:28 +0000 Subject: r20978: 300 seconds as interval is ok, when we do nothing metze (This used to be commit 4d6629c68332985f9122e4591f31ae46250de646) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index f1ebac2822..9a3cac4247 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -158,7 +158,7 @@ static void dreplsrv_task_init(struct task_server *task) return; } - service->periodic.interval = 30; /* in seconds */ + service->periodic.interval = 300; /* in seconds */ status = dreplsrv_periodic_schedule(service, service->periodic.interval); if (!W_ERROR_IS_OK(status)) { -- cgit From 023e2451873a89a433fadbe913b94507af856cf3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 23 Apr 2007 00:43:47 +0000 Subject: r22472: Commit the start of the DRSUAPI pull replication service. It doesn't work completely yet because we aren't able to resolve DNS SRV records. And also we also need a kdc locator plugin... But with some hacks the pull replication works fine metze (This used to be commit 0dc78f7439c9c786fd8c592960f9669dea40b811) --- source4/dsdb/repl/drepl_service.c | 114 ++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 54 deletions(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 9a3cac4247..17690d135d 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -47,70 +47,68 @@ static WERROR dreplsrv_init_creds(struct dreplsrv_service *service) static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service) { + const struct GUID *ntds_guid; + struct drsuapi_DsBindInfo28 *bind_info28; + service->samdb = samdb_connect(service, service->system_session_info); if (!service->samdb) { return WERR_DS_SERVICE_UNAVAILABLE; } - return WERR_OK; -} - -static void dreplsrv_periodic_handler_te(struct event_context *ev, struct timed_event *te, - struct timeval t, void *ptr) -{ - struct dreplsrv_service *service = talloc_get_type(ptr, struct dreplsrv_service); - WERROR status; - - service->periodic.te = NULL; - - status = dreplsrv_periodic_schedule(service, service->periodic.interval); - if (!W_ERROR_IS_OK(status)) { - task_server_terminate(service->task, win_errstr(status)); - return; + ntds_guid = samdb_ntds_objectGUID(service->samdb); + if (!ntds_guid) { + return WERR_DS_SERVICE_UNAVAILABLE; } -} -WERROR dreplsrv_periodic_schedule(struct dreplsrv_service *service, uint32_t next_interval) -{ - TALLOC_CTX *tmp_mem; - struct timed_event *new_te; - struct timeval next_time; - - /* prevent looping */ - if (next_interval == 0) next_interval = 1; - - next_time = timeval_current_ofs(next_interval, 5000); - - if (service->periodic.te) { - /* - * if the timestamp of the new event is higher, - * as current next we don't need to reschedule - */ - if (timeval_compare(&next_time, &service->periodic.next_event) > 0) { - return WERR_OK; - } + service->ntds_guid = *ntds_guid; + + bind_info28 = &service->bind_info28; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_BASE; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2; +#if 0 + if (s->domain_behavior_version == 2) { + /* TODO: find out how this is really triggered! */ + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION; } - - /* reset the next scheduled timestamp */ - service->periodic.next_event = next_time; - - new_te = event_add_timed(service->task->event_ctx, service, - service->periodic.next_event, - dreplsrv_periodic_handler_te, service); - W_ERROR_HAVE_NO_MEMORY(new_te); - - tmp_mem = talloc_new(service); - DEBUG(6,("dreplsrv_periodic_schedule(%u) %sscheduled for: %s\n", - next_interval, - (service->periodic.te?"re":""), - nt_time_string(tmp_mem, timeval_to_nttime(&next_time)))); - talloc_free(tmp_mem); - - talloc_free(service->periodic.te); - service->periodic.te = new_te; +#endif + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_00100000; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7; + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT; +#if 0 /* we don't support XPRESS compression yet */ + bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS; +#endif + /* TODO: fill in site_guid */ + bind_info28->site_guid = GUID_zero(); + /* TODO: find out how this is really triggered! */ + bind_info28->u1 = 0; + bind_info28->repl_epoch = 0; return WERR_OK; } + /* startup the dsdb replicator service task */ @@ -158,7 +156,15 @@ static void dreplsrv_task_init(struct task_server *task) return; } - service->periodic.interval = 300; /* in seconds */ + status = dreplsrv_load_partitions(service); + if (!W_ERROR_IS_OK(status)) { + task_server_terminate(task, talloc_asprintf(task, + "dreplsrv: Failed to load partitions: %s\n", + win_errstr(status))); + return; + } + + service->periodic.interval = lp_parm_int(-1, "dreplsrv", "periodic_interval", 300); /* in seconds */ status = dreplsrv_periodic_schedule(service, service->periodic.interval); if (!W_ERROR_IS_OK(status)) { -- cgit From 5d2f325f83090ee4fc413f13ad3eec38ae73d430 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Apr 2007 02:43:23 +0000 Subject: r22508: at option for the startup delay metze (This used to be commit 09da9f6490bf57d231a2ace4697adc8c6cd5f912) --- source4/dsdb/repl/drepl_service.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 17690d135d..f18edeff36 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -116,6 +116,7 @@ static void dreplsrv_task_init(struct task_server *task) { WERROR status; struct dreplsrv_service *service; + uint32_t periodic_startup_interval; switch (lp_server_role()) { case ROLE_STANDALONE: @@ -164,9 +165,10 @@ static void dreplsrv_task_init(struct task_server *task) return; } + periodic_startup_interval = lp_parm_int(-1, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */ service->periodic.interval = lp_parm_int(-1, "dreplsrv", "periodic_interval", 300); /* in seconds */ - status = dreplsrv_periodic_schedule(service, service->periodic.interval); + status = dreplsrv_periodic_schedule(service, periodic_startup_interval); if (!W_ERROR_IS_OK(status)) { task_server_terminate(task, talloc_asprintf(task, "dreplsrv: Failed to periodic schedule: %s\n", -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/dsdb/repl/drepl_service.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index f18edeff36..b26358b3a5 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/dsdb/repl/drepl_service.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index b26358b3a5..e4e2aedcf7 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -31,6 +31,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "librpc/gen_ndr/ndr_drsuapi.h" #include "librpc/gen_ndr/ndr_drsblobs.h" +#include "param/param.h" static WERROR dreplsrv_init_creds(struct dreplsrv_service *service) { -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/dsdb/repl/drepl_service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index e4e2aedcf7..2896050ddc 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -165,8 +165,8 @@ static void dreplsrv_task_init(struct task_server *task) return; } - periodic_startup_interval = lp_parm_int(-1, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */ - service->periodic.interval = lp_parm_int(-1, "dreplsrv", "periodic_interval", 300); /* in seconds */ + periodic_startup_interval = lp_parm_int(NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */ + service->periodic.interval = lp_parm_int(NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */ status = dreplsrv_periodic_schedule(service, periodic_startup_interval); if (!W_ERROR_IS_OK(status)) { -- cgit From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 2896050ddc..f4ee5445f9 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -118,7 +118,7 @@ static void dreplsrv_task_init(struct task_server *task) struct dreplsrv_service *service; uint32_t periodic_startup_interval; - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: task_server_terminate(task, "dreplsrv: no DSDB replication required in standalone configuration"); return; -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/dsdb/repl/drepl_service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index f4ee5445f9..e56e2e179c 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -165,8 +165,8 @@ static void dreplsrv_task_init(struct task_server *task) return; } - periodic_startup_interval = lp_parm_int(NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */ - service->periodic.interval = lp_parm_int(NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */ + periodic_startup_interval = lp_parm_int(global_loadparm, NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */ + service->periodic.interval = lp_parm_int(global_loadparm, NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */ status = dreplsrv_periodic_schedule(service, periodic_startup_interval); if (!W_ERROR_IS_OK(status)) { -- cgit From f4a1083cf9f64b4d2b65b68942e93861409ea90f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 17:09:52 +0100 Subject: r26227: Make loadparm_context part of a server task, move loadparm_contexts further up the call stack. (This used to be commit 0721a07aada6a1fae6dcbd610b8783df57d7bbad) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index e56e2e179c..5c74dbfb72 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -50,7 +50,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service) const struct GUID *ntds_guid; struct drsuapi_DsBindInfo28 *bind_info28; - service->samdb = samdb_connect(service, service->system_session_info); + service->samdb = samdb_connect(service, global_loadparm, service->system_session_info); if (!service->samdb) { return WERR_DS_SERVICE_UNAVAILABLE; } -- cgit From 51db4c3f3d81d1ed03beae6426786c843ac59807 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 17:56:09 +0100 Subject: r26228: Store loadparm context in auth context, move more loadparm_contexts up the call stack. (This used to be commit ba75f1613a9aac69dd5df94dd8a2b37820acd166) --- source4/dsdb/repl/drepl_service.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 5c74dbfb72..72033f4177 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -45,12 +45,12 @@ static WERROR dreplsrv_init_creds(struct dreplsrv_service *service) return WERR_OK; } -static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service) +static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct loadparm_context *lp_ctx) { const struct GUID *ntds_guid; struct drsuapi_DsBindInfo28 *bind_info28; - service->samdb = samdb_connect(service, global_loadparm, service->system_session_info); + service->samdb = samdb_connect(service, lp_ctx, service->system_session_info); if (!service->samdb) { return WERR_DS_SERVICE_UNAVAILABLE; } @@ -118,7 +118,7 @@ static void dreplsrv_task_init(struct task_server *task) struct dreplsrv_service *service; uint32_t periodic_startup_interval; - switch (lp_server_role(global_loadparm)) { + switch (lp_server_role(task->lp_ctx)) { case ROLE_STANDALONE: task_server_terminate(task, "dreplsrv: no DSDB replication required in standalone configuration"); return; @@ -149,7 +149,7 @@ static void dreplsrv_task_init(struct task_server *task) return; } - status = dreplsrv_connect_samdb(service); + status = dreplsrv_connect_samdb(service, task->lp_ctx); if (!W_ERROR_IS_OK(status)) { task_server_terminate(task, talloc_asprintf(task, "dreplsrv: Failed to connect to local samdb: %s\n", @@ -165,8 +165,8 @@ static void dreplsrv_task_init(struct task_server *task) return; } - periodic_startup_interval = lp_parm_int(global_loadparm, NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */ - service->periodic.interval = lp_parm_int(global_loadparm, NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */ + periodic_startup_interval = lp_parm_int(task->lp_ctx, NULL, "dreplsrv", "periodic_startup_interval", 15); /* in seconds */ + service->periodic.interval = lp_parm_int(task->lp_ctx, NULL, "dreplsrv", "periodic_interval", 300); /* in seconds */ status = dreplsrv_periodic_schedule(service, periodic_startup_interval); if (!W_ERROR_IS_OK(status)) { -- cgit From 291ddf433685ee5c25e172885045a4b60d7bb1ee Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 00:28:07 +0100 Subject: r26237: Add loadparm context to the server service interface. (This used to be commit 1386c5c92505a950c65411b8af74d703ce023f95) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 72033f4177..96db445f3d 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -182,7 +182,7 @@ static void dreplsrv_task_init(struct task_server *task) /* initialise the dsdb replicator service */ -static NTSTATUS dreplsrv_init(struct event_context *event_ctx, const struct model_ops *model_ops) +static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops) { return task_server_startup(event_ctx, model_ops, dreplsrv_task_init); } -- cgit From 43696d2752e2faad34fb3ed2a7dbf01d40ffdc46 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 15:53:28 +0100 Subject: r26252: Specify loadparm_context explicitly when creating sessions. (This used to be commit 7280c1e9415daabb2712db1372e23f9846272ede) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 96db445f3d..fe24314c11 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -37,7 +37,7 @@ static WERROR dreplsrv_init_creds(struct dreplsrv_service *service) { NTSTATUS status; - status = auth_system_session_info(service, &service->system_session_info); + status = auth_system_session_info(service, global_loadparm, &service->system_session_info); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); } -- cgit From da0f222f432c4fc8bf5da80baf849ca32b315ca0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 23:33:16 +0100 Subject: r26271: Remove some more uses of global_loadparm. (This used to be commit e9875fcd56de0748ed78d7e3c9cdb4919cd96d3c) --- source4/dsdb/repl/drepl_service.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index fe24314c11..c3238a206f 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -37,7 +37,8 @@ static WERROR dreplsrv_init_creds(struct dreplsrv_service *service) { NTSTATUS status; - status = auth_system_session_info(service, global_loadparm, &service->system_session_info); + status = auth_system_session_info(service, service->task->lp_ctx, + &service->system_session_info); if (!NT_STATUS_IS_OK(status)) { return ntstatus_to_werror(status); } -- cgit From df408d056ec03f2abe08ce0ea487e1875b90e7bf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 5 Jan 2008 19:03:43 -0600 Subject: r26672: Janitorial: Remove uses of global_loadparm. (This used to be commit 18cd08623eaad7d2cd63b82ea5275d4dfd21cf00) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index c3238a206f..e212407e24 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -185,7 +185,7 @@ static void dreplsrv_task_init(struct task_server *task) */ static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops) { - return task_server_startup(event_ctx, model_ops, dreplsrv_task_init); + return task_server_startup(event_ctx, lp_ctx, model_ops, dreplsrv_task_init); } /* -- cgit From 23d681caf9c1186999ac676d70a1eb0e8a43e358 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 4 Feb 2008 17:48:51 +1100 Subject: Rework service init functions to pass down service name. This is needed to change prefork behaviour based on what service is being started. Andrew Bartlett and David Disseldorp (This used to be commit 0d830580e3539c96da3aa6c72fafe6eacd7a74a0) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index e212407e24..246309e16f 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -185,7 +185,7 @@ static void dreplsrv_task_init(struct task_server *task) */ static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops) { - return task_server_startup(event_ctx, lp_ctx, model_ops, dreplsrv_task_init); + return task_server_startup(event_ctx, lp_ctx, "drepl", model_ops, dreplsrv_task_init); } /* -- cgit From 0f8eeb81ec109cde681961614fb690f8373fa9c6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 4 Feb 2008 21:58:29 +1100 Subject: Remove useless layer of indirection, where every service called task_service_init() manually. Now this is called from service.c for all services. Andrew Bartlett (This used to be commit 9c9a4731cafd0dcf6c8523a7b06759cd4f14e4db) --- source4/dsdb/repl/drepl_service.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 246309e16f..3375059e99 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -180,18 +180,10 @@ static void dreplsrv_task_init(struct task_server *task) irpc_add_name(task->msg_ctx, "dreplsrv"); } -/* - initialise the dsdb replicator service - */ -static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops) -{ - return task_server_startup(event_ctx, lp_ctx, "drepl", model_ops, dreplsrv_task_init); -} - /* register ourselves as a available server */ NTSTATUS server_service_drepl_init(void) { - return register_server_service("drepl", dreplsrv_init); + return register_server_service("drepl", dreplsrv_task_init); } -- cgit From 21fc7673780aa1d7c0caab7b17ff9171238913ba Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 12:23:44 +0200 Subject: Specify event_context to ldb_wrap_connect explicitly. (This used to be commit b4e1ae07a284c044704322446c94351c2decff91) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 3375059e99..e485c50a47 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -51,7 +51,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo const struct GUID *ntds_guid; struct drsuapi_DsBindInfo28 *bind_info28; - service->samdb = samdb_connect(service, lp_ctx, service->system_session_info); + service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info); if (!service->samdb) { return WERR_DS_SERVICE_UNAVAILABLE; } -- cgit From 7fba6c649ba36ca5b76dcfed7b773567c9933077 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 22 Jul 2008 15:35:23 +0200 Subject: Change occurrences of the u1 member of DsBindInfo* to pid after idl change. Michael (This used to be commit b91bbc5fe4a47e5823be6be5f2f203f1f14105de) --- source4/dsdb/repl/drepl_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/repl/drepl_service.c') diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index e485c50a47..3611258ca5 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -104,7 +104,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo /* TODO: fill in site_guid */ bind_info28->site_guid = GUID_zero(); /* TODO: find out how this is really triggered! */ - bind_info28->u1 = 0; + bind_info28->pid = 0; bind_info28->repl_epoch = 0; return WERR_OK; -- cgit