[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Dec 13 06:14:04 MST 2011


The branch, master has been updated
       via  4eb5b0b s3:messaging.idl: obsolete unused MSG_SMB_SAM_*
       via  a131713 s3:smbd/server: remove unused msg_sam_sync()
       via  7dc1de7 s3:rpc_server/netlogon: remove unused send_sync_message()
       via  92280de s3:smbcontrol: remove unused "samsync" and "samrepl" commands
       via  2bab507 s3:smbd/server: add parent specific SIGTERM and SIGHUP handlers
       via  1738a61 s3:smbd/server: create smbd_parent_context earlier
       via  dc38db3 s3:smbd/server: remember the ev_ctx on the smbd_parent_context
       via  20c343b s3:smbd/server: remember the msg_ctx on the smbd_parent_context
       via  e09c675 s3:smbd/open: pass smbd_server_connection as private_data to msg_file_was_renamed()
       via  173ea71 s3:smbd: register MSG_SMB_FILE_RENAME after the fork
       via  d492a43 s3:smbd/conn_msg: pass smbd_server_connection as private_data to msg_force_tdis()
       via  f426eb1 s3:smbd/blocking: pass smbd_server_connection as private_data to process_blocking_lock_cancel_message()
       via  fbcdaa6 s4:pydsdb: remove unused variable from py_dsdb_am_pdc()
      from  62249f7 s3: Use pid_to_procid

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4eb5b0b392d7689435e347dcc389c5c782562984
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 09:23:31 2011 +0100

    s3:messaging.idl: obsolete unused MSG_SMB_SAM_*
    
    metze
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Tue Dec 13 14:13:38 CET 2011 on sn-devel-104

commit a131713b96e95e38cc6b6d8469a08d90738bb4fc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 09:21:58 2011 +0100

    s3:smbd/server: remove unused msg_sam_sync()
    
    metze

commit 7dc1de73d33b8e5c5ba9fea8ab2f4796030418e1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 10:34:19 2011 +0100

    s3:rpc_server/netlogon: remove unused send_sync_message()
    
    metze

commit 92280def16dc5e307b197a3d528a13cdd6041a29
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 09:20:20 2011 +0100

    s3:smbcontrol: remove unused "samsync" and "samrepl" commands
    
    metze

commit 2bab5073bace651a8961400ca39e2329c4d04b65
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 09:04:20 2011 +0100

    s3:smbd/server: add parent specific SIGTERM and SIGHUP handlers
    
    metze

commit 1738a61b846e39c6a09b16ca01a40f9890c16991
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:54:49 2011 +0100

    s3:smbd/server: create smbd_parent_context earlier
    
    metze

commit dc38db31ba3166148e41f7551b5160cc761f93f2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:31:09 2011 +0100

    s3:smbd/server: remember the ev_ctx on the smbd_parent_context
    
    metze

commit 20c343b8e89df2b87b40b38017b77fa342640f8c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:30:39 2011 +0100

    s3:smbd/server: remember the msg_ctx on the smbd_parent_context
    
    metze

commit e09c675596bb7ae44fda7ee0ba7423761eb4e2e1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:11:58 2011 +0100

    s3:smbd/open: pass smbd_server_connection as private_data to msg_file_was_renamed()
    
    metze

commit 173ea71686fa5ba34f418d6085a68c1c983659c5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:19:06 2011 +0100

    s3:smbd: register MSG_SMB_FILE_RENAME after the fork
    
    The parent smbd doesn't need to handle this, as it doesn't
    have any file handles open.
    
    metze

commit d492a437beb0d2ba03984a4b4564c36987778428
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:11:58 2011 +0100

    s3:smbd/conn_msg: pass smbd_server_connection as private_data to msg_force_tdis()
    
    metze

commit f426eb13c9988d05b948749f379df62c3d5bd0a7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:11:58 2011 +0100

    s3:smbd/blocking: pass smbd_server_connection as private_data to process_blocking_lock_cancel_message()
    
    metze

commit fbcdaa6a45f1234e2230acee4cf9d4cc2d41c6e8
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Dec 13 08:24:25 2011 +0100

    s4:pydsdb: remove unused variable from py_dsdb_am_pdc()
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages-3/smbcontrol.1.xml        |   12 ----
 source3/librpc/idl/messaging.idl            |    4 +-
 source3/rpc_server/netlogon/srv_netlog_nt.c |   14 ----
 source3/smbd/blocking.c                     |   16 +++---
 source3/smbd/conn_msg.c                     |    6 +-
 source3/smbd/open.c                         |    6 +-
 source3/smbd/process.c                      |    4 +-
 source3/smbd/server.c                       |   86 ++++++++++++++++++---------
 source3/utils/smbcontrol.c                  |   30 ---------
 source4/dsdb/pydsdb.c                       |    1 -
 10 files changed, 76 insertions(+), 103 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/smbcontrol.1.xml b/docs-xml/manpages-3/smbcontrol.1.xml
index 31c3537..f83376b 100644
--- a/docs-xml/manpages-3/smbcontrol.1.xml
+++ b/docs-xml/manpages-3/smbcontrol.1.xml
@@ -223,18 +223,6 @@
 	</varlistentry>
 
 	<varlistentry>
-	<term>samsync</term>
-	<listitem><para>Order smbd to synchronise sam database from PDC (being BDC). Can only be sent to <constant>smbd</constant>. </para>
-	<note><para>Not working at the moment</para></note>
-	</listitem>
-	</varlistentry>
-
-	<varlistentry>
-	<term>samrepl</term>
-	<listitem><para>Send sam replication message, with specified serial. Can only be sent to <constant>smbd</constant>. Should not be used manually.</para></listitem>
-	</varlistentry>
-
-	<varlistentry>
 	<term>dmalloc-mark</term>
 	<listitem><para>Set a mark for dmalloc. Can be sent to both smbd and nmbd. Only available if samba is built with dmalloc support. </para></listitem>
 	</varlistentry>
diff --git a/source3/librpc/idl/messaging.idl b/source3/librpc/idl/messaging.idl
index 96ca784..1c80cc2 100644
--- a/source3/librpc/idl/messaging.idl
+++ b/source3/librpc/idl/messaging.idl
@@ -62,8 +62,8 @@ interface messaging
 		/* smbd messages */
 		/* MSG_SMB_CONF_UPDATED		= 0x0301,  Obsoleted */
 		MSG_SMB_FORCE_TDIS		= 0x0302,
-		MSG_SMB_SAM_SYNC		= 0x0303,
-		MSG_SMB_SAM_REPL		= 0x0304,
+		/* MSG_SMB_SAM_SYNC		= 0x0303,  Obsoleted */
+		/* MSG_SMB_SAM_REPL		= 0x0304,  Obsoleted */
 		MSG_SMB_UNLOCK			= 0x0305,
 		MSG_SMB_BREAK_REQUEST		= 0x0306,
 		MSG_SMB_BREAK_RESPONSE		= 0x0307,
diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c
index 26b92c8..05651aa 100644
--- a/source3/rpc_server/netlogon/srv_netlog_nt.c
+++ b/source3/rpc_server/netlogon/srv_netlog_nt.c
@@ -84,16 +84,6 @@ WERROR _netr_LogonControl(struct pipes_struct *p,
 	return _netr_LogonControl2Ex(p, &l);
 }
 
-/****************************************************************************
-Send a message to smbd to do a sam synchronisation
-**************************************************************************/
-
-static void send_sync_message(struct messaging_context *msg_ctx)
-{
-        DEBUG(3, ("sending sam synchronisation message\n"));
-        message_send_all(msg_ctx, MSG_SMB_SAM_SYNC, NULL, 0, NULL);
-}
-
 /*************************************************************************
  _netr_LogonControl2
  *************************************************************************/
@@ -389,10 +379,6 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p,
 		return WERR_UNKNOWN_LEVEL;
 	}
 
