[pulseaudio-discuss] [PATCH 4/5] protocol-native: add access checks

David Henningsson david.henningsson at canonical.com
Fri Jul 24 06:16:40 PDT 2015



On 2015-04-07 17:13, Wim Taymans wrote:
> +static void check_access_finish_cb(pa_access_data *data, bool res) {
> +    pa_protocol_native_access_data *d = (pa_protocol_native_access_data *) data;
> +    pa_native_connection *c = PA_NATIVE_CONNECTION(d->userdata);
> +
> +    if (!res) {
> +        pa_pstream_send_error(c->pstream, d->tag, PA_ERR_ACCESS); \
> +        goto finish;
> +    }
> +
> +    /* call the dispatcher again, hopefully this time, the access check will
> +     * fail or succeed immediately */
> +    command_table[d->command](d->pd, d->command, d->tag, d->tc, d->userdata);

While testing this code, it wasn't working. You have to re-read the 
command and the tag, just like pdispatch_run does.

I e, like this:

     pa_assert_se(pa_tagstruct_getu32(d->tc, &command) >= 0);
     pa_assert_se(pa_tagstruct_getu32(d->tc, &tag) >= 0);
     pa_assert(command == d->command);
     pa_assert(tag == d->tag);

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list