Bug 5930 - Printer Access Control adds printers even if they don't exist in CUPS
Summary: Printer Access Control adds printers even if they don't exist in CUPS
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Printing (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.13.0
Assignee: Samuel Mannehed
URL:
Keywords: frifl_tester, relnotes
: 7588 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-09 15:04 CEST by Thomas Nilefalk
Modified: 2020-12-11 08:54 CET (History)
3 users (show)

See Also:
Acceptance Criteria:


Attachments
Hconf for nearest (447 bytes, text/plain)
2020-11-11 12:13 CET, Frida Flodin
Details

Description Thomas Nilefalk cendio 2016-06-09 15:04:38 CEST
Scenario: 

Given a configuration with a Location that is used for unknown terminals and has a printer
And the printer is removed from CUPS
When the user reconnects or logs in
Then the printer should not be available

Currently a printer with that name is re-added to CUPS.

Manual steps:
> lpadmin -D testprinter -p testprinter

Add testprinter to a location that is used for unknown terminals.

> lpadmin -x testprinter

Log into ThinLinc from a unknown terminal. Watch the printer be revived:

> lpstat -a
Comment 1 Samuel Mannehed cendio 2020-11-10 12:55:21 CET
*** Bug 7588 has been marked as a duplicate of this bug. ***
Comment 6 Samuel Mannehed cendio 2020-11-10 14:22:05 CET
Fixed now. I have verified (on Fedora 32) that the following config..:

> [/printing/nearest/terminals/00:D8:61:42:02:41]
> printers=asf
> location=
> name=samuels workstation
> 
> [/printing/nearest/locations/New location]
> printers=anfshgn
> useforunknown=1
> description=

.. results in the following log:

> 2020-11-10 14:14:07 INFO vsmserver.extproc: ['/opt/thinlinc/etc/sessionstartup.d/tl-limit-printers'] exited with exit code 0
> 2020-11-10 14:14:07 WARNING vsmserver.extproc: ['/opt/thinlinc/etc/sessionstartup.d/tl-limit-printers'] wrote to stderr: The printer 'asf' for the terminal '00:D8:61:42:02:41' was not found.The printer 'anfshgn' to be used for unknown terminals was not found.

And no printers were added:

> $ sudo lpstat -a
> nearest accepting requests since mån 30 sep 2019 10:31:44
> Office accepting requests since fre 30 okt 2020 13:53:54
> thinlocal accepting requests since ons  3 jun 2020 11:28:35
Comment 7 Frida Flodin cendio 2020-11-11 12:13:00 CET
Created attachment 965 [details]
Hconf for nearest

I can verify that the issue has been fixed. I tested nightly build 6653 on Ubuntu20.04:

* Known terminal with non-existent printer. No printer was added.

* Known terminal at location with non-existent printer. No printer was added.

* Location with non-existent printer used for unknown terminals. No printer was added.

* Location used for unknown terminals, with both existing and non-existing printer. The existing was added but not the other.


So the issue is fixed, but I found that with the conf (see attachment) we log to stderr for each terminal at the location. In a setup with lots of terminals there would be a very long entry in the log if a printer does not exist. The log I got:

> 2020-11-11 10:27:37 WARNING vsmserver.extproc: ['/opt/thinlinc/etc/sessionreconnect.d/tl-limit-printers'] wrote to stderr: The printer 'non-existent' for the terminal '2C:F0:5D:12:0F:2B' was not found.The printer 'non-existent' for the terminal '2C:F0:5D:12:0F:2C' was not found.The printer 'non-existent' for the terminal '2C:F0:5D:12:0F:2A' was not found.The printer 'non-existent' to be used for unknown terminals was not found.
Comment 9 Samuel Mannehed cendio 2020-11-11 15:13:35 CET
Fixed now.
Comment 10 Frida Flodin cendio 2020-11-12 08:59:33 CET
Looks good, closing.
Comment 11 Frida Flodin cendio 2020-12-08 12:23:21 CET
I missed to test the normal case, that all printers exists. The warning is always printed, even when all printers exists:

> 2020-12-08 11:15:41 WARNING vsmserver.extproc: ['/opt/thinlinc/etc/sessionreconnect.d/tl-limit-printers'] wrote to stderr: The following configured printers couldn't be found:
Comment 14 Samuel Mannehed cendio 2020-12-10 14:05:32 CET
Now it should only log when there's printers that can't be found :)
Comment 15 Frida Flodin cendio 2020-12-11 08:54:06 CET
Indeed, there is no log message when all printers are found. Also tests again with a non existent printers and the warning is printed as expected and the printers are not added.

Note You need to log in before you can comment on or make changes to this bug.