handsfree-audio: Reject .Connect() from other senders

Only the agent should be able to call .Connect() on the card.
This commit is contained in:
Vinicius Costa Gomes 2013-03-25 19:05:20 -03:00 committed by Denis Kenzior
parent cc5a86f1db
commit 798ff5887b
1 changed files with 6 additions and 0 deletions

View File

@ -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);