Only the agent should be able to call .Connect() on the card.
---
 src/handsfree-audio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 4232074..f8df6d6 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -312,11 +312,17 @@ static DBusMessage *card_connect(DBusConnection *conn,
 {
        struct ofono_handsfree_card *card = data;
        GIOChannel *io;
+       const char *sender;
        int sk;
 
        if (agent == NULL)
                return __ofono_error_not_available(msg);
 
+       sender = dbus_message_get_sender(msg);
+
+       if (!g_str_equal(sender, agent->owner))
+               return __ofono_error_not_allowed(msg);
+
        if (card->msg)
                return __ofono_error_busy(msg);
 
-- 
1.8.2

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to