diff options
author | Simo Sorce <idra@samba.org> | 2011-08-01 16:50:51 -0400 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-08-02 15:28:03 +0200 |
commit | 2e8a85ec72f2b23cc2b64caa129429971c2fa8c0 (patch) | |
tree | e82a80a21b2236fcf8f1b6d6cc6b666e9c18f816 /source3/smbd | |
parent | ac8096e69d7357bac5430cde1d713a04acf58b57 (diff) | |
download | samba-2e8a85ec72f2b23cc2b64caa129429971c2fa8c0.tar.gz samba-2e8a85ec72f2b23cc2b64caa129429971c2fa8c0.tar.bz2 samba-2e8a85ec72f2b23cc2b64caa129429971c2fa8c0.zip |
s3:smbd - Move printing queue stuff
This way we can properly deal with pcap updates in the background queue process
if it is enabled (on by default) and not perform these actions in the main
smbd process.
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/globals.c | 1 | ||||
-rw-r--r-- | source3/smbd/process.c | 4 | ||||
-rw-r--r-- | source3/smbd/proto.h | 2 | ||||
-rw-r--r-- | source3/smbd/server.c | 46 | ||||
-rw-r--r-- | source3/smbd/server_reload.c | 9 |
5 files changed, 12 insertions, 50 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index fe743a6965..bf36dcb71f 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -60,6 +60,7 @@ bool logged_ioctl_message = false; time_t last_smb_conf_reload_time = 0; time_t last_printer_reload_time = 0; + /**************************************************************************** structure to hold a linked list of queued messages. for processing. diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 9df95a8d9d..86e834789f 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -27,7 +27,7 @@ #include "../lib/async_req/async_sock.h" #include "ctdbd_conn.h" #include "../lib/util/select.h" -#include "printing/pcap.h" +#include "printing/queue_process.h" #include "system/select.h" #include "passdb.h" #include "auth.h" @@ -882,7 +882,7 @@ static void smbd_sig_hup_handler(struct tevent_context *ev, DEBUG(1,("Reloading services after SIGHUP\n")); reload_services(msg_ctx, smbd_server_conn->sock, False); if (am_parent) { - pcap_cache_reload(ev, msg_ctx, &reload_pcap_change_notify); + printing_subsystem_update(ev, msg_ctx); } } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index b2acaa0ee7..2b24f70930 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -966,8 +966,6 @@ void reload_printers(struct tevent_context *ev, struct messaging_context *msg_ctx); bool reload_services(struct messaging_context *msg_ctx, int smb_sock, bool test); -void reload_pcap_change_notify(struct tevent_context *ev, - struct messaging_context *msg_ctx); void exit_server(const char *const explanation); void exit_server_cleanly(const char *const explanation); void exit_server_fault(void); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 18e51a2e42..16395ee3dd 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -32,8 +32,8 @@ #include "memcache.h" #include "ctdbd_conn.h" #include "printing/printer_list.h" +#include "printing/queue_process.h" #include "rpc_server/rpc_service_setup.h" -#include "printing/pcap.h" #include "printing.h" #include "serverid.h" #include "passdb.h" @@ -69,8 +69,7 @@ static void smb_conf_updated(struct messaging_context *msg, change_to_root_user(); reload_services(msg, smbd_server_conn->sock, False); if (am_parent) { - pcap_cache_reload(ev_ctx, msg, - &reload_pcap_change_notify); + printing_subsystem_update(ev_ctx, msg); } } @@ -585,28 +584,6 @@ static bool smbd_open_one_socket(struct smbd_parent_context *parent, return true; } -static bool smbd_parent_housekeeping(const struct timeval *now, void *private_data) -{ - struct messaging_context *msg_ctx = - talloc_get_type_abort(private_data, struct messaging_context); - time_t printcap_cache_time = (time_t)lp_printcap_cache_time(); - time_t t = time_mono(NULL); - - DEBUG(5, ("parent housekeeping\n")); - - /* if periodic printcap rescan is enabled, see if it's time to reload */ - if ((printcap_cache_time != 0) - && (t >= (last_printer_reload_time + printcap_cache_time))) { - DEBUG( 3,( "Printcap cache time expired.\n")); - pcap_cache_reload(messaging_event_context(msg_ctx), - msg_ctx, - &reload_pcap_change_notify); - last_printer_reload_time = t; - } - - return true; -} - /**************************************************************************** Open the socket communication. ****************************************************************************/ @@ -757,14 +734,6 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent, return false; } - if (!(event_add_idle(ev_ctx, NULL, - timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0), - "parent_housekeeping", smbd_parent_housekeeping, - msg_ctx))) { - DEBUG(0, ("Could not add parent_housekeeping event\n")); - return false; - } - /* Listen to messages */ messaging_register(msg_ctx, NULL, MSG_SMB_SAM_SYNC, msg_sam_sync); @@ -1252,9 +1221,6 @@ extern void build_options(bool screen); exit(1); } - /* Publish nt printers, this requires a working winreg pipe */ - pcap_cache_reload(ev_ctx, msg_ctx, &reload_printers); - /* only start the background queue daemon if we are running as a daemon -- bad things will happen if smbd is launched via inetd and we fork a copy of @@ -1262,7 +1228,13 @@ extern void build_options(bool screen); if (is_daemon && !interactive && lp_parm_bool(-1, "smbd", "backgroundqueue", true)) { - start_background_queue(ev_ctx, msg_ctx); + if (!printing_subsystem_init(ev_ctx, msg_ctx, true)) { + exit(1); + } + } else { + if (!printing_subsystem_init(ev_ctx, msg_ctx, false)) { + exit(1); + } } if (is_daemon && !_lp_disable_spoolss()) { diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c index db81aadab1..6639c4a8f6 100644 --- a/source3/smbd/server_reload.c +++ b/source3/smbd/server_reload.c @@ -143,12 +143,3 @@ bool reload_services(struct messaging_context *msg_ctx, int smb_sock, return(ret); } - -/**************************************************************************** - Notify smbds of new printcap data -**************************************************************************/ -void reload_pcap_change_notify(struct tevent_context *ev, - struct messaging_context *msg_ctx) -{ - message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL); -} |