summaryrefslogtreecommitdiff
path: root/monitor/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/proxy')
-rw-r--r--monitor/proxy/dbus-interfaces.xml13
-rw-r--r--monitor/proxy/gproxymountoperation.c130
-rw-r--r--monitor/proxy/gvfsproxyvolumemonitordaemon.c66
3 files changed, 161 insertions, 48 deletions
diff --git a/monitor/proxy/dbus-interfaces.xml b/monitor/proxy/dbus-interfaces.xml
index e9a9c29a..03c6caaa 100644
--- a/monitor/proxy/dbus-interfaces.xml
+++ b/monitor/proxy/dbus-interfaces.xml
@@ -178,6 +178,19 @@
<arg type='i' name='choice' direction='in'/>
<arg type='b' name='anonymous' direction='in'/>
</method>
+ <method name="MountOpReply2">
+ <arg type='s' name='mount_op_id' direction='in'/>
+ <arg type='i' name='result' direction='in'/>
+ <arg type='s' name='user_name' direction='in'/>
+ <arg type='s' name='domain' direction='in'/>
+ <arg type='s' name='encoded_password' direction='in'/>
+ <arg type='i' name='password_save' direction='in'/>
+ <arg type='i' name='choice' direction='in'/>
+ <arg type='b' name='anonymous' direction='in'/>
+ <arg type='b' name='hidden_volume' direction='in'/>
+ <arg type='b' name='system_volume' direction='in'/>
+ <arg type='u' name='pim' direction='in'/>
+ </method>
</interface>
</node>
diff --git a/monitor/proxy/gproxymountoperation.c b/monitor/proxy/gproxymountoperation.c
index ac61046e..fffd6e72 100644
--- a/monitor/proxy/gproxymountoperation.c
+++ b/monitor/proxy/gproxymountoperation.c
@@ -45,6 +45,21 @@ typedef struct
gulong reply_handler_id;
} ProxyMountOpData;
+typedef struct
+{
+ ProxyMountOpData *op_data;
+ GMountOperationResult result;
+ const gchar *user_name;
+ const gchar *domain;
+ gchar *encoded_password;
+ gint password_save;
+ gint choice;
+ gboolean anonymous;
+ gboolean hidden_volume;
+ gboolean system_volume;
+ guint pim;
+} MountOpReplyData;
+
static void
proxy_mount_op_data_free (ProxyMountOpData *data)
{
@@ -123,54 +138,99 @@ mount_op_reply_cb (GVfsRemoteVolumeMonitor *proxy,
}
static void
+mount_op_reply2_cb (GVfsRemoteVolumeMonitor *proxy,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ MountOpReplyData *data = user_data;
+ ProxyMountOpData *op_data = data->op_data;
+ GError *error = NULL;
+ gboolean ret;
+
+ ret = gvfs_remote_volume_monitor_call_mount_op_reply2_finish (proxy, res, &error);
+ if (!ret)
+ {
+ if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD))
+ {
+ /* The monitor doesn't implement MountOpReply2(), so we fall back to
+ * MountOpReply()
+ */
+ proxy = g_proxy_volume_monitor_get_dbus_proxy (op_data->monitor);
+ gvfs_remote_volume_monitor_call_mount_op_reply (proxy,
+ op_data->id,
+ data->result,
+ data->user_name,
+ data->domain,
+ data->encoded_password,
+ data->password_save,
+ data->choice,
+ data->anonymous,
+ NULL,
+ (GAsyncReadyCallback) mount_op_reply_cb,
+ op_data);
+ }
+ else
+ g_warning ("Error from MountOpReply2(): %s", error->message);
+
+ g_error_free (error);
+ }
+
+ g_free (data->encoded_password);
+ g_free (data);
+}
+
+static void
mount_operation_reply (GMountOperation *mount_operation,
GMountOperationResult result,
gpointer user_data)
{
- ProxyMountOpData *data = user_data;
+ ProxyMountOpData *op_data = user_data;
+ MountOpReplyData *data;
GVfsRemoteVolumeMonitor *proxy;
- const gchar *user_name;
- const gchar *domain;
const gchar *password;
- gchar *encoded_password;
- gint password_save;
- gint choice;
- gboolean anonymous;
-
- user_name = g_mount_operation_get_username (mount_operation);
- domain = g_mount_operation_get_domain (mount_operation);
- password = g_mount_operation_get_password (mount_operation);
- password_save = g_mount_operation_get_password_save (mount_operation);
- choice = g_mount_operation_get_choice (mount_operation);
- anonymous = g_mount_operation_get_anonymous (mount_operation);
-
- if (user_name == NULL)
- user_name = "";
- if (domain == NULL)
- domain = "";
+
+ data = g_new0 (MountOpReplyData, 1);
+ data->op_data = op_data;
+ data->result = result;
+ data->user_name = g_mount_operation_get_username (mount_operation);
+ data->domain = g_mount_operation_get_domain (mount_operation);
+ password = g_mount_operation_get_password (mount_operation);
+ data->password_save = g_mount_operation_get_password_save (mount_operation);
+ data->choice = g_mount_operation_get_choice (mount_operation);
+ data->anonymous = g_mount_operation_get_anonymous (mount_operation);
+ data->hidden_volume = g_mount_operation_get_is_tcrypt_hidden_volume (mount_operation);
+ data->system_volume = g_mount_operation_get_is_tcrypt_system_volume (mount_operation);
+ data->pim = g_mount_operation_get_pim (mount_operation);
+
+ if (data->user_name == NULL)
+ data->user_name = "";
+ if (data->domain == NULL)
+ data->domain = "";
if (password == NULL)
password = "";
/* NOTE: this is not to add "security", it's merely to prevent accidental exposure
* of passwords when running dbus-monitor
*/
- encoded_password = g_base64_encode ((const guchar *) password, (gsize) (strlen (password) + 1));
-
- proxy = g_proxy_volume_monitor_get_dbus_proxy (data->monitor);
- gvfs_remote_volume_monitor_call_mount_op_reply (proxy,
- data->id,
- result,
- user_name,
- domain,
- encoded_password,
- password_save,
- choice,
- anonymous,
- NULL,
- (GAsyncReadyCallback) mount_op_reply_cb,
- data);
+ data->encoded_password = g_base64_encode ((const guchar *) password, (gsize) (strlen (password) + 1));
+
+ proxy = g_proxy_volume_monitor_get_dbus_proxy (op_data->monitor);
+ gvfs_remote_volume_monitor_call_mount_op_reply2 (proxy,
+ op_data->id,
+ result,
+ data->user_name,
+ data->domain,
+ data->encoded_password,
+ data->password_save,
+ data->choice,
+ data->anonymous,
+ data->hidden_volume,
+ data->system_volume,
+ data->pim,
+ NULL,
+ (GAsyncReadyCallback) mount_op_reply2_cb,
+ data);
g_object_unref (proxy);
- g_free (encoded_password);
}
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/monitor/proxy/gvfsproxyvolumemonitordaemon.c b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
index 05750036..7a3d01bc 100644
--- a/monitor/proxy/gvfsproxyvolumemonitordaemon.c
+++ b/monitor/proxy/gvfsproxyvolumemonitordaemon.c
@@ -1079,17 +1079,20 @@ handle_mount_unmount (GVfsRemoteVolumeMonitor *object,
/* ---------------------------------------------------------------------------------------------------- */
static gboolean
-handle_mount_op_reply (GVfsRemoteVolumeMonitor *object,
- GDBusMethodInvocation *invocation,
- const gchar *arg_mount_op_id,
- gint arg_result,
- const gchar *arg_user_name,
- const gchar *arg_domain,
- const gchar *arg_encoded_password,
- gint arg_password_save,
- gint arg_choice,
- gboolean arg_anonymous,
- gpointer user_data)
+handle_mount_op_reply2 (GVfsRemoteVolumeMonitor *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *arg_mount_op_id,
+ gint arg_result,
+ const gchar *arg_user_name,
+ const gchar *arg_domain,
+ const gchar *arg_encoded_password,
+ gint arg_password_save,
+ gint arg_choice,
+ gboolean arg_anonymous,
+ gboolean arg_hidden_volume,
+ gboolean arg_system_volume,
+ guint arg_pim,
+ gpointer user_data)
{
char *decoded_password;
gsize decoded_password_len;
@@ -1097,7 +1100,7 @@ handle_mount_op_reply (GVfsRemoteVolumeMonitor *object,
GMountOperation *mount_operation;
const gchar *sender;
- print_debug ("in handle_mount_op_reply");
+ print_debug ("in handle_mount_op_reply2");
decoded_password = NULL;
sender = g_dbus_method_invocation_get_sender (invocation);
@@ -1137,16 +1140,52 @@ handle_mount_op_reply (GVfsRemoteVolumeMonitor *object,
g_mount_operation_set_password_save (mount_operation, arg_password_save);
g_mount_operation_set_choice (mount_operation, arg_choice);
g_mount_operation_set_anonymous (mount_operation, arg_anonymous);
+ g_mount_operation_set_is_tcrypt_hidden_volume (mount_operation, arg_hidden_volume);
+ g_mount_operation_set_is_tcrypt_system_volume (mount_operation, arg_system_volume);
+ g_mount_operation_set_pim (mount_operation, arg_pim);
g_mount_operation_reply (mount_operation, arg_result);
- gvfs_remote_volume_monitor_complete_mount_op_reply (object, invocation);
+ /* gvfs_remote_volume_monitor_complete_mount_op_reply2 should be
+ * identical to gvfs_remote_volume_monitor_complete_mount_op_reply,
+ * so it should be ok that we call this from handle_mount_op_reply too.
+ */
+ gvfs_remote_volume_monitor_complete_mount_op_reply2 (object, invocation);
out:
g_free (decoded_password);
return TRUE;
}
+static gboolean
+handle_mount_op_reply (GVfsRemoteVolumeMonitor *object,
+ GDBusMethodInvocation *invocation,
+ const gchar *arg_mount_op_id,
+ gint arg_result,
+ const gchar *arg_user_name,
+ const gchar *arg_domain,
+ const gchar *arg_encoded_password,
+ gint arg_password_save,
+ gint arg_choice,
+ gboolean arg_anonymous,
+ gpointer user_data)
+{
+ return handle_mount_op_reply2 (object,
+ invocation,
+ arg_mount_op_id,
+ arg_result,
+ arg_user_name,
+ arg_domain,
+ arg_encoded_password,
+ arg_password_save,
+ arg_choice,
+ arg_anonymous,
+ FALSE,
+ FALSE,
+ 0,
+ user_data);
+}
+
/* ---------------------------------------------------------------------------------------------------- */
static void
@@ -1926,6 +1965,7 @@ bus_acquired_handler_cb (GDBusConnection *conn,
g_signal_connect (monitor_daemon, "handle-drive-start", G_CALLBACK (handle_drive_start), NULL);
g_signal_connect (monitor_daemon, "handle-drive-stop", G_CALLBACK (handle_drive_stop), NULL);
g_signal_connect (monitor_daemon, "handle-mount-op-reply", G_CALLBACK (handle_mount_op_reply), NULL);
+ g_signal_connect (monitor_daemon, "handle-mount-op-reply2", G_CALLBACK (handle_mount_op_reply2), NULL);
g_signal_connect (monitor_daemon, "handle-mount-unmount", G_CALLBACK (handle_mount_unmount), NULL);
g_signal_connect (monitor_daemon, "handle-volume-mount", G_CALLBACK (handle_volume_mount), NULL);
}