From b1ab6869fbe705f06faa12310c76b7d856030d81 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 12 Sep 2004 23:40:53 +0000 Subject: fix public= on native and esound protocol git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@195 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/protocol-native.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'polyp/protocol-native.c') diff --git a/polyp/protocol-native.c b/polyp/protocol-native.c index 3056f7c4..2d26c2f5 100644 --- a/polyp/protocol-native.c +++ b/polyp/protocol-native.c @@ -674,14 +674,17 @@ static void command_auth(struct pa_pdispatch *pd, uint32_t command, uint32_t tag protocol_error(c); return; } + + if (!c->authorized) { + if (memcmp(c->protocol->auth_cookie, cookie, PA_NATIVE_COOKIE_LENGTH) != 0) { + pa_log(__FILE__": Denied access to client with invalid authorization key.\n"); + pa_pstream_send_error(c->pstream, tag, PA_ERROR_ACCESS); + return; + } - if (memcmp(c->protocol->auth_cookie, cookie, PA_NATIVE_COOKIE_LENGTH) != 0) { - pa_log(__FILE__": Denied access to client with invalid authorization key.\n"); - pa_pstream_send_error(c->pstream, tag, PA_ERROR_ACCESS); - return; + c->authorized = 1; } - - c->authorized = 1; + pa_pstream_send_simple_ack(c->pstream, tag); return; } @@ -1547,7 +1550,7 @@ static struct pa_protocol_native* protocol_new_internal(struct pa_core *c, struc assert(c && ma); if (pa_modargs_get_value_boolean(ma, "public", &public) < 0) { - pa_log(__FILE__": public= expects numeric argument.\n"); + pa_log(__FILE__": public= expects a boolean argument.\n"); return NULL; } -- cgit