Em Ter, 2007-02-27 às 12:55 +0100, Lionel Vaux escreveu:
> On a clean etch install, when I launch some app using gksu, the
> password is not remembered when the option "Save in the keyring"
> is selected. The problem is that the default keyring does not exist,
> and I am not prompted to create it.
I haven't noticed this problem. I thought the default keyring was
created by default, thanks for your bug report!
> If I create a keyring with name "default" using gnome-keyring-manager,
> then gksu correctly saves the password.
>
> Please prompt to create a default keyring if one does not exist.
The attached patch should fix the problem. Can you please try it? I
tried with a newly created user, and it works for me. Most of the patch
is actually a better way of showing debug messages if -d is passed as
argument.
I don't have the time to create a patched package right now, but if I
have the time I'll create one later today. If it works for you we'll try
to get the release team approval for this change to go into Etch. I
don't think there will be problems.
Thanks again,
See you,
--
Gustavo Noronha <[EMAIL PROTECTED]>
http://kov.eti.br/
Index: libgksu/libgksu.c
===================================================================
--- libgksu/libgksu.c (revisão 781)
+++ libgksu/libgksu.c (cópia de trabalho)
@@ -648,7 +648,7 @@
gnome_keyring_attribute_list_free (attributes);
if (
(result == GNOME_KEYRING_RESULT_OK) &&
- (g_list_length(list) == 1)
+ (g_list_length(list) >= 1)
)
{
GnomeKeyringFound *found = list->data;
@@ -689,6 +689,7 @@
static GMainLoop *keyring_loop = NULL;
GnomeKeyringAttributeList *attributes;
GnomeKeyringAttribute attribute;
+ GnomeKeyringResult result;
gchar *keyring_name;
gchar *key_name;
@@ -718,6 +719,14 @@
keyring_name = gconf_client_get_string (gconf_client, BASE_PATH"save-keyring", NULL);
if (keyring_name == NULL)
keyring_name = g_strdup ("session");
+
+ /* make sure the keyring exists; if an error occurs, use
+ the session keyring */
+ result = gnome_keyring_create_sync(keyring_name, NULL);
+ if ((result != GNOME_KEYRING_RESULT_OK) &&
+ (result != GNOME_KEYRING_RESULT_ALREADY_EXISTS))
+ keyring_name = g_strdup ("session");
+
gnome_keyring_item_create (keyring_name,
GNOME_KEYRING_ITEM_GENERIC_SECRET,
key_name,
@@ -1983,14 +1992,22 @@
/* try to get the password from the GNOME Keyring first */
password = get_gnome_keyring_password (context);
- if (context->debug)
- fprintf (stderr, "password: %s\n", password);
if (password == NULL)
- password = ask_pass (context, buf, ask_pass_data, error);
+ {
+ password = ask_pass (context, buf, ask_pass_data, error);
+ if (context->debug)
+ {
+ fprintf (stderr, "no password on keyring\n");
+ if (password == NULL)
+ fprintf (stderr, "no password from ask_pass!\n");
+ }
+ }
else
- used_gnome_keyring = TRUE;
- if (context->debug)
- fprintf (stderr, "password: %s\n", password);
+ {
+ if (context->debug)
+ fprintf (stderr, "password from keyring found\n");
+ used_gnome_keyring = TRUE;
+ }
if (password == NULL || (error && (*error)))
{
if (context->debug)