From a382492204ad3588c0c837e120e5bc31578df72a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 19 Jul 2006 21:48:35 +0000 Subject: * add new function pa_check_in_group() * abstract credential APis a little bit by introducing HAVE_CREDS and a structure pa_creds * rework credential authentication * fix module-volume-restore and friends for usage in system-wide instance * remove loopback= argument from moulde-*-protocol-tcp since it is a superset of listen= and usually a bad idea anyway since the user shouldn't load the TCP module at all if he doesn't want remote access * rename a few variables in the jack modules to make sure they don't conflict with symbols defined in the system headers * add server address for system-wide daemons to the default server list for the the client libs * update todo git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1109 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/pstream.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/pulsecore/pstream.c') diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c index 7ef49305..de5fa43e 100644 --- a/src/pulsecore/pstream.c +++ b/src/pulsecore/pstream.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "pstream.h" @@ -69,9 +70,9 @@ struct item_info { /* packet info */ pa_packet *packet; -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS int with_creds; - struct ucred creds; + pa_creds creds; #endif }; @@ -114,8 +115,8 @@ struct pa_pstream { pa_memblock_stat *memblock_stat; -#ifdef SCM_CREDENTIALS - struct ucred read_creds, write_creds; +#ifdef HAVE_CREDS + pa_creds read_creds, write_creds; int read_creds_valid, send_creds_now; #endif }; @@ -216,7 +217,7 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_memblock_sta pa_iochannel_socket_set_rcvbuf(io, 1024*8); pa_iochannel_socket_set_sndbuf(io, 1024*8); -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS p->send_creds_now = 0; p->read_creds_valid = 0; #endif @@ -258,7 +259,7 @@ static void pstream_free(pa_pstream *p) { pa_xfree(p); } -void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const struct ucred *creds) { +void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_creds *creds) { struct item_info *i; assert(p && packet && p->ref >= 1); @@ -270,7 +271,7 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const struct ucred i = pa_xnew(struct item_info, 1); i->type = PA_PSTREAM_ITEM_PACKET; i->packet = pa_packet_ref(packet); -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS if ((i->with_creds = !!creds)) i->creds = *creds; #endif @@ -294,7 +295,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa i->channel = channel; i->offset = offset; i->seek_mode = seek_mode; -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS i->with_creds = 0; #endif @@ -334,7 +335,7 @@ static void prepare_next_write_item(pa_pstream *p) { p->write.descriptor[PA_PSTREAM_DESCRIPTOR_SEEK] = htonl(p->write.current->seek_mode); } -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS if ((p->send_creds_now = p->write.current->with_creds)) p->write_creds = p->write.current->creds; @@ -364,7 +365,7 @@ static int do_write(pa_pstream *p) { l = ntohl(p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) - (p->write.index - PA_PSTREAM_DESCRIPTOR_SIZE); } -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS if (p->send_creds_now) { if ((r = pa_iochannel_write_with_creds(p->io, d, l, &p->write_creds)) < 0) @@ -406,7 +407,7 @@ static int do_read(pa_pstream *p) { l = ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) - (p->read.index - PA_PSTREAM_DESCRIPTOR_SIZE); } -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS { int b = 0; @@ -495,7 +496,7 @@ static int do_read(pa_pstream *p) { assert(p->read.packet); if (p->recieve_packet_callback) -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS p->recieve_packet_callback(p, p->read.packet, p->read_creds_valid ? &p->read_creds : NULL, p->recieve_packet_callback_userdata); #else p->recieve_packet_callback(p, p->read.packet, NULL, p->recieve_packet_callback_userdata); @@ -506,7 +507,7 @@ static int do_read(pa_pstream *p) { } p->read.index = 0; -#ifdef SCM_CREDENTIALS +#ifdef HAVE_CREDS p->read_creds_valid = 0; #endif } -- cgit