The branch, master has been updated via 3e8c665 s3-smbd: Rename reload_printers() and add documentation. from 303962e s3: Fix smbcontrol smbd idmap kill S-1-5-21-...
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 3e8c665465f0fa650f5f5193206e109200ea7795 Author: Andreas Schneider <a...@samba.org> Date: Mon Sep 5 14:35:55 2011 +0200 s3-smbd: Rename reload_printers() and add documentation. Autobuild-User: Andreas Schneider <a...@cryptomilk.org> Autobuild-Date: Mon Sep 5 17:59:47 CEST 2011 on sn-devel-104 ----------------------------------------------------------------------- Summary of changes: source3/printing/queue_process.c | 4 ++-- source3/printing/spoolssd.c | 2 +- source3/smbd/proto.h | 4 ++-- source3/smbd/server.c | 2 +- source3/smbd/server_reload.c | 21 ++++++++++++++++----- 5 files changed, 22 insertions(+), 11 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index bd26b02..7b2972d 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -339,7 +339,7 @@ bool printing_subsystem_init(struct tevent_context *ev_ctx, ret = printing_subsystem_queue_tasks(ev_ctx, msg_ctx); /* Publish nt printers, this requires a working winreg pipe */ - pcap_cache_reload(ev_ctx, msg_ctx, &reload_printers); + pcap_cache_reload(ev_ctx, msg_ctx, &delete_and_reload_printers); return ret; } @@ -368,5 +368,5 @@ void printing_subsystem_update(struct tevent_context *ev_ctx, return; } - pcap_cache_reload(ev_ctx, msg_ctx, &reload_printers); + pcap_cache_reload(ev_ctx, msg_ctx, &delete_and_reload_printers); } diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 63b3f80..5ea14c9 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -131,7 +131,7 @@ static void update_pcap(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx) { change_to_root_user(); - reload_printers(ev_ctx, msg_ctx); + delete_and_reload_printers(ev_ctx, msg_ctx); } static void pcap_updated(struct messaging_context *msg, diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index d271d7f..8edd695 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -964,8 +964,8 @@ void init_sec_ctx(void); struct event_context *smbd_event_context(void); struct messaging_context *smbd_messaging_context(void); struct memcache *smbd_memcache(void); -void reload_printers(struct tevent_context *ev, - struct messaging_context *msg_ctx); +void delete_and_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 exit_server(const char *const explanation); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 26e3c86..ecda47c 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -88,7 +88,7 @@ static void smb_pcap_updated(struct messaging_context *msg, DEBUG(10,("Got message saying pcap was updated. Reloading.\n")); change_to_root_user(); - reload_printers(ev_ctx, msg); + delete_and_reload_printers(ev_ctx, msg); } /******************************************************************* diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c index 6639c4a..0c2ea2c 100644 --- a/source3/smbd/server_reload.c +++ b/source3/smbd/server_reload.c @@ -31,11 +31,22 @@ #include "messages.h" #include "lib/param/loadparm.h" -/**************************************************************************** - purge stale printers and reload from pre-populated pcap cache -**************************************************************************/ -void reload_printers(struct tevent_context *ev, - struct messaging_context *msg_ctx) +/** + * @brief Purge stale printers and reload from pre-populated pcap cache. + * + * This function should normally only be called as a callback on a successful + * pcap_cache_reload() or after a MSG_PRINTER_CAP message is received. + * + * This function can cause DELETION of printers and drivers from our registry, + * so calling it on a failed pcap reload may REMOVE permanently all printers + * and drivers. + * + * @param[in] ev The event context. + * + * @param[in] msg_ctx The messaging context. + */ +void delete_and_reload_printers(struct tevent_context *ev, + struct messaging_context *msg_ctx) { struct auth_session_info *session_info = NULL; struct spoolss_PrinterInfo2 *pinfo2 = NULL; -- Samba Shared Repository