[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-171-gf6d8d94

Stefan Metzmacher metze at samba.org
Tue Jan 27 14:28:56 GMT 2009


The branch, master has been updated
       via  f6d8d94510498796e24fe5c52cb5ff3b14fd7f97 (commit)
       via  e0232934fbf69a9e72de1d9844b14d70b34a2d6a (commit)
       via  bf2347bd7df19156da8a2884e41ca5b98a3c94c6 (commit)
       via  e11e82318c92fdfdc231eb48abb2fb6faac3dcf0 (commit)
       via  52f6a4436f9da439fc687894b329898833af7ff8 (commit)
       via  4a2271349503933776f9d2791edfcb874a2c7261 (commit)
       via  b8c416fe2ac37b3ba0124811cfeddf2015c8d31f (commit)
       via  d361e332a86075c5c1f76e334b869da8aaa34b01 (commit)
       via  2630d4a2523894386f4e1a37cfb3a312f4e8fdf5 (commit)
       via  e663df195c2a6c108e90273b8fa9831abdbc3b1c (commit)
       via  e6612c99fe6c2cb87f09dbc76d077bed789a592d (commit)
       via  ac61f650ae640c13beee9d48304d7939f700aa11 (commit)
       via  27f812f3a85ce21ca79143f59c823913f57fa507 (commit)
       via  6a2b7f98151ef0b5b434e1ed522a47770e2151ea (commit)
       via  7d93d3d4b8db230ceb51a81f18650b8114528f1f (commit)
       via  920f8b15685eb3f378c6ba5865a57e5f4d36e042 (commit)
      from  a7e620522e72e27361ebe34172048db458fe581a (commit)

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


- Log -----------------------------------------------------------------
commit f6d8d94510498796e24fe5c52cb5ff3b14fd7f97
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 27 09:48:48 2009 +0100

    s3:rpc_server: use get_client_fd() instead of smbd_server_fd()
    
    Both are absolutely the same, but smbd_server_fd() is otherwise
    only used in smbd/*.c and would like to remove smbd_server_fd() soon.
    
    metze

commit e0232934fbf69a9e72de1d9844b14d70b34a2d6a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 27 10:02:43 2009 +0100

    s3:smbd: wait for new connection via fd events
    
    metze

commit bf2347bd7df19156da8a2884e41ca5b98a3c94c6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jan 26 14:55:54 2009 +0100

    s3:smbd: make mdns registration event driven.
    
    metze

commit e11e82318c92fdfdc231eb48abb2fb6faac3dcf0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 23 13:08:22 2009 +0100

    s3:smbd: make inetd code path more clear
    
    metze

commit 52f6a4436f9da439fc687894b329898833af7ff8
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 23 10:08:44 2009 +0100

    s3:smbd: make kernel oplocks event driven
    
    And use signal events for Linux oplocks.
    
    metze

commit 4a2271349503933776f9d2791edfcb874a2c7261
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 23 10:07:45 2009 +0100

    s3:smbd: remove pointless respond_to_all_remaining_local_messages() function
    
    This the process_kernel_oplock() function never response to messages,
    it only generates messages to ourself.
    
    metze

commit b8c416fe2ac37b3ba0124811cfeddf2015c8d31f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 22 18:04:17 2009 +0100

    s3:smbd: convert aio to use tevent_signal
    
    metze

commit d361e332a86075c5c1f76e334b869da8aaa34b01
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 22 16:17:23 2009 +0100

    s3:nmbd: handle SIG_TERM and SIGHUP via tevent
    
    metze

commit 2630d4a2523894386f4e1a37cfb3a312f4e8fdf5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 23 10:15:00 2009 +0100

    s3:nmbd: as the sig_term() handler only sets a flag we don't need to block SIGTERM
    
    The arguments of commit d98bea900ee694cdba83149620c65bd7f8765f26
    are no longer valid.
    
    metze

commit e663df195c2a6c108e90273b8fa9831abdbc3b1c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 23 10:13:29 2009 +0100

    s3:nmbd: install the SIG_DFL handler for SIGTERM while we're waiting for interfaces
    
    We should handle all 3 cases where we actively wait for interfaces
    in the same way.
    
    metze

commit e6612c99fe6c2cb87f09dbc76d077bed789a592d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 22 14:54:21 2009 +0100

    s3:winbindd: handle SIG_TERM, SIGHUP, SIGCHLD and SIGUSR2 via tevent
    
    metze

commit ac61f650ae640c13beee9d48304d7939f700aa11
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jan 21 23:24:18 2009 +0100

    s3:smbd: use signal events for SIGTERM, SIGHUP and SIGCHLD
    
    metze

commit 27f812f3a85ce21ca79143f59c823913f57fa507
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 22 12:36:42 2009 +0100

    s3:smbd: move all code that handles a client connection into smbd_process()
    
    metze

commit 6a2b7f98151ef0b5b434e1ed522a47770e2151ea
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 22 10:13:45 2009 +0100

    s3:smbd: we should setup the client socket in the same way in all code pathes
    
    We should behave the same in inetd, interactive and deamon modes.
    
    metze

commit 7d93d3d4b8db230ceb51a81f18650b8114528f1f
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jan 22 10:19:14 2009 +0100

    s3:namecache: remove unused namecache_shutdown() function
    
    metze

commit 920f8b15685eb3f378c6ba5865a57e5f4d36e042
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jan 23 10:42:31 2009 +0100

    tevent: change SA_INFO_QUEUE_COUNT from 10 to 100
    
    The samba3 aio code requires lp_max_mux() with a default of 50
    and the samba3 linux oplock code requires 100.
    
    May we could make the size dynamic later.
    
    metze

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

Summary of changes:
 lib/tevent/tevent_signal.c          |    2 +-
 source3/include/includes.h          |   14 -
 source3/include/proto.h             |   37 +--
 source3/include/smb.h               |    2 -
 source3/libsmb/namecache.c          |   21 -
 source3/modules/vfs_aio_fork.c      |    3 +-
 source3/nmbd/asyncdns.c             |   12 -
 source3/nmbd/nmbd.c                 |  134 +++---
 source3/nmbd/nmbd_packets.c         |    8 -
 source3/printing/printing.c         |   18 +-
 source3/rpc_server/srv_spoolss_nt.c |    2 +-
 source3/smbd/aio.c                  |  150 +++-----
 source3/smbd/dnsregister.c          |  208 +++++-----
 source3/smbd/globals.c              |   15 +-
 source3/smbd/globals.h              |   12 +-
 source3/smbd/oplock.c               |   64 +---
 source3/smbd/oplock_irix.c          |   15 +-
 source3/smbd/oplock_linux.c         |   66 +--
 source3/smbd/process.c              |  370 +++++++++++-----
 source3/smbd/server.c               |  818 ++++++++++++----------------------
 source3/winbindd/winbindd.c         |  227 +++++++---
 source3/winbindd/winbindd_dual.c    |   11 +-
 source3/winbindd/winbindd_proto.h   |    4 +-
 23 files changed, 981 insertions(+), 1232 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index c21ba20..04ee697 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -29,7 +29,7 @@
 #define NUM_SIGNALS 64
 
 /* maximum number of SA_SIGINFO signals to hold in the queue */
-#define SA_INFO_QUEUE_COUNT 10
+#define SA_INFO_QUEUE_COUNT 100
 
 struct sigcounter {
 	uint32_t count;
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 50140c1..ea856f1 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -678,20 +678,6 @@ struct printjob;
 
 #include "smb_ldap.h"
 
-struct dns_reg_state;
-
-void dns_register_smbd(struct dns_reg_state ** dns_state_ptr,
-		unsigned port,
-		int *maxfd,
-		fd_set *listen_set,
-		struct timeval *timeout);
-
-void dns_register_close(struct dns_reg_state ** dns_state_ptr);
-
-
-bool dns_register_smbd_reply(struct dns_reg_state *dns_state,
-		fd_set *lfds, struct timeval *timeout);
-
 /*
  * Reasons for cache flush.
  */
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 8838419..f8a9dbc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2944,7 +2944,6 @@ NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
 /* The following definitions come from libsmb/namecache.c  */
 
 bool namecache_enable(void);
-bool namecache_shutdown(void);
 bool namecache_store(const char *name,
 			int name_type,
 			int num_names,
@@ -6476,8 +6475,6 @@ REGVAL_CTR *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token );
 
 /* The following definitions come from smbd/aio.c  */
 
-void aio_request_done(uint16_t mid);
-bool aio_finished(void);
 void initialize_async_io_handler(void);
 bool schedule_aio_read_and_X(connection_struct *conn,
 			     struct smb_request *req,
@@ -6488,23 +6485,9 @@ bool schedule_aio_write_and_X(connection_struct *conn,
 			      files_struct *fsp, char *data,
 			      SMB_OFF_T startpos,
 			      size_t numtowrite);
-int process_aio_queue(void);
 int wait_for_aio_completion(files_struct *fsp);
 void cancel_aio_by_fsp(files_struct *fsp);
-bool aio_finished(void);
-void initialize_async_io_handler(void);
-int process_aio_queue(void);
-bool schedule_aio_read_and_X(connection_struct *conn,
-			     struct smb_request *req,
-			     files_struct *fsp, SMB_OFF_T startpos,
-			     size_t smb_maxcnt);
-bool schedule_aio_write_and_X(connection_struct *conn,
-			      struct smb_request *req,
-			      files_struct *fsp, char *data,
-			      SMB_OFF_T startpos,
-			      size_t numtowrite);
-void cancel_aio_by_fsp(files_struct *fsp);
-int wait_for_aio_completion(files_struct *fsp);
+void smbd_aio_complete_mid(unsigned int mid);
 
 /* The following definitions come from smbd/blocking.c  */
 
@@ -6668,14 +6651,9 @@ uint32 dmapi_file_flags(const char * const path);
 
 /* The following definitions come from smbd/dnsregister.c  */
 
-void dns_register_close(struct dns_reg_state **dns_state_ptr);
-void dns_register_smbd(struct dns_reg_state ** dns_state_ptr,
-		unsigned port,
-		int *maxfd,
-		fd_set *listen_set,
-		struct timeval *timeout);
-bool dns_register_smbd_reply(struct dns_reg_state *dns_state,
-		fd_set *lfds, struct timeval *timeout);
+bool smbd_setup_mdns_registration(struct tevent_context *ev,
+				  TALLOC_CTX *mem_ctx,
+				  uint16_t port);
 
 /* The following definitions come from smbd/dosmode.c  */
 
@@ -7035,13 +7013,11 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
 /* The following definitions come from smbd/oplock.c  */
 
 int32 get_number_of_exclusive_open_oplocks(void);
-bool oplock_message_waiting(void);
-void process_kernel_oplocks(struct messaging_context *msg_ctx);
+void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
 bool set_file_oplock(files_struct *fsp, int oplock_type);
 void release_file_oplock(files_struct *fsp);
 bool remove_oplock(files_struct *fsp);
 bool downgrade_oplock(files_struct *fsp);
-int oplock_notify_fd(void);
 void reply_to_oplock_break_requests(files_struct *fsp);
 void release_level_2_oplocks_on_change(files_struct *fsp);
 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
@@ -7116,6 +7092,8 @@ SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
 
 /* The following definitions come from smbd/process.c  */
 
+void smbd_setup_sig_term_handler(void);
+void smbd_setup_sig_hup_handler(void);
 bool srv_send_smb(int fd, char *buffer, bool do_encrypt);
 int srv_set_message(char *buf,
                         int num_words,
@@ -7141,7 +7119,6 @@ struct idle_event *event_add_idle(struct event_context *event_ctx,
 						  void *private_data),
 				  void *private_data);
 NTSTATUS allow_new_trans(struct trans_state *list, int mid);
-void respond_to_all_remaining_local_messages(void);
 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
 const char *smb_fn_name(int type);
 void add_to_common_flags2(uint32 v);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index aa2db69..3f71cde 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1680,12 +1680,10 @@ struct kernel_oplocks {
 /* if a kernel does support oplocks then a structure of the following
    typee is used to describe how to interact with the kernel */
 struct kernel_oplocks_ops {
-	files_struct * (*receive_message)(struct kernel_oplocks *ctx);
 	bool (*set_oplock)(struct kernel_oplocks *ctx,
 			   files_struct *fsp, int oplock_type);
 	void (*release_oplock)(struct kernel_oplocks *ctx,
 			       files_struct *fsp);
-	bool (*msg_waiting)(struct kernel_oplocks *ctx);
 };
 
 #include "smb_macros.h"
diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c
index ba706e5..d3230cf 100644
--- a/source3/libsmb/namecache.c
+++ b/source3/libsmb/namecache.c
@@ -62,27 +62,6 @@ bool namecache_enable(void)
 }
 
 /**
- * Shutdown namecache. Routine calls gencache close function
- * to safely close gencache file.
- *
- * @return true upon successful shutdown of the cache or
- *         false on failure
- **/
-
-bool namecache_shutdown(void)
-{
-	if (!gencache_shutdown()) {
-		DEBUG(2, ("namecache_shutdown: "
-			"Couldn't close namecache on top of gencache.\n"));
-		return False;
-	}
-
-	DEBUG(5, ("namecache_shutdown: "
-		"netbios namecache closed successfully.\n"));
-	return True;
-}
-
-/**
  * Generates a key for netbios name lookups on basis of
  * netbios name and type.
  * The caller must free returned key string when finished.
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 30b14f2..e29ce5e 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -406,8 +406,7 @@ static void handle_aio_completion(struct event_context *event_ctx,
 
 	DEBUG(10, ("mid %d finished\n", (int)mid));
 
-	aio_request_done(mid);
-	process_aio_queue();
+	smbd_aio_complete_mid(mid);
 }
 
 static int aio_child_destructor(struct aio_child *child)
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index baa88bc..0736a66 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -210,9 +210,6 @@ void run_dns_queue(void)
 	if (fd_in == -1)
 		return;
 
-        /* Allow SIGTERM to kill us. */
-        BlockSignals(False, SIGTERM);
-
 	if (!process_exists_by_pid(child_pid)) {
 		close(fd_in);
 		close(fd_out);
@@ -224,12 +221,9 @@ void run_dns_queue(void)
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0, ("read from child failed: %s\n", nt_errstr(status)));
 		fd_in = -1;
-                BlockSignals(True, SIGTERM);
 		return;
 	}
 
-        BlockSignals(True, SIGTERM);
-
 	namerec = add_dns_result(&r.name, r.result);
 
 	if (dns_current) {
@@ -338,14 +332,8 @@ bool queue_dns_query(struct packet_struct *p,struct nmb_name *question)
 
 	DEBUG(3,("DNS search for %s - ", nmb_namestr(question)));
 
-        /* Unblock TERM signal so we can be killed in DNS lookup. */
-        BlockSignals(False, SIGTERM);
-
 	dns_ip.s_addr = interpret_addr(qname);
 
-        /* Re-block TERM signal. */
-        BlockSignals(True, SIGTERM);
-
 	namerec = add_dns_result(question, dns_ip);
 	if(namerec == NULL) {
 		send_wins_name_query_response(NAM_ERR, p, NULL);
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 0922e45..adefb7d 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -85,41 +85,80 @@ static void terminate(void)
 	exit(0);
 }
 
-/**************************************************************************** **
- Handle a SHUTDOWN message from smbcontrol.
- **************************************************************************** */
-
-static void nmbd_terminate(struct messaging_context *msg,
-			   void *private_data,
-			   uint32_t msg_type,
-			   struct server_id server_id,
-			   DATA_BLOB *data)
+static void nmbd_sig_term_handler(struct tevent_context *ev,
+				  struct tevent_signal *se,
+				  int signum,
+				  int count,
+				  void *siginfo,
+				  void *private_data)
 {
 	terminate();
 }
 
-/**************************************************************************** **
- Catch a SIGTERM signal.
- **************************************************************************** */
+static bool nmbd_setup_sig_term_handler(void)
+{
+	struct tevent_signal *se;
+
+	se = tevent_add_signal(nmbd_event_context(),
+			       nmbd_event_context(),
+			       SIGTERM, 0,
+			       nmbd_sig_term_handler,
+			       NULL);
+	if (!se) {
+		DEBUG(0,("failed to setup SIGTERM handler"));
+		return false;
+	}
 
-static SIG_ATOMIC_T got_sig_term;
+	return true;
+}
+
+static void msg_reload_nmbd_services(struct messaging_context *msg,
+				     void *private_data,
+				     uint32_t msg_type,
+				     struct server_id server_id,
+				     DATA_BLOB *data);
+
+static void nmbd_sig_hup_handler(struct tevent_context *ev,
+				 struct tevent_signal *se,
+				 int signum,
+				 int count,
+				 void *siginfo,
+				 void *private_data)
+{
+	DEBUG(0,("Got SIGHUP dumping debug info.\n"));
+	msg_reload_nmbd_services(nmbd_messaging_context(),
+				 NULL, MSG_SMB_CONF_UPDATED,
+				 procid_self(), NULL);
+}
 
-static void sig_term(int sig)
+static bool nmbd_setup_sig_hup_handler(void)
 {
-	got_sig_term = 1;
-	sys_select_signal(SIGTERM);
+	struct tevent_signal *se;
+
+	se = tevent_add_signal(nmbd_event_context(),
+			       nmbd_event_context(),
+			       SIGHUP, 0,
+			       nmbd_sig_hup_handler,
+			       NULL);
+	if (!se) {
+		DEBUG(0,("failed to setup SIGHUP handler"));
+		return false;
+	}
+
+	return true;
 }
 
 /**************************************************************************** **
- Catch a SIGHUP signal.
+ Handle a SHUTDOWN message from smbcontrol.
  **************************************************************************** */
 
-static SIG_ATOMIC_T reload_after_sighup;
-
-static void sig_hup(int sig)
+static void nmbd_terminate(struct messaging_context *msg,
+			   void *private_data,
+			   uint32_t msg_type,
+			   struct server_id server_id,
+			   DATA_BLOB *data)
 {
-	reload_after_sighup = 1;
-	sys_select_signal(SIGHUP);
+	terminate();
 }
 
 /**************************************************************************** **
@@ -282,6 +321,7 @@ static void reload_interfaces(time_t t)
 
 	/* We need to wait if there are no subnets... */
 	if (FIRST_SUBNET == NULL) {
+		void (*saved_handler)(int);
 
 		if (print_waiting_msg) {
 			DEBUG(0,("reload_interfaces: "
@@ -293,29 +333,20 @@ static void reload_interfaces(time_t t)
 		 * Whilst we're waiting for an interface, allow SIGTERM to
 		 * cause us to exit.
 		 */
-
-		BlockSignals(false, SIGTERM);
+		saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
 
 		/* We only count IPv4, non-loopback interfaces here. */
-		while (iface_count_v4_nl() == 0 && !got_sig_term) {
+		while (iface_count_v4_nl() == 0) {
 			sleep(5);
 			load_interfaces();
 		}
 
-		/*
-		 * Handle termination inband.
-		 */
-
-		if (got_sig_term) {
-			got_sig_term = 0;
-			terminate();
-		}
+		CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
 
 		/*
 		 * We got an interface, go back to blocking term.
 		 */
 
-		BlockSignals(true, SIGTERM);
 		goto try_again;
 	}
 }
@@ -460,15 +491,6 @@ static void process(void)
 		}
 
 		/*
-		 * Handle termination inband.
-		 */
-
-		if (got_sig_term) {
-			got_sig_term = 0;
-			terminate();
-		}
-
-		/*
 		 * Process all incoming packets
 		 * read above. This calls the success and
 		 * failure functions registered when response
@@ -637,19 +659,6 @@ static void process(void)
 
 		clear_unexpected(t);
 
-		/*
-		 * Reload the services file if we got a sighup.
-		 */
-
-		if(reload_after_sighup) {
-			DEBUG( 0, ( "Got SIGHUP dumping debug info.\n" ) );
-			msg_reload_nmbd_services(nmbd_messaging_context(),
-						 NULL, MSG_SMB_CONF_UPDATED,
-						 procid_self(), NULL);
-
-			reload_after_sighup = 0;
-		}
-
 		/* check for new network interfaces */
 
 		reload_interfaces(t);
@@ -815,10 +824,7 @@ static bool open_sockets(bool isdaemon, int port)
 	BlockSignals(False, SIGHUP);
 	BlockSignals(False, SIGUSR1);
 	BlockSignals(False, SIGTERM);
-	
-	CatchSignal( SIGHUP,  SIGNAL_CAST sig_hup );
-	CatchSignal( SIGTERM, SIGNAL_CAST sig_term );
-	
+
 #if defined(SIGFPE)
 	/* we are never interested in SIGFPE */
 	BlockSignals(True,SIGFPE);
@@ -913,6 +919,11 @@ static bool open_sockets(bool isdaemon, int port)
 		exit(1);
 	}
 
+	if (!nmbd_setup_sig_term_handler())
+		exit(1);
+	if (!nmbd_setup_sig_hup_handler())
+		exit(1);
+
 	/* get broadcast messages */
 	claim_connection(NULL,"",FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP);
 
@@ -977,9 +988,6 @@ static bool open_sockets(bool isdaemon, int port)
 		exit(1);
 	}
 
-	/* We can only take signals in the select. */
-	BlockSignals( True, SIGTERM );
-
 	TALLOC_FREE(frame);
 	process();
 
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 4890348..f69845b 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1794,16 +1794,8 @@ bool listen_for_packets(bool run_election)
 					 &r_fds, &w_fds, &timeout, &maxfd);
 	}
 
-	/* Prepare for the select - allow certain signals. */
-
-	BlockSignals(False, SIGTERM);
-
 	selrtn = sys_select(maxfd+1,&r_fds,&w_fds,NULL,&timeout);
 
-	/* We can only take signals when we are in the select - block them again here. */
-
-	BlockSignals(True, SIGTERM);
-
 	if (run_events(nmbd_event_context(), selrtn, &r_fds, &w_fds)) {
 		return False;
 	}
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index bb29380..0721713 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -22,8 +22,6 @@
 #include "includes.h"
 #include "printing.h"
 
-extern SIG_ATOMIC_T got_sig_term;
-extern SIG_ATOMIC_T reload_after_sighup;
 extern struct current_user current_user;
 extern userdom_struct current_user_info;
 
@@ -1427,6 +1425,9 @@ void start_background_queue(void)
 			smb_panic("reinit_after_fork() failed");
 		}
 
+		smbd_setup_sig_term_handler();
+		smbd_setup_sig_hup_handler();
+
 		claim_connection( NULL, "smbd lpq backend",
 			FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list