kov changed libgksu/trunk/ChangeLog, libgksu/trunk/libgksu/libgksu.c
Gustavo Noronha
kov at costa.debian.org
Mon May 1 23:26:27 UTC 2006
Mensagem de log:
- handle locales which mess with the 'su:' layout
-----
Modified: libgksu/trunk/ChangeLog
===================================================================
--- libgksu/trunk/ChangeLog 2006-05-01 20:28:28 UTC (rev 615)
+++ libgksu/trunk/ChangeLog 2006-05-01 23:26:26 UTC (rev 616)
@@ -12,6 +12,7 @@
- check fread's return value before using strlen
and setting a \0 in the xauth string, to prevent
problems when xauth returns nothing (#7698)
+ - handle locales which mess with the 'su:' layout
* Release 1.9.2
Modified: libgksu/trunk/libgksu/libgksu.c
===================================================================
--- libgksu/trunk/libgksu/libgksu.c 2006-05-01 20:28:28 UTC (rev 615)
+++ libgksu/trunk/libgksu/libgksu.c 2006-05-01 23:26:26 UTC (rev 616)
@@ -1762,17 +1762,23 @@
fprintf (stderr, "DEBUG (run:post-after-pass) buf: -%s-\n", buf);
}
- if (!strncmp (buf, "su: Authentication failure", 26))
+ if (!strncmp (buf, "su", 2))
{
+ gchar **strings;
+
if (password)
{
nullify_password (password);
unset_gnome_keyring_password (context);
}
- g_set_error (error, gksu_quark,
- GKSU_ERROR_WRONGPASS,
- _("Wrong password."));
+ strings = g_strsplit (buf, ":", 2);
+ if (strings[1] && !strncmp (strings[1], " Authentication failure", 23))
+ g_set_error (error, gksu_quark,
+ GKSU_ERROR_WRONGPASS,
+ _("Wrong password."));
+ g_strfreev (strings);
+
if (context->debug)
fprintf (stderr, "DEBUG (auth_failed) buf: -%s-\n", buf);
}
@@ -1804,18 +1810,41 @@
}
else
{
- gchar *emsg = g_strdup_printf (_("Failed to communicate with "
- "gksu-run-helper.\n\n"
- "Received:\n"
- " %s\n"
- "While expecting:\n"
- " %s"), buf, "gksu: waiting");
- g_set_error (error, gksu_quark, GKSU_ERROR_HELPER, emsg);
- g_free (emsg);
+ gchar *emsg = NULL;
+ gchar *converted_str = NULL;
+ GError *converr = NULL;
if (password)
nullify_password (password);
+ converted_str = g_locale_to_utf8 (buf, -1, NULL, NULL, &converr);
+ if (converr)
+ {
+ g_warning (_("Failed to communicate with "
+ "gksu-run-helper.\n\n"
+ "Received:\n"
+ " %s\n"
+ "While expecting:\n"
+ " %s"), buf, "gksu: waiting");
+ emsg = g_strdup_printf (_("Failed to communicate with "
+ "gksu-run-helper.\n\n"
+ "Received bad string "
+ "while expecting:\n"
+ " %s"), "gksu: waiting");
+ g_error_free (converr);
+ }
+ else
+ emsg = g_strdup_printf (_("Failed to communicate with "
+ "gksu-run-helper.\n\n"
+ "Received:\n"
+ " %s\n"
+ "While expecting:\n"
+ " %s"), converted_str, "gksu: waiting");
+ g_free (converted_str);
+
+ g_set_error (error, gksu_quark, GKSU_ERROR_HELPER, emsg);
+ g_free (emsg);
+
if (context->debug)
fprintf (stderr, "DEBUG (failed!) buf: -%s-\n", buf);
More information about the gksu-commits
mailing list