[SCM] Samba Shared Repository - branch v4-9-stable updated

Karolin Seeger kseeger at samba.org
Mon Sep 24 08:09:23 UTC 2018


The branch, v4-9-stable has been updated
       via  8fb6b0f VERSION: Disable GIT_SNAPSHOT for the 4.9.1 release.
       via  7483205 WHATSNEW: Add release notes for Samba 4.9.1.
       via  95b08d1 s3: nmbd: Stop nmbd network announce storm.
       via  10d1b4d ctdb-recoverd: Set recovery lock handle at start of attempt
       via  e6bcccb ctdb-recoverd: Handle cancellation when releasing recovery lock
       via  a9c7c64 ctdb-recoverd: Return early when the recovery lock is not held
       via  4913040 ctdb-recoverd: Store recovery lock handle
       via  54820e3 ctdb-recoverd: Use talloc() to allocate recovery lock handle
       via  773a647 ctdb-recoverd: Rename hold_reclock_state to ctdb_recovery_lock_handle
       via  7bd0e80 ctdb-recoverd: Re-check master on failure to take recovery lock
       via  3819f79 ctdb-recoverd: Clean up taking of recovery lock
       via  7187d7d ctdb-cluster-mutex: Block signals around fork
       via  de45241 ctdb-cluster-mutex: Reset SIGTERM handler in cluster mutex child
       via  0420955 ctdb-doc: Remove PIDFILE option from ctdbd_wrapper man page
       via  ff7b231 s3-rpcclient: Use spoolss_init_spoolss_UserLevel1 in winspool cmds
       via  06c566c s3-rpc_client: Advertise Windows 7 client info
       via  78fbf10 s3-spoolss: Make spoolss client os_major,os_minor and os_build configurable.
       via  cab67cb VERSION: Bump version up to 4.9.1...
      from  4fc4ae2 VERSION: Disable GIT_SNAPSHOT for the 4.9.0 release

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-9-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                           |   2 +-
 WHATSNEW.txt                                      |  58 +++++++++++
 ctdb/doc/ctdbd_wrapper.1.xml                      |   6 --
 ctdb/server/ctdb_cluster_mutex.c                  |  32 ++++++
 ctdb/server/ctdb_recoverd.c                       | 120 +++++++++++++++-------
 docs-xml/smbdotconf/printing/spoolssosversion.xml |  39 +++++++
 source3/nmbd/nmbd_sendannounce.c                  |   2 +-
 source3/rpc_client/cli_spoolss.c                  |  29 +++---
 source3/rpc_client/init_spoolss.c                 |  31 ++++++
 source3/rpc_client/init_spoolss.h                 |   3 +
 source3/rpcclient/cmd_iremotewinspool.c           |  16 +--
 11 files changed, 270 insertions(+), 68 deletions(-)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index cbf21a9..406f63d 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=9
-SAMBA_VERSION_RELEASE=0
+SAMBA_VERSION_RELEASE=1
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index d344d9b..0742d7d 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,62 @@
                    =============================
