mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	add support for authentication using SCM_CREDENTIALS
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@596 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									a1f5573313
								
							
						
					
					
						commit
						3f264b2c4a
					
				
					 12 changed files with 343 additions and 92 deletions
				
			
		| 
						 | 
				
			
			@ -267,7 +267,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
 | 
			
		|||
    pa_context_fail(c, PA_ERR_CONNECTIONTERMINATED);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, void *userdata) {
 | 
			
		||||
static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const void *creds, void *userdata) {
 | 
			
		||||
    pa_context *c = userdata;
 | 
			
		||||
    
 | 
			
		||||
    assert(p);
 | 
			
		||||
| 
						 | 
				
			
			@ -276,7 +276,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, void *user
 | 
			
		|||
 | 
			
		||||
    pa_context_ref(c);
 | 
			
		||||
    
 | 
			
		||||
    if (pa_pdispatch_run(c->pdispatch, packet, c) < 0)
 | 
			
		||||
    if (pa_pdispatch_run(c->pdispatch, packet, creds, c) < 0)
 | 
			
		||||
        pa_context_fail(c, PA_ERR_PROTOCOL);
 | 
			
		||||
 | 
			
		||||
    pa_context_unref(c);
 | 
			
		||||
| 
						 | 
				
			
			@ -401,7 +401,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) {
 | 
			
		|||
 | 
			
		||||
    t = pa_tagstruct_command(c, PA_COMMAND_AUTH, &tag);
 | 
			
		||||
    pa_tagstruct_put_arbitrary(t, c->conf->cookie, sizeof(c->conf->cookie));
 | 
			
		||||
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
			
		||||
    pa_pstream_send_tagstruct_with_creds(c->pstream, t, 1);
 | 
			
		||||
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c);
 | 
			
		||||
 | 
			
		||||
    pa_context_set_state(c, PA_CONTEXT_AUTHORIZING);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,7 @@
 | 
			
		|||
void pa_command_subscribe_event(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {
 | 
			
		||||
    pa_context *c = userdata;
 | 
			
		||||
    pa_subscription_event_type_t e;
 | 
			
		||||
    uint32_t index;
 | 
			
		||||
    uint32_t idx;
 | 
			
		||||
 | 
			
		||||
    assert(pd);
 | 
			
		||||
    assert(command == PA_COMMAND_SUBSCRIBE_EVENT);
 | 
			
		||||
| 
						 | 
				
			
			@ -46,14 +46,14 @@ void pa_command_subscribe_event(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSE
 | 
			
		|||
    pa_context_ref(c);
 | 
			
		||||
 | 
			
		||||
    if (pa_tagstruct_getu32(t, &e) < 0 ||
 | 
			
		||||
        pa_tagstruct_getu32(t, &index) < 0 ||
 | 
			
		||||
        pa_tagstruct_getu32(t, &idx) < 0 ||
 | 
			
		||||
        !pa_tagstruct_eof(t)) {
 | 
			
		||||
        pa_context_fail(c, PA_ERR_PROTOCOL);
 | 
			
		||||
        goto finish;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (c->subscribe_callback)
 | 
			
		||||
        c->subscribe_callback(c, e, index, c->subscribe_userdata);
 | 
			
		||||
        c->subscribe_callback(c, e, idx, c->subscribe_userdata);
 | 
			
		||||
 | 
			
		||||
finish:
 | 
			
		||||
    pa_context_unref(c);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue