OpenPrinting / system-config-printer

Graphical user interface for CUPS administration
GNU General Public License v2.0
160 stars 88 forks source link

system-config-printer: display_auth_info_dialog(): jobviewer.py:1115:display_auth_info_dialog:KeyError: 'auth-info-required' #143

Closed bgbraga closed 4 years ago

bgbraga commented 4 years ago

Description of problem: Error trying to print... Print crash when try to open an authentication popup.

Version-Release number of selected component: system-config-printer-1.5.11-18.fc30

Additional info: reporter: libreport-2.10.1 cmdline: /usr/bin/python3 /usr/share/system-config-printer/system-config-printer.py crash_function: display_auth_info_dialog exception_type: KeyError executable: /usr/share/system-config-printer/system-config-printer.py interpreter: python3-3.7.4-1.fc30.x86_64 kernel: 5.2.9-200.fc30.x86_64 runlevel: N 5 type: Python3 uid: 961205159

Truncated backtrace: jobviewer.py:1115:display_auth_info_dialog:KeyError: 'auth-info-required'

Traceback (most recent call last): File "/usr/share/system-config-printer/jobviewer.py", line 1621, in on_job_authenticate_activate uri, auth_info_required, True) File "/usr/share/system-config-printer/jobviewer.py", line 1111, in get_authentication self.display_auth_info_dialog (job, keyring_attrs) File "/usr/share/system-config-printer/jobviewer.py", line 1115, in display_auth_info_dialog auth_info_required = data['auth-info-required'] KeyError: 'auth-info-required'

Local variables in innermost frame: self: <jobviewer.JobViewer object at 0x7f7e0e16fbe0 (jobviewer+JobViewer at 0x5607aa68dea0)> job: 5 keyring_attrs: {'domain': '', 'server': '172.16.11.20', 'protocol': 'smb', 'uri': 'ipp://localhost/printers/minolta_konica', 'user': 'bruno.braga'} data: {'job-printer-uri': 'ipp://localhost/printers/minolta_konica', 'time-at-creation': 1567447377, 'job-state': 4, 'job-k-octets': 1, 'job-printer-name': 'minolta_konica', 'attributes-charset': 'utf-8', 'attributes-natural-language': 'en-us', 'device-uri': 'smb://172.16.11.20/minolta_konica', 'job-hold-until': 'auth-info-required', 'job-originating-user-name': 'bruno.braga', 'job-name': 'Test Page', '_status_text': 'Held for authentication'}

It seems a general problem. Usage Scenario: user trying to print when an authentication is required. The authentication window is crashing.

It is found by me in Fedora and a similar problem was reported in CentOS: https://bugzilla.redhat.com/show_bug.cgi?id=1748105 https://bugs.centos.org/view.php?id=16326

zdohnal commented 4 years ago

Hi Bruno, thank you for reporting the issue! Would you mind reproducing the issue when you start system-config-printer with --debug option, catching the messages which it outputs and attach them as txt file into the github ticket?

bgbraga commented 4 years ago

debug.txt done ;)

bgbraga commented 4 years ago

Hi guys, Is there anything that I can do to support that fix? Maybe more tests or simulations...

zdohnal commented 4 years ago

Hi Bruno, I commited fallback which fixes the error as pull request #144 . I created scratch build for Fedora too.

Would you mind testing the scratch build in bugzilla ticket?

bgbraga commented 4 years ago

hi @zdohnal It solved the crash. But I don't know if it solved the problem.

The print is always at "Held for Authentication" state. I tried to use my LDAP (Active Directory) user and it is not logging (no error message). So I tried with a wrong password and it continue no showing any error message.

That change introduced a guessing mode (looking at debug message). But that is not the case. We should authenticate to print. Now the authentication window is appearing but not working.

debugprint ("No auth-info-required attribute; "
                "guessing instead")

held_for_authentication

zdohnal commented 4 years ago

I'm sorry for not responding - there were several samba issue at that time, it looks like one.

EliaGeretto commented 4 years ago

I stumbled upon this issue a while ago as well. The workaround to get everything working is to modify /etc/cups/printers.conf. The entry for the printer you are trying to use probably contains AuthInfoRequired none, which should be changed to AuthInfoRequired username,password. That fixes the problem with the GUI and also lets you authenticate correctly. As for why this happens, I have no idea but it probably a bug in another component. The pull request that fixed this issue, however, only silently masks the problem. Maybe an error message is advisable?