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;
}
return;
}
- pcap_cache_reload(ev_ctx, msg_ctx, &reload_printers);
+ pcap_cache_reload(ev_ctx, msg_ctx, &delete_and_reload_printers);
}
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,
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);
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);
}
/*******************************************************************
#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;