-        if (lp_server_role() == ROLE_DOMAIN_BDC) {
-                send_sync_message(p->msg_ctx);
-	}
-
 	return WERR_OK;
 }
 
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 5520fec..ad1bbe3 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -828,10 +828,16 @@ static void process_blocking_lock_cancel_message(struct messaging_context *ctx,
 						 struct server_id server_id,
 						 DATA_BLOB *data)
 {
-	struct smbd_server_connection *sconn;
 	NTSTATUS err;
 	const char *msg = (const char *)data->data;
 	struct blocking_lock_record *blr;
+	struct smbd_server_connection *sconn =
+		talloc_get_type(private_data,
+		struct smbd_server_connection);
+
+	if (sconn == NULL) {
+		return;
+	}
 
 	if (data->data == NULL) {
 		smb_panic("process_blocking_lock_cancel_message: null msg");
@@ -843,12 +849,6 @@ static void process_blocking_lock_cancel_message(struct messaging_context *ctx,
 		smb_panic("process_blocking_lock_cancel_message: bad msg");
         }
 
-	sconn = msg_ctx_to_sconn(ctx);
-	if (sconn == NULL) {
-		DEBUG(1, ("could not find sconn\n"));
-		return;
-	}
-
 	memcpy(&blr, msg, sizeof(blr));
 	memcpy(&err, &msg[sizeof(blr)], sizeof(NTSTATUS));
 
@@ -880,7 +880,7 @@ struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
 
 	if (!sconn->smb1.locks.blocking_lock_cancel_state) {
 		/* Register our message. */
-		messaging_register(sconn->msg_ctx, NULL,
+		messaging_register(sconn->msg_ctx, sconn,
 				   MSG_SMB_BLOCKING_LOCK_CANCEL,
 				   process_blocking_lock_cancel_message);
 
diff --git a/source3/smbd/conn_msg.c b/source3/smbd/conn_msg.c
index b0c968a..96171e2 100644
--- a/source3/smbd/conn_msg.c
+++ b/source3/smbd/conn_msg.c
@@ -36,12 +36,12 @@ void msg_force_tdis(struct messaging_context *msg,
 		    struct server_id server_id,
 		    DATA_BLOB *data)
 {
-	struct smbd_server_connection *sconn;
 	const char *sharename = (const char *)data->data;
+	struct smbd_server_connection *sconn =
+		talloc_get_type(private_data,
+		struct smbd_server_connection);
 
-	sconn = msg_ctx_to_sconn(msg);
 	if (sconn == NULL) {
-		DEBUG(1, ("could not find sconn\n"));
 		return;
 	}
 
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index fceebcb..a697ee8 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2992,7 +2992,6 @@ void msg_file_was_renamed(struct messaging_context *msg,
 			  struct server_id server_id,
 			  DATA_BLOB *data)
 {
-	struct smbd_server_connection *sconn;
 	files_struct *fsp;
 	char *frm = (char *)data->data;
 	struct file_id id;
@@ -3002,10 +3001,11 @@ void msg_file_was_renamed(struct messaging_context *msg,
 	struct smb_filename *smb_fname = NULL;
 	size_t sp_len, bn_len;
 	NTSTATUS status;
+	struct smbd_server_connection *sconn =
+		talloc_get_type(private_data,
+		struct smbd_server_connection);
 
-	sconn = msg_ctx_to_sconn(msg);
 	if (sconn == NULL) {
-		DEBUG(1, ("could not find sconn\n"));
 		return;
 	}
 
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 3b3c104..ad5c096 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3135,10 +3135,12 @@ void smbd_process(struct tevent_context *ev_ctx,
 		exit_server("Failed to init oplocks");
 
 	/* register our message handlers */
-	messaging_register(sconn->msg_ctx, NULL,
+	messaging_register(sconn->msg_ctx, sconn,
 			   MSG_SMB_FORCE_TDIS, msg_force_tdis);
 	messaging_register(sconn->msg_ctx, sconn,
 			   MSG_SMB_CLOSE_FILE, msg_close_file);
+	messaging_register(sconn->msg_ctx, sconn,
+			   MSG_SMB_FILE_RENAME, msg_file_was_renamed);
 
 	/*
 	 * Use the default MSG_DEBUG handler to avoid rebroadcasting
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index cc51979..bef1a13 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -117,20 +117,6 @@ static void  killkids(void)
 	if(am_parent) kill(0,SIGTERM);
 }
 
-/****************************************************************************
- Process a sam sync message - not sure whether to do this here or
- somewhere else.
-****************************************************************************/
-
-static void msg_sam_sync(struct messaging_context *msg,
-			 void *private_data,
-			 uint32_t msg_type,
-			 struct server_id server_id,
-			 DATA_BLOB *data)
-{
-        DEBUG(10, ("** sam sync message received, ignoring\n"));
-}
-
 static void msg_exit_server(struct messaging_context *msg,
 			    void *private_data,
 			    uint32_t msg_type,
@@ -358,6 +344,9 @@ struct smbd_open_socket;
 struct smbd_parent_context {
 	bool interactive;
 
+	struct tevent_context *ev_ctx;
+	struct messaging_context *msg_ctx;
+
 	/* the list of listening sockets */
 	struct smbd_open_socket *sockets;
 };
@@ -367,7 +356,6 @@ struct smbd_open_socket {
 	struct smbd_parent_context *parent;
 	int fd;
 	struct tevent_fd *fde;
-	struct messaging_context *msg_ctx;
 };
 
 static void smbd_open_socket_close_fn(struct tevent_context *ev,
@@ -386,7 +374,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 {
 	struct smbd_open_socket *s = talloc_get_type_abort(private_data,
 				     struct smbd_open_socket);
-	struct messaging_context *msg_ctx = s->msg_ctx;
+	struct messaging_context *msg_ctx = s->parent->msg_ctx;
 	struct smbd_server_connection *sconn = msg_ctx_to_sconn(msg_ctx);
 	struct sockaddr_storage addr;
 	socklen_t in_addrlen = sizeof(addr);
@@ -573,7 +561,6 @@ static bool smbd_open_one_socket(struct smbd_parent_context *parent,
 		return false;
 	}
 
-	s->msg_ctx = msg_ctx;
 	s->fde = tevent_add_fd(ev_ctx,
 			       s,
 			       s->fd, TEVENT_FD_READ,
@@ -747,10 +734,7 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 
         /* Listen to messages */
 
-	messaging_register(msg_ctx, NULL, MSG_SMB_SAM_SYNC, msg_sam_sync);
 	messaging_register(msg_ctx, NULL, MSG_SHUTDOWN, msg_exit_server);
-	messaging_register(msg_ctx, NULL, MSG_SMB_FILE_RENAME,
-			   msg_file_was_renamed);
 	messaging_register(msg_ctx, ev_ctx, MSG_SMB_CONF_UPDATED,
 			   smb_conf_updated);
 	messaging_register(msg_ctx, NULL, MSG_SMB_STAT_CACHE_DELETE,
@@ -835,6 +819,34 @@ static bool init_structs(void )
 	return True;
 }
 
+static void smbd_parent_sig_term_handler(struct tevent_context *ev,
+					 struct tevent_signal *se,
+					 int signum,
+					 int count,
+					 void *siginfo,
+					 void *private_data)
+{
+	exit_server_cleanly("termination signal");
+}
+
+static void smbd_parent_sig_hup_handler(struct tevent_context *ev,
+					struct tevent_signal *se,
+					int signum,
+					int count,
+					void *siginfo,
+					void *private_data)
+{
+	struct smbd_parent_context *parent =
+		talloc_get_type_abort(private_data,
+		struct smbd_parent_context);
+
+	change_to_root_user();
+	DEBUG(1,("parent: Reloading services after SIGHUP\n"));
+	reload_services(parent->msg_ctx, -1, false);
+
+	printing_subsystem_update(parent->ev_ctx, parent->msg_ctx, true);
+}
+
 /****************************************************************************
  main program.
 ****************************************************************************/
@@ -885,6 +897,7 @@ extern void build_options(bool screen);
 	uint64_t unique_id;
 	struct tevent_context *ev_ctx;
 	struct messaging_context *msg_ctx;
+	struct tevent_signal *se;
 
 	/*
 	 * Do this before any other talloc operation
@@ -1127,9 +1140,30 @@ extern void build_options(bool screen);
 
 	smbd_server_conn->msg_ctx = msg_ctx;
 
-	smbd_setup_sig_term_handler();
-	smbd_setup_sig_hup_handler(ev_ctx,
-				   msg_ctx);
+	parent = talloc_zero(ev_ctx, struct smbd_parent_context);
+	if (!parent) {
+		exit_server("talloc(struct smbd_parent_context) failed");
+	}
+	parent->interactive = interactive;
+	parent->ev_ctx = ev_ctx;
+	parent->msg_ctx = msg_ctx;
+
+	se = tevent_add_signal(parent->ev_ctx,
+			       parent,
+			       SIGTERM, 0,
+			       smbd_parent_sig_term_handler,
+			       parent);
+	if (!se) {
+		exit_server("failed to setup SIGTERM handler");
+	}
+	se = tevent_add_signal(parent->ev_ctx,
+			       parent,
+			       SIGHUP, 0,
+			       smbd_parent_sig_hup_handler,
+			       parent);
+	if (!se) {
+		exit_server("failed to setup SIGHUP handler");
+	}
 
 	/* Setup all the TDB's - including CLEAR_IF_FIRST tdb's. */
 
@@ -1285,12 +1319,6 @@ extern void build_options(bool screen);
 		return(0);
 	}
 
-	parent = talloc_zero(ev_ctx, struct smbd_parent_context);
-	if (!parent) {
-		exit_server("talloc(struct smbd_parent_context) failed");
-	}
-	parent->interactive = interactive;
-
 	if (!open_sockets_smbd(parent, ev_ctx, msg_ctx, ports))
 		exit_server("open_sockets_smbd() failed");
 
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 747c35c..f0eafa0 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -822,34 +822,6 @@ static bool do_brl_revalidate(struct messaging_context *msg_ctx,
 	return send_message(msg_ctx, pid, MSG_SMB_BRL_VALIDATE, NULL, 0);
 }
 
-/* Force a SAM synchronisation */
-
-static bool do_samsync(struct messaging_context *msg_ctx,
-		       const struct server_id pid,
-		       const int argc, const char **argv)
-{
-	if (argc != 1) {
-		fprintf(stderr, "Usage: smbcontrol <dest> samsync\n");
-		return False;
-	}
-
-	return send_message(msg_ctx, pid, MSG_SMB_SAM_SYNC, NULL, 0);
-}
-
-/* Force a SAM replication */
-
-static bool do_samrepl(struct messaging_context *msg_ctx,
-		       const struct server_id pid,
-		       const int argc, const char **argv)
-{
-	if (argc != 1) {
-		fprintf(stderr, "Usage: smbcontrol <dest> samrepl\n");
-		return False;
-	}
-
-	return send_message(msg_ctx, pid, MSG_SMB_SAM_REPL, NULL, 0);
-}
-
 /* Display talloc pool usage */
 
 static bool do_poolusage(struct messaging_context *msg_ctx,
@@ -1268,8 +1240,6 @@ static const struct {
 	{ "ip-dropped", do_ip_dropped, "Tell winbind that an IP got dropped" },
 	{ "lockretry", do_lockretry, "Force a blocking lock retry" },
 	{ "brl-revalidate", do_brl_revalidate, "Revalidate all brl entries" },
-        { "samsync", do_samsync, "Initiate SAM synchronisation" },
-        { "samrepl", do_samrepl, "Initiate SAM replication" },
 	{ "pool-usage", do_poolusage, "Display talloc memory usage" },
 	{ "dmalloc-mark", do_dmalloc_mark, "" },
 	{ "dmalloc-log-changed", do_dmalloc_changed, "" },
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index 738ea6d..f9896c0 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -952,7 +952,6 @@ static PyObject *py_dsdb_am_pdc(PyObject *self, PyObject *args)
 {
 	PyObject *py_ldb;
 	struct ldb_context *ldb;
-	int ret;
 	bool am_pdc;
 
 	if (!PyArg_ParseTuple(args, "O", &py_ldb))


-- 
Samba Shared Repository


More information about the samba-cvs mailing list