[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Wed May 15 08:20:02 MDT 2013
The branch, master has been updated
via fbb12b5 samba-tool/tests: Force the gecos of the user to a fixed value.
via 54f4536 dsdb-drepl: create a new schedulable event for running pending operations
from 8c3fa00 lib/param: remove unused 'printer_admin'
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit fbb12b574df69a1cda0a3f201f21279650ddc4c4
Author: Matthieu Patou <mat at matws.net>
Date: Tue May 14 06:20:18 2013 -0700
samba-tool/tests: Force the gecos of the user to a fixed value.
When --gecos is not specified samba-tool user add will try to read the
gecos field from a getpw call. And if user's GECOS is empty (like the
build user on sn-devel-104) then the test will fail because we can't add
an empty gecos.
Signed-off-by: Matthieu Patou <mat at matws.net>
Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
Autobuild-Date(master): Wed May 15 16:19:23 CEST 2013 on sn-devel-104
commit 54f4536980d86faf532708c92890dd9e8b09667a
Author: Matthieu Patou <mat at matws.net>
Date: Wed May 15 04:46:33 2013 -0700
dsdb-drepl: create a new schedulable event for running pending operations
So instead of running dreplsrv_periodic_schedule when receiving a
DRS_REPLICA_SYNC request which will force the DC to look for changes
with all the DC it usually replicate to, we reduce it to the DC
specified in the DRS_REPLICA_SYNC request. It will allow also to do have the
correct options as set by the client who send the DRS_REPLICA_SYNC.
Signed-off-by: Matthieu Patou <mat at matws.net>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
python/samba/tests/samba_tool/user.py | 11 +++++-
source4/dsdb/repl/drepl_periodic.c | 61 +++++++++++++++++++++++++++++++++
source4/dsdb/repl/drepl_service.c | 2 +-
source4/dsdb/repl/drepl_service.h | 17 +++++++++
4 files changed, 89 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py
index 89fa22b..645eb40 100644
--- a/python/samba/tests/samba_tool/user.py
+++ b/python/samba/tests/samba_tool/user.py
@@ -212,12 +212,20 @@ class UserCmdTestCase(SambaToolCmdTest):
self.skipTest("Skipping getpwent test, current EUID not found in NSS")
return
+
+# samba-tool user add command didn't support users with empty gecos if none is
+# specified on the command line and the user hasn't one in the passwd file it
+# will fail, so let's add some contents
+
+ gecos = u[4]
+ if (gecos is None or len(gecos) == 0):
+ gecos = "Foo GECOS"
user = self._randomPosixUser({
"name": u[0],
"uid": u[0],
"uidNumber": u[2],
"gidNumber": u[3],
- "gecos": u[4],
+ "gecos": gecos,
"loginShell": u[6],
})
# check if --rfc2307-from-nss sets the same values as we got from pwd.getpwuid()
@@ -228,6 +236,7 @@ class UserCmdTestCase(SambaToolCmdTest):
"--department=%s" % user["department"],
"--description=%s" % user["description"],
"--company=%s" % user["company"],
+ "--gecos=%s" % user["gecos"],
"--rfc2307-from-nss",
"-H", "ldap://%s" % os.environ["DC_SERVER"],
"-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
diff --git a/source4/dsdb/repl/drepl_periodic.c b/source4/dsdb/repl/drepl_periodic.c
index 62b4092..d6b9467 100644
--- a/source4/dsdb/repl/drepl_periodic.c
+++ b/source4/dsdb/repl/drepl_periodic.c
@@ -133,3 +133,64 @@ void dreplsrv_run_pending_ops(struct dreplsrv_service *s)
dreplsrv_notify_run_ops(s);
}
}
+
+static void dreplsrv_pending_run(struct dreplsrv_service *service);
+
+static void dreplsrv_pending_handler_te(struct tevent_context *ev, struct tevent_timer *te,
+ struct timeval t, void *ptr)
+{
+ struct dreplsrv_service *service = talloc_get_type(ptr, struct dreplsrv_service);
+
+ service->pending.te = NULL;
+
+ dreplsrv_pending_run(service);
+}
+
+WERROR dreplsrv_pendingops_schedule(struct dreplsrv_service *service, uint32_t next_interval)
+{
+ TALLOC_CTX *tmp_mem;
+ struct tevent_timer *new_te;
+ struct timeval next_time;
+
+ /* prevent looping */
+ if (next_interval == 0) {
+ next_interval = 1;
+ }
+
+ next_time = timeval_current_ofs(next_interval, 50);
+
+ if (service->pending.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->pending.next_event) > 0) {
+ return WERR_OK;
+ }
+ }
+
+ /* reset the next scheduled timestamp */
+ service->pending.next_event = next_time;
+
+ new_te = tevent_add_timer(service->task->event_ctx, service,
+ service->pending.next_event,
+ dreplsrv_pending_handler_te, service);
+ W_ERROR_HAVE_NO_MEMORY(new_te);
+
+ tmp_mem = talloc_new(service);
+ DEBUG(4,("dreplsrv_pending_schedule(%u) %sscheduled for: %s\n",
+ next_interval,
+ (service->pending.te?"re":""),
+ nt_time_string(tmp_mem, timeval_to_nttime(&next_time))));
+ talloc_free(tmp_mem);
+
+ talloc_free(service->pending.te);
+ service->pending.te = new_te;
+
+ return WERR_OK;
+}
+
+static void dreplsrv_pending_run(struct dreplsrv_service *service)
+{
+ dreplsrv_run_pending_ops(service);
+}
diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c
index 3d28676..bd33377 100644
--- a/source4/dsdb/repl/drepl_service.c
+++ b/source4/dsdb/repl/drepl_service.c
@@ -338,7 +338,7 @@ static NTSTATUS drepl_replica_sync(struct irpc_message *msg,
* schedule replication event to force
* replication as soon as possible
*/
- dreplsrv_periodic_schedule(service, 0);
+ dreplsrv_pendingops_schedule(service, 0);
done:
return NT_STATUS_OK;
diff --git a/source4/dsdb/repl/drepl_service.h b/source4/dsdb/repl/drepl_service.h
index 6daf82d..edba4c4 100644
--- a/source4/dsdb/repl/drepl_service.h
+++ b/source4/dsdb/repl/drepl_service.h
@@ -187,6 +187,23 @@ struct dreplsrv_service {
struct tevent_timer *te;
} periodic;
+ /* some stuff for running only the pendings ops */
+ struct {
+ /*
+ * the interval between notify runs
+ */
+ uint32_t interval;
+
+ /*
+ * the timestamp for the next event,
+ * this is the timstamp passed to event_add_timed()
+ */
+ struct timeval next_event;
+
+ /* here we have a reference to the timed event the schedules the notifies */
+ struct tevent_timer *te;
+ } pending;
+
/* some stuff for notify processing */
struct {
/*
--
Samba Shared Repository
More information about the samba-cvs
mailing list