From feacb7daa7e599d8c0ac381e3381ca204eab2b69 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Mon, 8 Nov 2021 12:11:17 +0100 Subject: [PATCH] smbd: check lp_load_printers before reload via NetShareEnum api_RNetShareEnum() unconditionally attempts to reload printers via delete_and_reload_printers(). Add a lp_load_printers() check to obey smb.conf "load printers = off" settings. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14895 Reported-by: Nate Stuyvesant Signed-off-by: David Disseldorp --- source3/smbd/server_reload.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c index 98ea2a4fda4..329edf640da 100644 --- a/source3/smbd/server_reload.c +++ b/source3/smbd/server_reload.c @@ -58,10 +58,16 @@ void delete_and_reload_printers(void) const char *pname; bool ok; time_t pcap_last_update; - TALLOC_CTX *frame = talloc_stackframe(); + TALLOC_CTX *frame = NULL; const struct loadparm_substitution *lp_sub = loadparm_s3_global_substitution(); + if (!lp_load_printers()) { + DBG_DEBUG("skipping printer reload: disabled\n"); + return; + } + + frame = talloc_stackframe(); ok = pcap_cache_loaded(&pcap_last_update); if (!ok) { DEBUG(1, ("pcap cache not loaded\n")); -- 2.31.1