summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-12-02 17:11:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:31 -0500
commit57c468bbf1dd124f568c5beb1fb4a7d3c09dda71 (patch)
treefc607719a16106162961ac4e0deac4f4a20bcfb9
parentd7a1c4f79c7c9d7038096a34626ba7236e856929 (diff)
downloadsamba-57c468bbf1dd124f568c5beb1fb4a7d3c09dda71.tar.gz
samba-57c468bbf1dd124f568c5beb1fb4a7d3c09dda71.tar.bz2
samba-57c468bbf1dd124f568c5beb1fb4a7d3c09dda71.zip
r4043: BUG 2091: don't remove statically defined printers in remove_stale_printers()
(This used to be commit c24a3c49ce20797c0f9172e503e34770d00842ec)
-rw-r--r--source3/smbd/service.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 4d111e0ea3..3dcd803a7c 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -152,10 +152,9 @@ int find_service(fstring service)
int iPrinterService;
if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) >= 0) {
- char *pszTemp;
+ const char *pszTemp = lp_printcapname();
DEBUG(3,("checking whether %s is a valid printer name...\n", service));
- pszTemp = lp_printcapname();
if ((pszTemp != NULL) && pcap_printername_ok(service, pszTemp)) {
DEBUG(3,("%s is a valid printer name\n", service));
DEBUG(3,("adding %s as a printer service\n", service));
@@ -877,12 +876,21 @@ void remove_stale_printers( void )
iNumServices = lp_numservices();
printersServiceNum = lp_servicenumber( PRINTERS_NAME);
for( snum = 0; snum < iNumServices; snum++) {
+
/* Never remove PRINTERS_NAME */
+
if ( snum == printersServiceNum)
continue;
pname = lp_printername( snum);
- /* Is snum a print service and still in the printing subsystem? */
- if ( lp_print_ok( snum) && !pcap_printername_ok( pname, NULL)) {
+
+ /* Is snum an autoloaded print service and still
+ in the printing subsystem? */
+
+ if ( lp_snum_ok(snum)
+ && lp_print_ok(snum)
+ && lp_autoloaded(snum)
+ && !pcap_printername_ok( pname, NULL))
+ {
DEBUG( 3, ( "Removing printer: %s\n", pname));
lp_killservice( snum);
}