From: David Disseldorp Date: Mon, 8 Nov 2021 11:11:17 +0000 (+0100) Subject: smbd: check lp_load_printers before reload via NetShareEnum X-Git-Tag: ldb-2.5.0~312 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f4cad8b2bc34ecf535deab8979a6e5f6b22233ff;p=thirdparty%2Fsamba.git 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 Reviewed-by: Andreas Schneider Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Mon Nov 8 13:27:40 UTC 2021 on sn-devel-184 --- 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"));