summaryrefslogtreecommitdiff
path: root/security/gnome-keyring/patches/patch-ab
diff options
context:
space:
mode:
Diffstat (limited to 'security/gnome-keyring/patches/patch-ab')
-rw-r--r--security/gnome-keyring/patches/patch-ab65
1 files changed, 65 insertions, 0 deletions
diff --git a/security/gnome-keyring/patches/patch-ab b/security/gnome-keyring/patches/patch-ab
new file mode 100644
index 00000000000..b1589948cc5
--- /dev/null
+++ b/security/gnome-keyring/patches/patch-ab
@@ -0,0 +1,65 @@
+$NetBSD: patch-ab,v 1.1 2006/08/27 16:10:21 jmmv Exp $
+
+http://bugzilla.gnome.org/show_bug.cgi?id=353105
+
+--- gnome-keyring.c.orig 2006-03-03 14:58:58.000000000 +0100
++++ gnome-keyring.c
+@@ -52,6 +52,7 @@ typedef enum {
+
+ typedef enum {
+ STATE_FAILED,
++ STATE_INITIALIZING,
+ STATE_WRITING_CREDS,
+ STATE_WRITING_PACKET,
+ STATE_READING_REPLY
+@@ -248,6 +249,24 @@ write_all (int fd, const char *buf, size
+ return 0;
+ }
+
++static void
++init_connection (GnomeKeyringOperation *op)
++{
++ char buf;
++ ssize_t len;
++
++ len = read (op->socket, &buf, sizeof (buf));
++ if (len == sizeof (buf)) {
++ if (buf != '\0')
++ g_warning ("Invalid initialization byte: %d\n", buf);
++ else
++ op->state = STATE_WRITING_CREDS;
++ } else
++ g_warning ("Failed to read initialization byte: %s",
++ len == 0 ? "No data available" : strerror (errno));
++}
++
++
+ static GnomeKeyringResult
+ write_credentials_byte_sync (int socket)
+ {
+@@ -314,6 +333,9 @@ operation_io (GIOChannel *io_channel,
+ schedule_op_failed (op, GNOME_KEYRING_RESULT_IO_ERROR);
+ }
+
++ if (op->state == STATE_INITIALIZING && (cond & G_IO_IN)) {
++ init_connection (op);
++ }
+ if (op->state == STATE_WRITING_CREDS && (cond & G_IO_OUT)) {
+ write_credentials_byte (op);
+ }
+@@ -420,13 +442,13 @@ start_operation (gpointer callback, Keyr
+ if (op->socket < 0) {
+ schedule_op_failed (op, GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON);
+ } else {
+- op->state = STATE_WRITING_CREDS;
++ op->state = STATE_INITIALIZING;
+ op->send_buffer = g_string_new (NULL);
+ op->send_pos = 0;
+
+ channel = g_io_channel_unix_new (op->socket);
+ op->io_watch = g_io_add_watch (channel,
+- G_IO_OUT | G_IO_HUP,
++ G_IO_IN | G_IO_OUT | G_IO_HUP,
+ operation_io, op);
+ g_io_channel_unref (channel);
+ }