[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Aug 8 15:38:25 MDT 2010


The branch, master has been updated
       via  016418d... s3: Remove the smbd_messaging_context from load_printers
       via  1c1d83a... s3: Remove the smbd_messaging_context from pcap_cache_reload
       via  795589b... s3: Remove the smbd_messaging_context from cups_cache_reload
       via  83045b1... s3: Remove the smbd_messaging_context from cups_pcap_load_async
       via  d0ac5c6... s3: Remove the smbd_messaging_context from smb_conf_updated
       via  10a76f5... s3: Remove the smbd_messaging_context from spoolss_init_cb
       via  b71f2af... s3: Remove some smbd_messaging_context references from smbd_process
       via  37d71a5... s3: Pass sconn to smbd_process
       via  1702b17... s3: Lift the server_messaging_context from housekeeping_fn
       via  e64bd85... s3: Lift the server_messaging_context from check_reload
       via  53ed39d... s3: Make check_reload() static
      from  f089675... s3: Lift the server_messaging_context from spoolss_setjob_1

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


- Log -----------------------------------------------------------------
commit 016418d6c240da20f010d2bbd95051feef0a5244
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 22:54:43 2010 +0200

    s3: Remove the smbd_messaging_context from load_printers

commit 1c1d83a5327b86042df7c33d075e05adff7a30f2
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 22:53:02 2010 +0200

    s3: Remove the smbd_messaging_context from pcap_cache_reload

commit 795589b4f81b8d40d3cd6a53b85153df01e3ff01
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 22:50:28 2010 +0200

    s3: Remove the smbd_messaging_context from cups_cache_reload

commit 83045b1ba9fb8aa211d94b66453e2a2a61cae7ed
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 22:47:45 2010 +0200

    s3: Remove the smbd_messaging_context from cups_pcap_load_async

commit d0ac5c69fb0460e8ae2882a75df3415fd4d95323
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 18:55:03 2010 +0200

    s3: Remove the smbd_messaging_context from smb_conf_updated

commit 10a76f5d42253aa726104f38a325424e6cf1d7ad
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 18:53:15 2010 +0200

    s3: Remove the smbd_messaging_context from spoolss_init_cb

commit b71f2af1a6e0db46c6aaf3a732e8352f340fdfac
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 18:48:01 2010 +0200

    s3: Remove some smbd_messaging_context references from smbd_process

commit 37d71a56fd95dfa8687dcbf88eaa6114c316d96d
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 18:47:02 2010 +0200

    s3: Pass sconn to smbd_process

commit 1702b17494523ff7fad513268bad59148a08ac5b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 18:43:37 2010 +0200

    s3: Lift the server_messaging_context from housekeeping_fn

commit e64bd85d90b2ccb6ee89bb5d4c5d50d3f991d423
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 18:42:12 2010 +0200

    s3: Lift the server_messaging_context from check_reload

commit 53ed39de4aee1e0def1423b0c53e903d1be0741c
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Aug 8 18:41:13 2010 +0200

    s3: Make check_reload() static

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

Summary of changes:
 source3/include/proto.h       |    9 ++--
 source3/printing/load.c       |    8 ++-
 source3/printing/pcap.c       |    5 +-
 source3/printing/pcap.h       |    3 +-
 source3/printing/print_cups.c |   18 ++++----
 source3/smbd/process.c        |   89 +++++++++++++++++++++-------------------
 source3/smbd/server.c         |    8 ++--
 source3/smbd/server_reload.c  |    4 +-
 source3/web/swat.c            |    4 +-
 9 files changed, 79 insertions(+), 69 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 63a1095..18b3754 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4396,7 +4396,8 @@ bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
 
 /* The following definitions come from printing/load.c  */
 
-void load_printers(void);
+void load_printers(struct tevent_context *ev,
+		   struct messaging_context *msg_ctx);
 
 /* The following definitions come from printing/lpq_parse.c  */
 
@@ -4467,7 +4468,8 @@ void notify_printer_byname(struct tevent_context *ev,
 
 /* The following definitions come from printing/pcap.c  */
 
-void pcap_cache_reload(void);
+void pcap_cache_reload(struct tevent_context *ev,
+		       struct messaging_context *msg_ctx);
 bool pcap_printername_ok(const char *printername);
 
 /* The following definitions come from printing/printing.c  */
@@ -5618,8 +5620,7 @@ void construct_reply_common_req(struct smb_request *req, char *outbuf);
 size_t req_wct_ofs(struct smb_request *req);
 void chain_reply(struct smb_request *req);
 bool req_is_in_chain(struct smb_request *req);
-void check_reload(time_t t);
-void smbd_process(void);
+void smbd_process(struct smbd_server_connection *sconn);
 
 /* The following definitions come from smbd/quotas.c  */
 
diff --git a/source3/printing/load.c b/source3/printing/load.c
index 99b5226..dd5d4ea 100644
--- a/source3/printing/load.c
+++ b/source3/printing/load.c
@@ -52,10 +52,12 @@ static void add_auto_printers(void)
 /***************************************************************************
 load automatic printer services
 ***************************************************************************/
-void load_printers(void)
+void load_printers(struct tevent_context *ev,
+		   struct messaging_context *msg_ctx)
 {
-	if (!pcap_cache_loaded())
-		pcap_cache_reload();
+	if (!pcap_cache_loaded()) {
+		pcap_cache_reload(ev, msg_ctx);
+	}
 
 	add_auto_printers();
 
diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c
index f5502be..d9c2941 100644
--- a/source3/printing/pcap.c
+++ b/source3/printing/pcap.c
@@ -101,7 +101,8 @@ void pcap_cache_replace(const struct pcap_cache *pcache)
 	}
 }
 
-void pcap_cache_reload(void)
+void pcap_cache_reload(struct tevent_context *ev,
+		       struct messaging_context *msg_ctx)
 {
 	const char *pcap_name = lp_printcapname();
 	bool pcap_reloaded = False;
@@ -120,7 +121,7 @@ void pcap_cache_reload(void)
 
 #ifdef HAVE_CUPS
 	if (strequal(pcap_name, "cups")) {
-		pcap_reloaded = cups_cache_reload();
+		pcap_reloaded = cups_cache_reload(ev, msg_ctx);
 		goto done;
 	}
 #endif
diff --git a/source3/printing/pcap.h b/source3/printing/pcap.h
index 47abc0f..67f36d6 100644
--- a/source3/printing/pcap.h
+++ b/source3/printing/pcap.h
@@ -34,7 +34,8 @@ bool aix_cache_reload(void);
 
 /* The following definitions come from printing/print_cups.c  */
 
-bool cups_cache_reload(void);
+bool cups_cache_reload(struct tevent_context *ev,
+		       struct messaging_context *msg_ctx);
 bool cups_pull_comment_location(TALLOC_CTX *mem_ctx,
 				const char *printername,
 				char **comment,
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index cbefa07..f96e8e1 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -393,7 +393,9 @@ static bool cups_cache_reload_async(int fd)
 static struct pcap_cache *local_pcap_copy;
 struct fd_event *cache_fd_event;
 
-static bool cups_pcap_load_async(int *pfd)
+static bool cups_pcap_load_async(struct tevent_context *ev,
+				 struct messaging_context *msg_ctx,
+				 int *pfd)
 {
 	int fds[2];
 	pid_t pid;
@@ -435,9 +437,7 @@ static bool cups_pcap_load_async(int *pfd)
 
 	close_all_print_db();
 
-	status = reinit_after_fork(server_messaging_context(),
-				   server_event_context(), procid_self(),
-				   true);
+	status = reinit_after_fork(msg_ctx, ev, procid_self(), true);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
 		smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
@@ -558,7 +558,8 @@ static void cups_async_callback(struct event_context *event_ctx,
 	TALLOC_FREE(cache_fd_event);
 }
 
-bool cups_cache_reload(void)
+bool cups_cache_reload(struct tevent_context *ev,
+		       struct messaging_context *msg_ctx)
 {
 	int *p_pipe_fd = TALLOC_P(NULL, int);
 
@@ -569,7 +570,7 @@ bool cups_cache_reload(void)
 	*p_pipe_fd = -1;
 
 	/* Set up an async refresh. */
-	if (!cups_pcap_load_async(p_pipe_fd)) {
+	if (!cups_pcap_load_async(ev, msg_ctx, p_pipe_fd)) {
 		return false;
 	}
 	if (!local_pcap_copy) {
@@ -579,8 +580,7 @@ bool cups_cache_reload(void)
 		DEBUG(10,("cups_cache_reload: sync read on fd %d\n",
 			*p_pipe_fd ));
 
-		cups_async_callback(server_event_context(),
-					NULL,
+		cups_async_callback(ev, NULL,
 					EVENT_FD_READ,
 					(void *)p_pipe_fd);
 		if (!local_pcap_copy) {
@@ -595,7 +595,7 @@ bool cups_cache_reload(void)
 			*p_pipe_fd ));
 
 		/* Trigger an event when the pipe can be read. */
-		cache_fd_event = event_add_fd(server_event_context(),
+		cache_fd_event = event_add_fd(ev,
 					NULL, *p_pipe_fd,
 					EVENT_FD_READ,
 					cups_async_callback,
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index d5f4340..05e5390 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2198,7 +2198,7 @@ void chain_reply(struct smb_request *req)
  Check if services need reloading.
 ****************************************************************************/
 
-void check_reload(time_t t)
+static void check_reload(struct messaging_context *msg_ctx, time_t t)
 {
 	time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
 
@@ -2223,7 +2223,7 @@ void check_reload(time_t t)
 	}
 
 	if (t >= last_smb_conf_reload_time+SMBD_RELOAD_CHECK) {
-		reload_services(smbd_messaging_context(), True);
+		reload_services(msg_ctx, True);
 		last_smb_conf_reload_time = t;
 	}
 
@@ -2237,7 +2237,7 @@ void check_reload(time_t t)
 			|| (t-last_printer_reload_time  < 0) ) 
 		{
 			DEBUG( 3,( "Printcap cache time expired.\n"));
-			reload_printers(smbd_messaging_context());
+			reload_printers(msg_ctx);
 			last_printer_reload_time = t;
 		}
 	}
@@ -2466,13 +2466,15 @@ static bool deadtime_fn(const struct timeval *now, void *private_data)
 
 static bool housekeeping_fn(const struct timeval *now, void *private_data)
 {
+	struct messaging_context *msg_ctx = talloc_get_type_abort(
+		private_data, struct messaging_context);
 	change_to_root_user();
 
 	/* update printer queue caches if necessary */
-	update_monitored_printq_cache(smbd_messaging_context());
+	update_monitored_printq_cache(msg_ctx);
 
 	/* check if we need to reload services */
-	check_reload(time(NULL));
+	check_reload(msg_ctx, time(NULL));
 
 	/* Change machine password if neccessary. */
 	attempt_machine_password_change();
@@ -2860,14 +2862,16 @@ fail:
 
 static bool spoolss_init_cb(void *ptr)
 {
-	return nt_printing_tdb_migrate(smbd_messaging_context());
+	struct messaging_context *msg_ctx = talloc_get_type_abort(
+		ptr, struct messaging_context);
+	return nt_printing_tdb_migrate(msg_ctx);
 }
 
 /****************************************************************************
  Process commands from the client
 ****************************************************************************/
 
-void smbd_process(void)
+void smbd_process(struct smbd_server_connection *sconn)
 {
 	TALLOC_CTX *frame = talloc_stackframe();
 	struct sockaddr_storage ss;
@@ -2889,7 +2893,7 @@ void smbd_process(void)
 		 * with the first negprot
 		 * packet.
 		 */
-		smbd_server_conn->using_smb2 = true;
+		sconn->using_smb2 = true;
 	}
 
 	/* Ensure child is set to blocking mode */
@@ -2906,7 +2910,7 @@ void smbd_process(void)
 		DEBUG(level,("getpeername() failed - %s\n", strerror(errno)));
 		exit_server_cleanly("getpeername() failed.\n");
 	}
-	ret = tsocket_address_bsd_from_sockaddr(smbd_server_conn,
+	ret = tsocket_address_bsd_from_sockaddr(sconn,
 						sa, sa_len,
 						&remote_address);
 	if (ret != 0) {
@@ -2923,7 +2927,7 @@ void smbd_process(void)
 		DEBUG(level,("getsockname() failed - %s\n", strerror(errno)));
 		exit_server_cleanly("getsockname() failed.\n");
 	}
-	ret = tsocket_address_bsd_from_sockaddr(smbd_server_conn,
+	ret = tsocket_address_bsd_from_sockaddr(sconn,
 						sa, sa_len,
 						&local_address);
 	if (ret != 0) {
@@ -2932,12 +2936,12 @@ void smbd_process(void)
 		exit_server_cleanly("tsocket_address_bsd_from_sockaddr remote failed.\n");
 	}
 
-	smbd_server_conn->local_address = local_address;
-	smbd_server_conn->remote_address = remote_address;
+	sconn->local_address = local_address;
+	sconn->remote_address = remote_address;
 
 	if (tsocket_address_is_inet(remote_address, "ip")) {
 		remaddr = tsocket_address_inet_addr_string(
-				smbd_server_conn->remote_address,
+				sconn->remote_address,
 				talloc_tos());
 		if (remaddr == NULL) {
 
@@ -2949,7 +2953,7 @@ void smbd_process(void)
 	/* this is needed so that we get decent entries
 	   in smbstatus for port 445 connects */
 	set_remote_machine_name(remaddr, false);
-	reload_services(smbd_server_conn->msg_ctx, true);
+	reload_services(sconn->msg_ctx, true);
 
 	/*
 	 * Before the first packet, check the global hosts allow/ hosts deny
@@ -2997,33 +3001,33 @@ void smbd_process(void)
 		DEBUG(0,("Changed root to %s\n", lp_rootdir()));
 	}
 
-	if (!srv_init_signing(smbd_server_conn)) {
+	if (!srv_init_signing(sconn)) {
 		exit_server("Failed to init smb_signing");
 	}
 
-	if (lp_async_smb_echo_handler() && !fork_echo_handler(smbd_server_conn)) {
+	if (lp_async_smb_echo_handler() && !fork_echo_handler(sconn)) {
 		exit_server("Failed to fork echo handler");
 	}
 
 	/* Setup oplocks */
-	if (!init_oplocks(smbd_messaging_context()))
+	if (!init_oplocks(sconn->msg_ctx))
 		exit_server("Failed to init oplocks");
 
 	/* register our message handlers */
-	messaging_register(smbd_messaging_context(), NULL,
+	messaging_register(sconn->msg_ctx, NULL,
 			   MSG_SMB_FORCE_TDIS, msg_force_tdis);
-	messaging_register(smbd_messaging_context(), NULL,
+	messaging_register(sconn->msg_ctx, NULL,
 			   MSG_SMB_RELEASE_IP, msg_release_ip);
-	messaging_register(smbd_messaging_context(), NULL,
+	messaging_register(sconn->msg_ctx, NULL,
 			   MSG_SMB_CLOSE_FILE, msg_close_file);
 
 	/*
 	 * Use the default MSG_DEBUG handler to avoid rebroadcasting
 	 * MSGs to all child processes
 	 */
-	messaging_deregister(smbd_messaging_context(),
+	messaging_deregister(sconn->msg_ctx,
 			     MSG_DEBUG, NULL);
-	messaging_register(smbd_messaging_context(), NULL,
+	messaging_register(sconn->msg_ctx, NULL,
 			   MSG_DEBUG, debug_message);
 
 	if ((lp_keepalive() != 0)
@@ -3037,14 +3041,15 @@ void smbd_process(void)
 
 	if (!(event_add_idle(smbd_event_context(), NULL,
 			     timeval_set(IDLE_CLOSED_TIMEOUT, 0),
-			     "deadtime", deadtime_fn, smbd_server_conn))) {
+			     "deadtime", deadtime_fn, sconn))) {
 		DEBUG(0, ("Could not add deadtime event\n"));
 		exit(1);
 	}
 
 	if (!(event_add_idle(smbd_event_context(), NULL,
 			     timeval_set(SMBD_SELECT_TIMEOUT, 0),
-			     "housekeeping", housekeeping_fn, NULL))) {
+			     "housekeeping", housekeeping_fn,
+			     sconn->msg_ctx))) {
 		DEBUG(0, ("Could not add housekeeping event\n"));
 		exit(1);
 	}
@@ -3083,34 +3088,34 @@ void smbd_process(void)
 
 #endif
 
-	smbd_server_conn->nbt.got_session = false;
+	sconn->nbt.got_session = false;
 
-	smbd_server_conn->smb1.negprot.max_recv = MIN(lp_maxxmit(),BUFFER_SIZE);
+	sconn->smb1.negprot.max_recv = MIN(lp_maxxmit(),BUFFER_SIZE);
 
-	smbd_server_conn->smb1.sessions.done_sesssetup = false;
-	smbd_server_conn->smb1.sessions.max_send = BUFFER_SIZE;
-	smbd_server_conn->smb1.sessions.last_session_tag = UID_FIELD_INVALID;
+	sconn->smb1.sessions.done_sesssetup = false;
+	sconn->smb1.sessions.max_send = BUFFER_SIZE;
+	sconn->smb1.sessions.last_session_tag = UID_FIELD_INVALID;
 	/* users from session setup */
-	smbd_server_conn->smb1.sessions.session_userlist = NULL;
+	sconn->smb1.sessions.session_userlist = NULL;
 	/* workgroup from session setup. */
-	smbd_server_conn->smb1.sessions.session_workgroup = NULL;
+	sconn->smb1.sessions.session_workgroup = NULL;
 	/* this holds info on user ids that are already validated for this VC */
-	smbd_server_conn->smb1.sessions.validated_users = NULL;
-	smbd_server_conn->smb1.sessions.next_vuid = VUID_OFFSET;
-	smbd_server_conn->smb1.sessions.num_validated_vuids = 0;
+	sconn->smb1.sessions.validated_users = NULL;
+	sconn->smb1.sessions.next_vuid = VUID_OFFSET;
+	sconn->smb1.sessions.num_validated_vuids = 0;
 
-	conn_init(smbd_server_conn);
-	if (!init_dptrs(smbd_server_conn)) {
+	conn_init(sconn);
+	if (!init_dptrs(sconn)) {
 		exit_server("init_dptrs() failed");
 	}
 
-	smbd_server_conn->smb1.fde = event_add_fd(smbd_event_context(),
-						  smbd_server_conn,
+	sconn->smb1.fde = event_add_fd(smbd_event_context(),
+						  sconn,
 						  smbd_server_fd(),
 						  EVENT_FD_READ,
 						  smbd_server_connection_handler,
-						  smbd_server_conn);
-	if (!smbd_server_conn->smb1.fde) {
+						  sconn);
+	if (!sconn->smb1.fde) {
 		exit_server("failed to create smbd_server_connection fde");
 	}
 
@@ -3121,7 +3126,7 @@ void smbd_process(void)
 	 */
 	spoolss_cb.init = spoolss_init_cb;
 	spoolss_cb.shutdown = NULL;
-
+	spoolss_cb.private_data = sconn->msg_ctx;
 
 	if (!NT_STATUS_IS_OK(rpc_winreg_init(NULL))) {
 		exit(1);
@@ -3142,7 +3147,7 @@ void smbd_process(void)
 
 		errno = 0;
 
-		status = smbd_server_connection_loop_once(smbd_server_conn);
+		status = smbd_server_connection_loop_once(sconn);
 		if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY) &&
 		    !NT_STATUS_IS_OK(status)) {
 			DEBUG(3, ("smbd_server_connection_loop_once failed: %s,"
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index b24cb35..1a5d81f 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -68,7 +68,7 @@ static void smb_conf_updated(struct messaging_context *msg,
 	DEBUG(10,("smb_conf_updated: Got message saying smb.conf was "
 		  "updated. Reloading.\n"));
 	change_to_root_user();
-	reload_services(smbd_messaging_context(), False);
+	reload_services(msg, False);
 }
 
 
@@ -369,7 +369,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 	}
 
 	if (s->parent->interactive) {
-		smbd_process();
+		smbd_process(smbd_server_conn);
 		exit_server_cleanly("end of interactive mode");
 		return;
 	}
@@ -436,7 +436,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 					    "serverid.tdb");
 		}
 
-		smbd_process();
+		smbd_process(smbd_server_conn);
 	 exit:
 		exit_server_cleanly("end of child");
 		return;
@@ -1137,7 +1137,7 @@ extern void build_options(bool screen);
 	        /* Stop zombies */
 		smbd_setup_sig_chld_handler();
 
-		smbd_process();
+		smbd_process(smbd_server_conn);
 
 		exit_server_cleanly(NULL);
 		return(0);
diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c
index 80e30c0..7512f8e 100644
--- a/source3/smbd/server_reload.c
+++ b/source3/smbd/server_reload.c
@@ -40,7 +40,7 @@ void reload_printers(struct messaging_context *msg_ctx)
 	NTSTATUS status;
 	bool skip = false;
 
-	pcap_cache_reload();
+	pcap_cache_reload(server_event_context(), msg_ctx);
 
 	status = make_server_info_system(talloc_tos(), &server_info);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -79,7 +79,7 @@ void reload_printers(struct messaging_context *msg_ctx)
 		}
 	}
 
-	load_printers();
+	load_printers(server_event_context(), msg_ctx);
 
 	TALLOC_FREE(server_info);
 }
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 720018d..1250204 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -491,7 +491,7 @@ static int save_reload(int snum)
                 return 0;
         }
 	iNumNonAutoPrintServices = lp_numservices();
-	load_printers();
+	load_printers(server_event_context(), server_messaging_context());
 
 	return 1;
 }
@@ -1434,7 +1434,7 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid)
 	load_config(True);
 	load_interfaces();
 	iNumNonAutoPrintServices = lp_numservices();
-	load_printers();
+	load_printers(server_event_context(), server_messaging_context());
 
 	cgi_setup(get_dyn_SWATDIR(), !demo_mode);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list