summaryrefslogtreecommitdiff
path: root/source3/smbd/service.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-05-20 16:23:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:46 -0500
commit67d474861d34490f6a8064d3eadc716d5a3a6020 (patch)
tree1421d875ed0ac58cb686d5a938b8fe226a7692a8 /source3/smbd/service.c
parent96c6bf93d52c562dfabe25a2901ecb4e54f5a06f (diff)
downloadsamba-67d474861d34490f6a8064d3eadc716d5a3a6020.tar.gz
samba-67d474861d34490f6a8064d3eadc716d5a3a6020.tar.bz2
samba-67d474861d34490f6a8064d3eadc716d5a3a6020.zip
r799: BUG 1259 -- add 'printcap cache time' patch from Lars
(This used to be commit fac90741139b953d0e88d050dd457657f0b9c9f3)
Diffstat (limited to 'source3/smbd/service.c')
-rw-r--r--source3/smbd/service.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 04cade9577..c74537c299 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -826,3 +826,27 @@ void close_cnum(connection_struct *conn, uint16 vuid)
conn_free(conn);
}
+
+/****************************************************************************
+ Remove stale printers
+****************************************************************************/
+
+void remove_stale_printers( void )
+{
+ int snum, iNumServices, printersServiceNum;
+ const char *pname;
+
+ 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)) {
+ DEBUG( 3, ( "Removing printer: %s\n", pname));
+ lp_killservice( snum);
+ }
+ }
+}