Error storing/reveiving passwords into/from gnome-keyring

Bug #569765 reported by Märt Põder
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Screenlets
Status tracked in Trunk
Trunk
Fix Released
Undecided
Rico Pfaus
gnome-keyring (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Using any screenlet in Ubuntu Karmic which has password stored with AccountOption into gnome-keyring, the password won't be received after logout any more. Screenlets report "ERROR: Unable to read password from keyring:" and that's all. It is quite mainstram in TwitterScreenlet bugtracking http://code.google.com/p/twitterscreenlet/updates/list, for example. For me the problem was fixed at first when I just reversed the boolean operator fount in /usr/share/pyshared/screenlets/options.py inside function on_import, so instead of if self.keyring == self.keyring_list[0] i used if self.keyring != self.keyring_list[0]. This made the password to be received all right.

The problem, however, seems to be that options.py makes a wild presumption about the order of keys in the ring.

237 self.keyring_list = gnomekeyring.list_keyring_names_sync()
We have the keyrings' list now... But is there a default keyring defined?
--- Yes? Then let self.keyring represent "the default keyring".
--- No? Then let's take self.keyring represent "the whatever first keyring" that was available at the keyring...
(that is 246 self.keyring = self.keyring_list[0])

Now, in my case "the whatever first keyring" is "login" which happens to be also "the default keyring", but I suppose "the whatever first keyring" could be also "session" or "foobar", but there's no way to be sure.

If we now look, what is done in on_import
258 if self.keyring == self.keyring_list[0]
and also on_export
278 if self.keyring == self.keyring_list[0]
then it seems that it is meant to detect if we had some default keyring defined... But it fails. It supposes, that when we have default keyring defined the self.keyring != self.keyring_list[0], but it may well happen otherwise, as in my case and for lot of other people referref above. I suppose the order of keyrings is changing through versions of gnome-keyring application or Linux distribution, and once the code worked, but now it's broken.

I suggest that since in on_export
279 auth_token = gnomekeyring.item_create_sync('session',
280 gnomekeyring.ITEM_GENERIC_SECRET, value[0], attribs, value[1], True)
"the whatever first keyring" is replaced with the system keyring "session" as the hard-coded string, the value "session" should be as well assigned already in __init__
246 self.keyring = self.keyring_list[0]
instead of "the whatever first keyring", i. e. it should be
246 self.keyring = "session"

The rest of hocus pocus with checking if there was default keyring or we are dealing some "random first keyring" should be removed and replaced with plain
262 pw = gnomekeyring.item_get_info_sync(self.keyring,
263 int(auth_token)).get_secret()
in case of on_import and with
282 auth_token = gnomekeyring.item_create_sync(self.keyring,
283 gnomekeyring.ITEM_GENERIC_SECRET, value[0], attribs, value[1], True)
in case of on_export...

That should do it.

If that's allright, I could check and fix the code myself.

Tags: patch
Revision history for this message
Märt Põder (boamaod) wrote :

I add that the essence of the problem is, that instead of storing password to permanent keyring "login" (or whatever keyring is defined as "the default keyring"), the passwords are accidentally stored at "session" keyring, even when "login" keyring exists and is operable. That's why passords don't live through the logout and reboot etc.

Revision history for this message
Märt Põder (boamaod) wrote :

If there's default keyring, use it
If not, check if there's session keyring, use it
If not, use the first available keyring

Revision history for this message
Märt Põder (boamaod) wrote :

Just for the background: http://www.ubuntu-forum.de/artikel/47309/twitterscreenlet-auf-9-1-speichert-passwort-nicht.html says that the problem appeared after upgrading the distribution from Ubuntu 8.04 to 9.10.

Revision history for this message
Märt Põder (boamaod) wrote :

It seems to work in Ubuntu Lucid Lynx without applying the patch, but as explained above, this is by lucky coincidence, isn't it?

Märt Põder (boamaod)
Changed in screenlets:
assignee: nobody → Rico Pfaus (ryxperience)
Revision history for this message
Hasenkopf, Andreas (andi-hasenkopf) wrote :

I had the same problem with a screenlet (http://gnome-look.org/content/show.php/PhantCalendar?content=120461) I wrote myself.
On Ubuntu 9.10 the problem seemed to be solved by some magical rewriting of the screenlet. But after upgradint to 10.04 the screenlet does not get the account information from the keyring despite the fact, that there is the account information in the keyring "default".

Applying the patch did the job.
Thank you!

Changed in screenlets:
status: New → Fix Committed
Märt Põder (boamaod)
Changed in screenlets:
status: Fix Committed → Fix Released
Revision history for this message
dalailama (dalailama333) wrote :

I'm sorry for reopening this bug, but it reappears in 12.04 precise pangolin even though the fix changes have been applyed.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "screenlets-options.py.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
affects: ubuntu → gnome-keyring (Ubuntu)
Revision history for this message
Sebastien Bacher (seb128) wrote :

closing the gnome-keyring component since karmic support stopped and the bug is confusing, open a new bug if you still have issue with current versions

Changed in gnome-keyring (Ubuntu):
importance: Undecided → Low
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.