From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH obexd v1 07/16] client: Use transfer owner instead of agent
Date: Fri, 25 May 2012 12:11:24 +0200 [thread overview]
Message-ID: <1337940693-3417-8-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1337940693-3417-1-git-send-email-mikel.astiz.oss@gmail.com>
From: Mikel Astiz <mikel.astiz@bmw-carit.de>
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 9c09aac..ab9f84a 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 */
@@ -165,7 +165,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");
@@ -226,7 +226,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);
@@ -252,7 +252,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 */
@@ -261,7 +261,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
next prev parent reply other threads:[~2012-05-25 10:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-25 10:11 [PATCH obexd v1 00/16] client: Remove D-Bus agent Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 01/16] client: Add D-Bus helper library Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 02/16] client-doc: Add progress property to transfer Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 03/16] client: " Mikel Astiz
2012-05-25 10:15 ` Mikel Astiz
2012-05-25 10:35 ` Luiz Augusto von Dentz
2012-05-25 10:45 ` Mikel Astiz
2012-05-25 10:55 ` Luiz Augusto von Dentz
2012-05-25 11:02 ` Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 04/16] client-doc: Add transfer event-reporting signals Mikel Astiz
2012-05-25 10:50 ` Luiz Augusto von Dentz
2012-05-25 10:57 ` Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 05/16] client: " Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 06/16] client-doc: Remove D-Bus agent Mikel Astiz
2012-05-25 10:11 ` Mikel Astiz [this message]
2012-05-25 10:11 ` [PATCH obexd v1 08/16] client: " Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 09/16] client: Remove unused functions in transfer API Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 10/16] client: Remove internal transfer progress report Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 11/16] client: Remove obsolete authentication code Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 12/16] client: Make D-Bus exposure of transfers optional Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 13/16] client-doc: Add signal to report new transfers Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 14/16] client: Expose D-Bus data in internal transfer API Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 15/16] client: Add signal to report new transfers Mikel Astiz
2012-05-25 10:11 ` [PATCH obexd v1 16/16] client-test: Remove agent from ftp-client Mikel Astiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337940693-3417-8-git-send-email-mikel.astiz.oss@gmail.com \
--to=mikel.astiz.oss@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mikel.astiz@bmw-carit.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox