Bug 1259 - Samba doesn't recognize new or removed printers
Samba doesn't recognize new or removed printers
Product: Samba 3.0
Classification: Unclassified
Component: Printing
Other other
: P3 enhancement
: none
Assigned To: Gerald (Jerry) Carter
Depends on:
  Show dependency treegraph
Reported: 2004-04-12 10:28 UTC by Lars Müller
Modified: 2005-08-24 10:19 UTC (History)
1 user (show)

See Also:

Proposed fix. (4.19 KB, patch)
2004-05-07 10:03 UTC, Lars Müller
no flags Details
Second draft. (4.49 KB, patch)
2004-05-08 08:13 UTC, Lars Müller
no flags Details
Updated man page documentation. (691 bytes, text/plain)
2004-05-19 04:15 UTC, Lars Müller
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Müller 2004-04-12 10:28:47 UTC
/etc/printcap is only read while startup and if smbd receives a HUP signal. 
Therfore adding and removing of printer queues on the CUPS side aren't
dynamically noticed.

I've turned to the cups.development news group for advice, if there is a push
mechanism inside CUPS to inform us or if we have to poll.
Comment 1 Lars Müller 2004-04-12 10:29:23 UTC
Assign it to me, as I've to provide additional input.
Comment 2 Lars Müller 2004-04-12 11:28:58 UTC
From: Michael Sweet <mike at easysw dot com>
Newsgroups: cups.development
Subject: Re: Samba printer gets out of sync
Date: Mon, 12 Apr 2004 14:04:12 -0400

Lars Mueller wrote:
> Is it possible from the CUPS side to push an update, prefered by only
> passing the information which printer to add or remove, to the Samba
> server?

Not in 1.1, however CUPS 1.2 adds notification support which can
asynchronously notify applications about server, printer, and job

> If this isn't possible we have to poll in intervals.  Then we need or
> maybe must add an option like 'lpstat cache time' with an sensible
> default value.

This is likely the best option, and I *think* that there is already
some logic like this for the job cache.
Comment 3 Lars Müller 2004-05-07 10:03:42 UTC
Created attachment 498 [details]
Proposed fix.

Adds an option 'printcap cache time'.  Documentation is part of the diff.

We add an additional timer in check_reload() of smbd/process.c and call
remove_stale_printer() - new funtion to smbd/service.c - load_printers() and
set the timer to the current time.

remove_stale_printer() tales care not to remove the PRINTERS_NAME service.
Comment 4 Lars Müller 2004-05-07 10:07:19 UTC
Please add the patch to the Samba 3.0 tree.
Comment 5 Lars Müller 2004-05-07 13:46:01 UTC
Reopen to be tracked by Jerry.
Comment 6 Lars Müller 2004-05-08 08:13:13 UTC
Created attachment 499 [details]
Second draft.

Added a lower initial interval to allow a first check already after 60 seconds.
 This might be usefull if the print subsystem isn't yet ready as part of the
system start up.  Here our current default of 750 seconds might leave the Samba
server for a to long time without printers.
Comment 7 Lars Müller 2004-05-19 04:15:53 UTC
Created attachment 521 [details]
Updated man page documentation.
Comment 8 Gerald (Jerry) Carter 2004-05-20 09:20:40 UTC
couple of small changes but looks good.  CHecked into 3.0/trunk.
'printcap cache time = 0' will be the default in 3.0 for now.
but default to 12 & 1/2 minutes in trunk.
Comment 9 Gerald (Jerry) Carter 2005-08-24 10:19:33 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.