diff options
author | Gerald Carter <jerry@samba.org> | 2005-01-21 18:47:55 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2005-01-21 18:47:55 +0000 |
commit | 0ff19b2807e92b9abd3fc8cd716dd19284e93af9 (patch) | |
tree | 2f2b58e05c853b1a47f2d73e398da1cbd22fc8fc /source/smbd/server.c | |
parent | f1f54e8731e7cf45a849d3c7bd6d7eee6f9b33b7 (diff) | |
download | samba-0ff19b2807e92b9abd3fc8cd716dd19284e93af9.tar.gz samba-0ff19b2807e92b9abd3fc8cd716dd19284e93af9.tar.xz samba-0ff19b2807e92b9abd3fc8cd716dd19284e93af9.zip |
r4904: sync up with 3.0 for 3.0.11pre2
Diffstat (limited to 'source/smbd/server.c')
-rw-r--r-- | source/smbd/server.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/source/smbd/server.c b/source/smbd/server.c index 724a49321a2..7f7d55c7e3a 100644 --- a/source/smbd/server.c +++ b/source/smbd/server.c @@ -464,6 +464,39 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_ } /**************************************************************************** + Reload printers +**************************************************************************/ +void reload_printers(void) +{ + int snum; + int n_services = lp_numservices(); + int pnum = lp_servicenumber(PRINTERS_NAME); + const char *pname; + + pcap_cache_reload(); + + /* remove stale printers */ + for (snum = 0; snum < n_services; snum++) { + /* avoid removing PRINTERS_NAME or non-autoloaded printers */ + if (snum == pnum || !(lp_snum_ok(snum) && lp_print_ok(snum) && + lp_autoloaded(snum))) + continue; + + pname = lp_printername(snum); + if (!pcap_printername_ok(pname)) { + DEBUG(3, ("removing stale printer %s\n", pname)); + + if (is_printer_published(NULL, snum, NULL)) + nt_printer_publish(NULL, snum, SPOOL_DS_UNPUBLISH); + del_a_printer(pname); + lp_killservice(snum); + } + } + + load_printers(); +} + +/**************************************************************************** Reload the services file. **************************************************************************/ @@ -490,8 +523,7 @@ BOOL reload_services(BOOL test) ret = lp_load(dyn_CONFIGFILE, False, False, True); - remove_stale_printers(); - load_printers(); + reload_printers(); /* perhaps the config filename is now set */ if (!test) |