+                   Release Notes for Samba 4.9.1
+                         September 24, 2018
+                   =============================
+
+
+This is the latest stable release of the Samba 4.9 release series.
+
+
+Major enhancements include:
+---------------------------
+
+   o  s3: nmbd: Stop nmbd network announce storm (bug #13620).
+
+
+Changes since 4.9.0:
+--------------------
+
+o  Andrew Bartlett <abartlet at samba.org>
+   * BUG 13620: s3: nmbd: Stop nmbd network announce storm.
+
+o  Günther Deschner <gd at samba.org>
+   * BUG 13597: s3-rpcclient: Use spoolss_init_spoolss_UserLevel1 in winspool
+     cmds.
+
+o  Martin Schwenke <martin at meltin.net>
+   * BUG 13617: CTDB recovery lock has some race conditions.
+
+o  Justin Stephenson <jstephen at redhat.com>
+   * BUG 13597: s3-rpc_client: Advertise Windows 7 client info.
+
+o  Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
+   * BUG 13610: ctdb-doc: Remove PIDFILE option from ctdbd_wrapper man page.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the "Samba 4.1 and newer" product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:                                        
+----------------------------------------
+
+                   =============================
                    Release Notes for Samba 4.9.0
                         September 13, 2018
 		   =============================
diff --git a/ctdb/doc/ctdbd_wrapper.1.xml b/ctdb/doc/ctdbd_wrapper.1.xml
index a1b92e3..2c68c47 100644
--- a/ctdb/doc/ctdbd_wrapper.1.xml
+++ b/ctdb/doc/ctdbd_wrapper.1.xml
@@ -20,7 +20,6 @@
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>ctdbd_wrapper</command>
-      <arg choice="req"><replaceable>PIDFILE</replaceable></arg>
       <group choice="req">
 	<arg choice="plain">start</arg>
 	<arg choice="plain">stop</arg>
@@ -35,11 +34,6 @@
     </para>
 
     <para>
-      <replaceable>PIDFILE</replaceable> specifies the location of the
-      file containing the PID of the main CTDB daemon.
-    </para>
-
-    <para>
       See <citerefentry><refentrytitle>ctdb</refentrytitle>
       <manvolnum>7</manvolnum></citerefentry> for an overview of CTDB.
     </para>
diff --git a/ctdb/server/ctdb_cluster_mutex.c b/ctdb/server/ctdb_cluster_mutex.c
index 804c6d5..330d5fd 100644
--- a/ctdb/server/ctdb_cluster_mutex.c
+++ b/ctdb/server/ctdb_cluster_mutex.c
@@ -196,6 +196,7 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
 {
 	struct ctdb_cluster_mutex_handle *h;
 	char **args;
+	sigset_t sigset_term;
 	int ret;
 
 	h = talloc(mem_ctx, struct ctdb_cluster_mutex_handle);
@@ -225,15 +226,41 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 
+	sigemptyset(&sigset_term);
+	sigaddset(&sigset_term, SIGTERM);
+	ret = sigprocmask(SIG_BLOCK, &sigset_term, NULL);
+	if (ret != 0) {
+		DBG_WARNING("Failed to block SIGTERM (%d)\n", errno);
+	}
+
 	h->child = ctdb_fork(ctdb);
 	if (h->child == (pid_t)-1) {
 		close(h->fd[0]);
 		close(h->fd[1]);
 		talloc_free(h);
+		ret = sigprocmask(SIG_UNBLOCK, &sigset_term, NULL);
+		if (ret != 0) {
+			DBG_WARNING("Failed to unblock SIGTERM (%d)\n", errno);
+		}
 		return NULL;
 	}
 
 	if (h->child == 0) {
+		struct sigaction sa = {
+			.sa_handler = SIG_DFL,
+		};
+
+		ret = sigaction(SIGTERM, &sa, NULL);
+		if (ret != 0) {
+			DBG_WARNING("Failed to reset signal handler (%d)\n",
+				    errno);
+		}
+
+		ret = sigprocmask(SIG_UNBLOCK, &sigset_term, NULL);
+		if (ret != 0) {
+			DBG_WARNING("Failed to unblock SIGTERM (%d)\n", errno);
+		}
+
 		/* Make stdout point to the pipe */
 		close(STDOUT_FILENO);
 		dup2(h->fd[1], STDOUT_FILENO);
@@ -248,6 +275,11 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
 
 	/* Parent */
 
+	ret = sigprocmask(SIG_UNBLOCK, &sigset_term, NULL);
+	if (ret != 0) {
+		DBG_WARNING("Failed to unblock SIGTERM (%d)\n", errno);
+	}
+
 	DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d\n", h->fd[0]));
 	set_close_on_exec(h->fd[0]);
 
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 3e85186..673c99c 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -239,6 +239,8 @@ struct ctdb_banning_state {
 	struct timeval last_reported_time;
 };
 
+struct ctdb_recovery_lock_handle;
+
 /*
   private state of recovery daemon
  */
@@ -260,7 +262,7 @@ struct ctdb_recoverd {
 	uint32_t *force_rebalance_nodes;
 	struct ctdb_node_capabilities *caps;
 	bool frozen_on_inactive;
-	struct ctdb_cluster_mutex_handle *recovery_lock_handle;
+	struct ctdb_recovery_lock_handle *recovery_lock_handle;
 };
 
 #define CONTROL_TIMEOUT() timeval_current_ofs(ctdb->tunable.recover_timeout, 0)
@@ -881,18 +883,19 @@ static bool ctdb_recovery_have_lock(struct ctdb_recoverd *rec)
 	return (rec->recovery_lock_handle != NULL);
 }
 
-struct hold_reclock_state {
+struct ctdb_recovery_lock_handle {
 	bool done;
 	bool locked;
 	double latency;
+	struct ctdb_cluster_mutex_handle *h;
 };
 
 static void take_reclock_handler(char status,
 				 double latency,
 				 void *private_data)
 {
-	struct hold_reclock_state *s =
-		(struct hold_reclock_state *) private_data;
+	struct ctdb_recovery_lock_handle *s =
+		(struct ctdb_recovery_lock_handle *) private_data;
 
 	switch (status) {
 	case '0':
@@ -932,41 +935,68 @@ static bool ctdb_recovery_lock(struct ctdb_recoverd *rec)
 {
 	struct ctdb_context *ctdb = rec->ctdb;
 	struct ctdb_cluster_mutex_handle *h;
-	struct hold_reclock_state s = {
-		.done = false,
-		.locked = false,
-		.latency = 0,
+	struct ctdb_recovery_lock_handle *s;
+
+	s = talloc_zero(rec, struct ctdb_recovery_lock_handle);
+	if (s == NULL) {
+		DBG_ERR("Memory allocation error\n");
+		return false;
 	};
 
-	h = ctdb_cluster_mutex(rec, ctdb, ctdb->recovery_lock, 0,
-			       take_reclock_handler, &s,
-			       lost_reclock_handler, rec);
+	h = ctdb_cluster_mutex(s,
+			       ctdb,
+			       ctdb->recovery_lock,
+			       0,
+			       take_reclock_handler,
+			       s,
+			       lost_reclock_handler,
+			       rec);
 	if (h == NULL) {
+		talloc_free(s);
 		return false;
 	}
 
-	while (!s.done) {
+	rec->recovery_lock_handle = s;
+	s->h = h;
+
+	while (! s->done) {
 		tevent_loop_once(ctdb->ev);
 	}
 
-	if (! s.locked) {
-		talloc_free(h);
+	if (! s->locked) {
+		TALLOC_FREE(rec->recovery_lock_handle);
 		return false;
 	}
 
-	rec->recovery_lock_handle = h;
-	ctdb_ctrl_report_recd_lock_latency(ctdb, CONTROL_TIMEOUT(),
-					   s.latency);
+	ctdb_ctrl_report_recd_lock_latency(ctdb,
+					   CONTROL_TIMEOUT(),
+					   s->latency);
 
 	return true;
 }
 
 static void ctdb_recovery_unlock(struct ctdb_recoverd *rec)
 {
-	if (rec->recovery_lock_handle != NULL) {
-		DEBUG(DEBUG_NOTICE, ("Releasing recovery lock\n"));
-		TALLOC_FREE(rec->recovery_lock_handle);
+	if (rec->recovery_lock_handle == NULL) {
+		return;
+	}
+
+	if (! rec->recovery_lock_handle->done) {
+		/*
+		 * Taking of recovery lock still in progress.  Free
+		 * the cluster mutex handle to release it but leave
+		 * the recovery lock handle in place to allow taking
+		 * of the lock to fail.
+		 */
+		D_NOTICE("Cancelling recovery lock\n");
+		TALLOC_FREE(rec->recovery_lock_handle->h);
+		rec->recovery_lock_handle->done = true;
+		rec->recovery_lock_handle->locked = false;
+		return;
 	}
+
+	D_NOTICE("Releasing recovery lock\n");
+	TALLOC_FREE(rec->recovery_lock_handle);
 }
 
 static void ban_misbehaving_nodes(struct ctdb_recoverd *rec, bool *self_ban)
@@ -1315,31 +1345,47 @@ static int do_recovery(struct ctdb_recoverd *rec,
 		goto fail;
 	}
 
-        if (ctdb->recovery_lock != NULL) {
+	if (ctdb->recovery_lock != NULL) {
 		if (ctdb_recovery_have_lock(rec)) {
-			DEBUG(DEBUG_NOTICE, ("Already holding recovery lock\n"));
+			D_NOTICE("Already holding recovery lock\n");
 		} else {
-			DEBUG(DEBUG_NOTICE, ("Attempting to take recovery lock (%s)\n",
-					     ctdb->recovery_lock));
-			if (!ctdb_recovery_lock(rec)) {
-				if (ctdb->runstate == CTDB_RUNSTATE_FIRST_RECOVERY) {
-					/* If ctdb is trying first recovery, it's
-					 * possible that current node does not know
-					 * yet who the recmaster is.
+			bool ok;
+
+			D_NOTICE("Attempting to take recovery lock (%s)\n",
+				 ctdb->recovery_lock);
+
+			ok = ctdb_recovery_lock(rec);
+			if (! ok) {
+				D_ERR("Unable to take recovery lock\n");
+
+				if (pnn != rec->recmaster) {
+					D_NOTICE("Recovery master changed to %u,"
+						 " aborting recovery\n",
+						 rec->recmaster);
+					rec->need_recovery = false;
+					goto fail;
+				}
+
+				if (ctdb->runstate ==
+				    CTDB_RUNSTATE_FIRST_RECOVERY) {
+					/*
+					 * First recovery?  Perhaps
+					 * current node does not yet
+					 * know who the recmaster is.
 					 */
-					DEBUG(DEBUG_ERR, ("Unable to get recovery lock"
-							  " - retrying recovery\n"));
+					D_ERR("Retrying recovery\n");
 					goto fail;
 				}
 
-				DEBUG(DEBUG_ERR,("Unable to get recovery lock - aborting recovery "
-						 "and ban ourself for %u seconds\n",
-						 ctdb->tunable.recovery_ban_period));
-				ctdb_ban_node(rec, pnn, ctdb->tunable.recovery_ban_period);
+				D_ERR("Abort recovery, "
+				      "ban this node for %u seconds\n",
+				      ctdb->tunable.recovery_ban_period);
+				ctdb_ban_node(rec,
+					      pnn,
+					      ctdb->tunable.recovery_ban_period);
 				goto fail;
 			}
-			DEBUG(DEBUG_NOTICE,
-			      ("Recovery lock taken successfully by recovery daemon\n"));
+			D_NOTICE("Recovery lock taken successfully\n");
 		}
 	}
 
diff --git a/docs-xml/smbdotconf/printing/spoolssosversion.xml b/docs-xml/smbdotconf/printing/spoolssosversion.xml
index 0ef4489..1b57b69 100644
--- a/docs-xml/smbdotconf/printing/spoolssosversion.xml
+++ b/docs-xml/smbdotconf/printing/spoolssosversion.xml
@@ -39,3 +39,42 @@
 <value type="default">2195</value>
 <value type="example">7601</value>
 </samba:parameter>
+
+<samba:parameter name="spoolss_client: os_major"
+                 context="G"
+                 type="integer"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>Windows might require a new os version number. This option allows
+		to modify the build number. The complete default version number is:
+		6.1.7007 (Windows 7 and Windows Server 2008 R2).
+	</para>
+</description>
+<value type="default">6</value>
+</samba:parameter>
+
+<samba:parameter name="spoolss_client: os_minor"
+		 context="G"
+		 type="integer"
+		 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>Windows might require a new os version number. This option allows
+		to modify the build number. The complete default version number is:
+		6.1.7007 (Windows 7 and Windows Server 2008 R2).
+	</para>
+</description>
+<value type="default">1</value>
+</samba:parameter>
+
+<samba:parameter name="spoolss_client: os_build"
+		 context="G"
+		 type="integer"
+		 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>Windows might require a new os version number. This option allows
+		to modify the build number. The complete default version number is:
+		6.1.7007 (Windows 7 and Windows Server 2008 R2).
+	</para>
+</description>
+<value type="default">7007</value>
+</samba:parameter>
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c
index 44d67e7..a9cdf1c 100644
--- a/source3/nmbd/nmbd_sendannounce.c
+++ b/source3/nmbd/nmbd_sendannounce.c
@@ -288,7 +288,7 @@ void announce_my_server_names(time_t t)
 			}
 
 			/* Announce every minute at first then progress to every 12 mins */
-			if (t > work->lastannounce_time &&
+			if (t >= work->lastannounce_time &&
 			    (t - work->lastannounce_time) < work->announce_interval) {
 				continue;
 			}
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 7f6ed8e..36ca806 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -28,6 +28,7 @@
 #include "rpc_client/cli_spoolss.h"
 #include "auth/gensec/gensec.h"
 #include "auth/credentials/credentials.h"
+#include "rpc_client/init_spoolss.h"
 
 /**********************************************************************
  convencience wrapper around rpccli_spoolss_OpenPrinterEx
@@ -49,14 +50,12 @@ WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
 
 	ZERO_STRUCT(devmode_ctr);
 
-	level1.size	= 28;
-	level1.client	= talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name());
-	W_ERROR_HAVE_NO_MEMORY(level1.client);
-	level1.user	= cli_credentials_get_username(creds);
-	level1.build	= 1381;
-	level1.major	= 2;
-	level1.minor	= 0;
-	level1.processor = 0;
+	werror = spoolss_init_spoolss_UserLevel1(mem_ctx,
+						 cli_credentials_get_username(creds),
+						 &level1);
+	if (!W_ERROR_IS_OK(werror)) {
+		return werror;
+	}
 
 	userlevel_ctr.level = 1;
 	userlevel_ctr.user_info.level1 = &level1;
@@ -229,14 +228,12 @@ WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli,
 	ZERO_STRUCT(devmode_ctr);
 	ZERO_STRUCT(secdesc_ctr);
 
-	level1.size		= 28;
-	level1.build		= 1381;
-	level1.major		= 2;
-	level1.minor		= 0;
-	level1.processor	= 0;
-	level1.client		= talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name());
-	W_ERROR_HAVE_NO_MEMORY(level1.client);
-	level1.user	        = cli_credentials_get_username(creds);
+	result = spoolss_init_spoolss_UserLevel1(mem_ctx,
+						 cli_credentials_get_username(creds),
+						 &level1);
+	if (!W_ERROR_IS_OK(result)) {
+		return result;
+	}
 
 	userlevel_ctr.level = 1;
 	userlevel_ctr.user_info.level1 = &level1;
diff --git a/source3/rpc_client/init_spoolss.c b/source3/rpc_client/init_spoolss.c
index 9a4dab6..c341b82 100644
--- a/source3/rpc_client/init_spoolss.c
+++ b/source3/rpc_client/init_spoolss.c
@@ -446,3 +446,34 @@ const char *spoolss_get_short_filesys_environment(const char *environment)
 		return NULL;
 	}
 }
+
+/* Windows 7 and Windows Server 2008 R2 */
+#define GLOBAL_SPOOLSS_CLIENT_OS_MAJOR_DEFAULT 6
+#define GLOBAL_SPOOLSS_CLIENT_OS_MINOR_DEFAULT 1
+#define GLOBAL_SPOOLSS_CLIENT_OS_BUILD_DEFAULT 7007
+
+WERROR spoolss_init_spoolss_UserLevel1(TALLOC_CTX *mem_ctx,
+				       const char *username,
+				       struct spoolss_UserLevel1 *r)
+{
+	ZERO_STRUCTP(r);
+
+	r->size		= 28;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list