Bug 5702 - tl-limit-printers crashes on non-existing printer
Summary: tl-limit-printers crashes on non-existing printer
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: linma_tester, prosaic
Depends on:
Blocks:
 
Reported: 2015-11-02 15:55 CET by Karl Mikaelsson
Modified: 2020-11-10 13:03 CET (History)
3 users (show)

See Also:
Acceptance Criteria:


Attachments

Description Karl Mikaelsson cendio 2015-11-02 15:55:51 CET
Configuring nearest.hconf to include a printer that doesn't exist makes tl-limit-printers crash.

> root@dhcp-254-8:~# USER=cendio tl-limit-printers -v
> Waiting for lock on /var/opt/thinlinc/utils/tl-printer/tl-limit-printers.lock
> Acquired lock
> Hardware addresses associated with user: ['52:54:00:D7:5C:66']
> Current list of printers: ['nearest', 'thinlocal']
> Traceback (most recent call last):
>   File "/opt/thinlinc/sbin/tl-limit-printers", line 73, in <module>
>     sys . exit ( II1i ( sys . argv [ 1 : ] ) )
>   File "/opt/thinlinc/sbin/tl-limit-printers", line 59, in II1i
>     limit_printers ( IIIiI11ii , os . environ [ 'USER' ] , verbose = II )
>   File "/opt/thinlinc/modules/thinlinc/tlprinter.py", line 610, in limit_printers
>     oOOoo )
>   File "/opt/thinlinc/modules/thinlinc/tlprinter.py", line 538, in construct_printer_acl
>     ( oOO00O , iiIi1i ) = build_printer_access_map ( hive )
>   File "/opt/thinlinc/modules/thinlinc/tlprinter.py", line 396, in build_printer_access_map
>     oOO00O [ oO0o0Ooooo ] . append ( 'unknown' )
> KeyError: 'lolfinnsinte'
Comment 1 Karl Mikaelsson cendio 2016-06-08 17:38:04 CEST
This is a problem for non-existing printers defined on the locations used for unknown terminals.
Comment 4 Samuel Mannehed cendio 2020-11-04 15:18:58 CET
It's easiest to reproduce this by manually configuring a location in /opt/thinlinc/etc/conf.d/nearest.hconf and specifying a printer that doesn't exist and make sure to set "useforunknown" to true.

tlwebadm seems to get a list of valid printers automatically.
Comment 6 Samuel Mannehed cendio 2020-11-04 15:32:53 CET
Fixed now, a log msg will be written for such printers. Tested using nighly build on RHEL 8. The following conf was used:

> [/printing/nearest]
> 
> [/printing/nearest/locations/New location]
> printers=nowhere
> useforunknown=false
> description=
> 
> [/printing/nearest/locations/hej]
> printers=finnsinte
> useforunknown=true
> description=ojoj
> 
> [/printing/nearest/terminals/00:50:56:B0:07:F0]
> printers=
> location=New location
> name=New terminal

It gives the following line in the vsmserver log:

> 2020-11-04 15:12:55 WARNING vsmserver.extproc: ['/opt/thinlinc/etc/sessionreconnect.d/tl-limit-printers'] wrote to stderr: The printer 'finnsinte' was not found.
Comment 10 Linn cendio 2020-11-10 13:03:28 CET
Tested on Fedora 32, looks good. Reproduced the crash by using the tl-limit-printers script, and it does no longer crash after the fix. The warning was also added to the vsmserver log.

However, the non-existing printers are incorrectly added to the list of existing printers. This is already reported as a separate bug (bug 7588).

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