summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2011-08-07 17:20:37 +0200
committerChristian Kellner <gicmo@gnome.org>2011-08-25 21:19:54 +0200
commit86c934c0c06ce9b23baa580354a674bc39ae1443 (patch)
treeab3eda07f36f1842095863323bfcb8f54ab067ee /daemon
parentef3653828ee408451e34975b4e169e2aa841e367 (diff)
downloadgvfs-86c934c0c06ce9b23baa580354a674bc39ae1443.tar.gz
afp: mount volumes as the user who is logged in in the afpbrowse backend
this way you don't have to write your user credentials twice if you're first browsing a server and then mounting one of it's volumes.
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gvfsafpserver.c10
-rw-r--r--daemon/gvfsbackendafpbrowse.c10
2 files changed, 17 insertions, 3 deletions
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c
index cf1c431f..a14f2e78 100644
--- a/daemon/gvfsafpserver.c
+++ b/daemon/gvfsafpserver.c
@@ -937,6 +937,9 @@ g_vfs_afp_server_login (GVfsAfpServer *afp_serv,
res = FALSE;
break;
}
+
+ if (!user)
+ user = g_strdup (olduser);
try_login:
@@ -990,7 +993,12 @@ try_login:
}
if (logged_in_user)
- *logged_in_user = user;
+ {
+ if (anonymous)
+ *logged_in_user = g_strdup ("anonymous");
+ else
+ *logged_in_user = user;
+ }
else
g_free (user);
diff --git a/daemon/gvfsbackendafpbrowse.c b/daemon/gvfsbackendafpbrowse.c
index 5b8b80d2..4b5c5db4 100644
--- a/daemon/gvfsbackendafpbrowse.c
+++ b/daemon/gvfsbackendafpbrowse.c
@@ -57,7 +57,8 @@ struct _GVfsBackendAfpBrowse
GMountTracker *mount_tracker;
GVfsAfpServer *server;
- GSList *volumes;
+ char *logged_in_user;
+ GSList *volumes;
};
@@ -251,6 +252,7 @@ mount_mountable_cb (GVfsBackendAfpBrowse *afp_backend,
g_mount_spec_set (mount_spec, "host",
g_network_address_get_hostname (G_NETWORK_ADDRESS (afp_backend->addr)));
g_mount_spec_set (mount_spec, "volume", vol_data->name);
+ g_mount_spec_set (mount_spec, "user", afp_backend->logged_in_user);
g_vfs_job_mount_mountable_set_target (job, mount_spec, "/", TRUE);
g_mount_spec_unref (mount_spec);
@@ -304,6 +306,7 @@ fill_info (GFileInfo *info, VolumeData *vol_data, GVfsBackendAfpBrowse *afp_back
g_mount_spec_set (mount_spec, "host",
g_network_address_get_hostname (G_NETWORK_ADDRESS (afp_backend->addr)));
g_mount_spec_set (mount_spec, "volume", vol_data->name);
+ g_mount_spec_set (mount_spec, "user", afp_backend->logged_in_user);
if (g_mount_tracker_has_mount_spec (afp_backend->mount_tracker, mount_spec))
{
@@ -455,7 +458,8 @@ do_mount (GVfsBackend *backend,
afp_backend->server = g_vfs_afp_server_new (afp_backend->addr);
res = g_vfs_afp_server_login (afp_backend->server, afp_backend->user, mount_source,
- NULL, G_VFS_JOB (job)->cancellable, &err);
+ &afp_backend->logged_in_user,
+ G_VFS_JOB (job)->cancellable, &err);
if (!res)
goto error;
@@ -539,6 +543,7 @@ g_vfs_backend_afp_browse_init (GVfsBackendAfpBrowse *object)
afp_backend->addr = NULL;
afp_backend->user = NULL;
+ afp_backend->logged_in_user = NULL;
afp_backend->volumes = NULL;
}
@@ -554,6 +559,7 @@ g_vfs_backend_afp_browse_finalize (GObject *object)
g_free (afp_backend->user);
+ g_free (afp_backend->logged_in_user);
g_slist_free_full (afp_backend->volumes, (GDestroyNotify)volume_data_free);
G_OBJECT_CLASS (g_vfs_backend_afp_browse_parent_class)->finalize (object);