summaryrefslogtreecommitdiff
path: root/src/pulsecore/iochannel.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-07-19 17:44:19 +0000
committerLennart Poettering <lennart@poettering.net>2006-07-19 17:44:19 +0000
commit9c87a65ce91c38b60c19ae108a51a2e8ce46a85c (patch)
tree36cca05b57ef1148ea16889ccdfef4536b300cb9 /src/pulsecore/iochannel.c
parent9db70682d68cc4fef9314677b6427582e5d5c8f2 (diff)
* add new --system command line parameter to the daemon for running PulseAudio as system-wide instance
* add PA_ prefixes to all global #defines * modify auth-by-creds: define a new group "pulse-access" which is used for authentication * add proper privilige dropping when running in --system mode * create runtime directory once on startup and not by each module seperately git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1105 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/iochannel.c')
-rw-r--r--src/pulsecore/iochannel.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index 15aa8e35c..852e960ea 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -263,12 +263,12 @@ int pa_iochannel_creds_enable(pa_iochannel *io) {
return 0;
}
-ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l) {
+ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l, const struct ucred *ucred) {
ssize_t r;
struct msghdr mh;
struct iovec iov;
uint8_t cmsg_data[CMSG_SPACE(sizeof(struct ucred))];
- struct ucred *ucred;
+ struct ucred *u;
struct cmsghdr *cmsg;
assert(io);
@@ -286,10 +286,15 @@ ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_CREDENTIALS;
- ucred = (struct ucred*) CMSG_DATA(cmsg);
- ucred->pid = getpid();
- ucred->uid = getuid();
- ucred->gid = getgid();
+ u = (struct ucred*) CMSG_DATA(cmsg);
+
+ if (ucred)
+ *u = *ucred;
+ else {
+ u->pid = getpid();
+ u->uid = getuid();
+ u->gid = getgid();
+ }
memset(&mh, 0, sizeof(mh));
mh.msg_name = NULL;