From 95f1ca6f520c06a511f9238de2583ed0c0b3a17a Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 13 Apr 2009 19:16:30 +0000 Subject: [PATCH] - Add ssh-auth-sock patch from svn --- gvfs-1.2.2-ssh-auth-sock.patch | 117 +++++++++++++++++++++++++++++++++ gvfs.spec | 8 ++- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 gvfs-1.2.2-ssh-auth-sock.patch diff --git a/gvfs-1.2.2-ssh-auth-sock.patch b/gvfs-1.2.2-ssh-auth-sock.patch new file mode 100644 index 0000000..16b3dbd --- /dev/null +++ b/gvfs-1.2.2-ssh-auth-sock.patch @@ -0,0 +1,117 @@ +Index: daemon/gvfsbackendsftp.c +=================================================================== +--- daemon/gvfsbackendsftp.c (revision 2371) ++++ daemon/gvfsbackendsftp.c (working copy) +@@ -333,6 +333,84 @@ look_for_stderr_errors (GVfsBackend *bac + } + } + ++static gchar* ++read_dbus_string_dict_value (DBusMessageIter *args, const gchar *key) ++{ ++ DBusMessageIter items, entry; ++ gchar *str, *sig; ++ ++ sig = dbus_message_iter_get_signature (args); ++ if (!sig || strcmp (sig, "a{ss}") != 0) ++ return NULL; ++ ++ dbus_message_iter_recurse (args, &items); ++ ++ if (dbus_message_iter_has_next (&items)) ++ { ++ do ++ { ++ dbus_message_iter_recurse (&items, &entry); ++ dbus_message_iter_get_basic (&entry, &str); ++ if (str && strcmp (key, str) == 0) ++ { ++ dbus_message_iter_next (&entry); ++ dbus_message_iter_get_basic (&entry, &str); ++ return g_strdup (str); ++ } ++ } ++ while (dbus_message_iter_next (&items)); ++ } ++ ++ return NULL; ++} ++ ++static void ++setup_ssh_environment (void) ++{ ++ DBusConnection *dconn; ++ DBusMessage *reply; ++ DBusMessage *msg; ++ DBusMessageIter args; ++ DBusError derr; ++ gchar *env; ++ ++ dbus_error_init (&derr); ++ dconn = dbus_bus_get (DBUS_BUS_SESSION, &derr); ++ if (!dconn) ++ return; ++ ++ msg = dbus_message_new_method_call ("org.gnome.keyring", ++ "/org/gnome/keyring/daemon", ++ "org.gnome.keyring.Daemon", ++ "GetEnvironment"); ++ if (!msg) ++ { ++ dbus_connection_unref (dconn); ++ return; ++ } ++ ++ /* Send message and get a handle for a reply */ ++ reply = dbus_connection_send_with_reply_and_block (dconn, msg, 1000, &derr); ++ dbus_message_unref (msg); ++ if (!reply) ++ { ++ dbus_connection_unref (dconn); ++ return; ++ } ++ ++ /* Read the return value */ ++ if (dbus_message_iter_init (reply, &args)) ++ { ++ env = read_dbus_string_dict_value (&args, "SSH_AUTH_SOCK"); ++ if (env && env[0]) ++ g_setenv ("SSH_AUTH_SOCK", env, TRUE); ++ g_free (env); ++ } ++ ++ dbus_message_unref (reply); ++ dbus_connection_unref (dconn); ++} ++ + static char ** + setup_ssh_commandline (GVfsBackend *backend) + { +@@ -1559,6 +1637,18 @@ do_mount (GVfsBackend *backend, + /* NOTE: job_succeeded called async from setup_icon reply */ + } + ++static void ++real_do_mount (GVfsBackend *backend, ++ GVfsJobMount *job, ++ GMountSpec *mount_spec, ++ GMountSource *mount_source, ++ gboolean is_automount) ++{ ++ setup_ssh_environment (); ++ ++ do_mount (backend, job, mount_spec, mount_source, is_automount); ++} ++ + static gboolean + try_mount (GVfsBackend *backend, + GVfsJobMount *job, +@@ -4481,7 +4571,7 @@ g_vfs_backend_sftp_class_init (GVfsBacke + + gobject_class->finalize = g_vfs_backend_sftp_finalize; + +- backend_class->mount = do_mount; ++ backend_class->mount = real_do_mount; + backend_class->try_mount = try_mount; + backend_class->try_open_icon_for_read = try_open_icon_for_read; + backend_class->try_open_for_read = try_open_for_read; diff --git a/gvfs.spec b/gvfs.spec index 232da6e..66bc8ea 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -1,7 +1,7 @@ Summary: Backends for the gio framework in GLib Name: gvfs Version: 1.2.2 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -34,6 +34,8 @@ Patch1: gvfs-0.99.2-archive-integration.patch Patch2: gvfs-1.1.7-gdu-computer-expose-devices.patch # http://bugzilla.gnome.org/show_bug.cgi?id=578681 Patch3: gvfs-bash-completion.patch +# From svn: +Patch4: gvfs-1.2.2-ssh-auth-sock.patch # Gdu volume monitor patches, from http://cgit.freedesktop.org/~david/gvfs/log/?h=gdu-volume-monitor # @@ -139,6 +141,7 @@ media players (Media Transfer Protocol) to applications using gvfs. %patch1 -p0 -b .archive-integration %patch2 -p1 -b .computer-expose-devices %patch3 -p1 -b .bash-completion +%patch4 -p0 -b .ssh-auth-sock %patch101 -p1 -b .gdu-volume-monitor %patch102 -p1 -b .gdu-volumes-typo @@ -292,6 +295,9 @@ update-desktop-database &> /dev/null ||: %changelog +* Mon Apr 13 2009 Alexander Larsson - 1.2.2-2 +- Add ssh-auth-sock patch from svn + * Mon Apr 13 2009 Matthias Clasen - 1.2.2-1 - Update to 1.2.2 - Allow eject even on non-ejectable devices