1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-29 02:50:28 +03:00

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 <nstuyvesant@gmail.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Nov  8 13:27:40 UTC 2021 on sn-devel-184
This commit is contained in:
David Disseldorp 2021-11-08 12:11:17 +01:00 committed by Andreas Schneider
parent 80115f9be1
commit f4cad8b2bc

View File

@ -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"));