[PATCH obexd v0 07/16] client: Use transfer owner instead of agent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

The security checks in the transfers' D-Bus API will consider check for
the transfer owner's path (session owner) instead of the agent path.
---
 client/session.c  |    9 ++-------
 client/transfer.c |   10 +++++-----
 client/transfer.h |    2 +-
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/client/session.c b/client/session.c
index 94256b4..9c4c9f0 100644
--- a/client/session.c
+++ b/client/session.c
@@ -793,7 +793,6 @@ guint obc_session_queue(struct obc_session *session,
 				GError **err)
 {
 	struct pending_request *p;
-	const char *agent;
 	int perr;
 
 	if (session->obex == NULL) {
@@ -803,12 +802,8 @@ guint obc_session_queue(struct obc_session *session,
 		return 0;
 	}
 
-	if (session->agent)
-		agent = obc_agent_get_name(session->agent);
-	else
-		agent = NULL;
-
-	if (!obc_transfer_register(transfer, session->conn, agent, err)) {
+	if (!obc_transfer_register(transfer, session->conn, session->owner,
+									err)) {
 		obc_transfer_unregister(transfer);
 		return 0;
 	}
diff --git a/client/transfer.c b/client/transfer.c
index 09abe50..e6e9d46 100644
--- a/client/transfer.c
+++ b/client/transfer.c
@@ -67,7 +67,7 @@ struct obc_transfer {
 	struct transfer_callback *callback;
 	DBusConnection *conn;
 	DBusMessage *msg;
-	char *agent;		/* Transfer agent */
+	char *owner;		/* Transfer initiator */
 	char *path;		/* Transfer path */
 	gchar *filename;	/* Transfer file location */
 	char *name;		/* Transfer object name */
@@ -164,7 +164,7 @@ static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
 	const gchar *sender;
 
 	sender = dbus_message_get_sender(message);
-	if (g_strcmp0(transfer->agent, sender) != 0)
+	if (g_strcmp0(transfer->owner, sender) != 0)
 		return g_dbus_create_error(message,
 				"org.openobex.Error.NotAuthorized",
 				"Not Authorized");
@@ -225,7 +225,7 @@ static void obc_transfer_free(struct obc_transfer *transfer)
 		g_obex_unref(transfer->obex);
 
 	g_free(transfer->callback);
-	g_free(transfer->agent);
+	g_free(transfer->owner);
 	g_free(transfer->filename);
 	g_free(transfer->name);
 	g_free(transfer->type);
@@ -251,7 +251,7 @@ static struct obc_transfer *obc_transfer_create(guint8 op,
 
 gboolean obc_transfer_register(struct obc_transfer *transfer,
 						DBusConnection *conn,
-						const char *agent,
+						const char *owner,
 						GError **err)
 {
 	/* for OBEX specific mime types we don't need to register a transfer */
@@ -260,7 +260,7 @@ gboolean obc_transfer_register(struct obc_transfer *transfer,
 			strncmp(transfer->type, "x-bt/", 5) == 0))
 		goto done;
 
-	transfer->agent = g_strdup(agent);
+	transfer->owner = g_strdup(owner);
 
 	transfer->path = g_strdup_printf("%s/transfer%ju",
 			TRANSFER_BASEPATH, counter++);
diff --git a/client/transfer.h b/client/transfer.h
index bf40a4c..a65a2ed 100644
--- a/client/transfer.h
+++ b/client/transfer.h
@@ -36,7 +36,7 @@ struct obc_transfer *obc_transfer_put(const char *type, const char *name,
 
 gboolean obc_transfer_register(struct obc_transfer *transfer,
 					DBusConnection *conn,
-					const char *agent,
+					const char *owner,
 					GError **err);
 
 void obc_transfer_unregister(struct obc_transfer *transfer);
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux