Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 887223 Details for
Bug 1089029
Auth info saving in gnome-keyring does not properly handle multiple printers on one device
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Base the authentication information lookup on the printer uri.
Base-password-lookup-on-printer-uri.patch (text/plain), 7.65 KB, created by
Andre Heinecke
on 2014-04-17 17:21:25 UTC
(
hide
)
Description:
Base the authentication information lookup on the printer uri.
Filename:
MIME Type:
Creator:
Andre Heinecke
Created:
2014-04-17 17:21:25 UTC
Size:
7.65 KB
patch
obsolete
>From 2a745ce92f91e73ec17d087bcaebac7426792503 Mon Sep 17 00:00:00 2001 >From: Andre Heinecke <aheinecke@intevation.de> >Date: Thu, 17 Apr 2014 19:14:11 +0200 >Subject: [PATCH] Base password lookup on printer-uri > > Having multiple printers on one samba server was not handled > by the password attributes. To avoid any ambiguity the actual > printer-uri is now used for the password lookup. > The currently used attributes are still used as a fallback > to stay compatible with already saved authentication information. >--- > jobviewer.py | 79 ++++++++++++++++++++++++++++++++++------------------------ > 1 file changed, 46 insertions(+), 33 deletions(-) > >diff --git a/jobviewer.py b/jobviewer.py >index 64a09e0..ac0aa7b 100644 >--- a/jobviewer.py >+++ b/jobviewer.py >@@ -913,12 +913,13 @@ class JobViewer (GtkGUI): > # running as an applet just try to get the information silently > # and not prompt the user. > self.get_authentication (job, data.get ('device-uri'), >+ data.get ('job-printer-uri'), > data.get ('auth-info-required', []), > self.applet) > self.update_sensitivity () > >- def get_authentication (self, job, device_uri, auth_info_required, >- show_dialog): >+ def get_authentication (self, job, device_uri, printer_uri, >+ auth_info_required, show_dialog): > # Check if we have requested authentication for this job already > if not self.auth_info_dialogs.has_key (job): > try: >@@ -930,7 +931,7 @@ class JobViewer (GtkGUI): > > # Find out which auth-info is required. > try_keyring = USE_KEYRING >- keyring_attrs = dict() >+ informational_attrs = dict() > auth_info = None > if try_keyring and 'password' in auth_info_required: > (scheme, rest) = urllib.splittype (device_uri) >@@ -938,7 +939,7 @@ class JobViewer (GtkGUI): > uri = smburi.SMBURI (uri=device_uri) > (group, server, share, > user, password) = uri.separate () >- keyring_attrs["domain"] = str (group) >+ informational_attrs["domain"] = str (group) > else: > (serverport, rest) = urllib.splithost (rest) > if serverport == None: >@@ -949,43 +950,53 @@ class JobViewer (GtkGUI): > if scheme == None or server == None: > try_keyring = False > else: >- keyring_attrs.update ({ "server": str (server.lower ()), >- "protocol": str (scheme)}) >+ informational_attrs.update ({ "server": str (server.lower ()), >+ "protocol": str (scheme)}) > > if job in self.authenticated_jobs: > # We've already tried to authenticate this job before. > try_keyring = False > >+ # To increase compatibility and resolve problems with >+ # multiple printers on one host we use the printers URI >+ # as the identifying attribute. Versions <= 1.4.4 used >+ # a combination of domain / server / protocol instead. >+ # The old attributes are still used as a fallback for identifying >+ # the secret but are otherwise only informational. >+ identifying_attrs = { "uri": str (printer_uri) } >+ > if try_keyring and 'password' in auth_info_required: > type = GnomeKeyring.ItemType.NETWORK_PASSWORD >- attrs = GnomeKeyring.Attribute.list_new () >- for key, val in keyring_attrs.iteritems (): >- GnomeKeyring.Attribute.list_append_string (attrs, >- key, >- val) >- (result, items) = GnomeKeyring.find_items_sync (type, >- attrs) >- if result == GnomeKeyring.Result.OK: >- auth_info = map (lambda x: '', auth_info_required) >- ind = auth_info_required.index ('username') >- >- for attr in GnomeKeyring.attribute_list_to_glist ( >- items[0].attributes): >- # It might be safe to assume here that the >- # user element is always the second item in a >- # NETWORK_PASSWORD element but lets make sure. >- if attr.name == 'user': >- auth_info[ind] = attr.get_string() >- break >- else: >- debugprint ("Did not find username keyring " >- "attributes.") > >- ind = auth_info_required.index ('password') >- auth_info[ind] = items[0].secret >+ for keyring_attrs in [identifying_attrs, informational_attrs]: >+ attrs = GnomeKeyring.Attribute.list_new () >+ for key, val in keyring_attrs.iteritems (): >+ GnomeKeyring.Attribute.list_append_string (attrs, >+ key, >+ val) >+ (result, items) = GnomeKeyring.find_items_sync (type, >+ attrs) >+ if result == GnomeKeyring.Result.OK: >+ auth_info = map (lambda x: '', auth_info_required) >+ ind = auth_info_required.index ('username') >+ >+ for attr in GnomeKeyring.attribute_list_to_glist ( >+ items[0].attributes): >+ # It might be safe to assume here that the >+ # user element is always the second item in a >+ # NETWORK_PASSWORD element but lets make sure. >+ if attr.name == 'user': >+ auth_info[ind] = attr.get_string() >+ break >+ else: >+ debugprint ("Did not find username keyring " >+ "attributes.") >+ >+ ind = auth_info_required.index ('password') >+ auth_info[ind] = items[0].secret >+ break > else: >- debugprint ("gnomekeyring: look-up result %s" % >- repr (result)) >+ debugprint ("Failed to find secret in keyring.") > > if try_keyring: > try: >@@ -1015,6 +1026,8 @@ class JobViewer (GtkGUI): > > if auth_info_required and show_dialog: > username = pwd.getpwuid (os.getuid ())[0] >+ keyring_attrs = informational_attrs.copy() >+ keyring_attrs.update(identifying_attrs) > keyring_attrs["user"] = str (username) > self.display_auth_info_dialog (job, keyring_attrs) > >@@ -1516,7 +1529,7 @@ class JobViewer (GtkGUI): > auth_info_required = ['username', 'password'] > > self.get_authentication (jobid, pattrs.get ('device-uri'), >- auth_info_required, True) >+ uri, auth_info_required, True) > > def on_refresh_clicked(self, toolbutton): > self.monitor.refresh () >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1089029
: 887223