[PATCH v2 12/14] bluetooth: Implement org.ofono.HandsfreeAudioAgent.NewConnection()

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

 



On Wed, 2014-09-10 at 11:48 +0200, Luiz Augusto von Dentz wrote:
> From: Jo?o Paulo Rechi Vita <jprvita at openbossa.org>
> 
> ---
>  src/modules/bluetooth/backend-ofono.c | 32 ++++++++++++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules/bluetooth/backend-ofono.c b/src/modules/bluetooth/backend-ofono.c
> index c17aed7..9a530b8 100644
> --- a/src/modules/bluetooth/backend-ofono.c
> +++ b/src/modules/bluetooth/backend-ofono.c
> @@ -505,7 +505,10 @@ static DBusMessage *hf_audio_agent_release(DBusConnection *c, DBusMessage *m, vo
>  
>  static DBusMessage *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage *m, void *data) {
>      DBusMessage *r;
> -    const char *sender;
> +    const char *sender, *path;
> +    int fd;
> +    uint8_t codec;
> +    struct hf_audio_card *card;
>      pa_bluetooth_backend *backend = data;
>  
>      pa_assert(backend);
> @@ -516,7 +519,32 @@ static DBusMessage *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
>          return r;
>      }
>  
> -    r = dbus_message_new_error(m, "org.ofono.Error.NotImplemented", "Operation is not implemented");
> +    if (dbus_message_get_args(m, NULL,
> +                              DBUS_TYPE_OBJECT_PATH, &path,
> +                              DBUS_TYPE_UNIX_FD, &fd,
> +                              DBUS_TYPE_BYTE, &codec,
> +                              DBUS_TYPE_INVALID) == FALSE) {
> +        pa_assert_se(r = dbus_message_new_error(m, "org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
> +        return r;
> +    }
> +
> +    pa_assert_se(card = pa_hashmap_get(backend->cards, path));

path comes from oFono, so we don't trust it. This needs proper error
handling.

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux