git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1278
fefdeb5f-60dc-0310-8127-
8f9354f1896f
c->subscribe_userdata = NULL;
c->mempool = pa_mempool_new(1);
c->subscribe_userdata = NULL;
c->mempool = pa_mempool_new(1);
c->server_list = NULL;
c->server = NULL;
c->autospawn_lock_fd = -1;
c->server_list = NULL;
c->server = NULL;
c->autospawn_lock_fd = -1;
+ /* Enable shared memory support if possible */
+ if (c->version >= 10 &&
+ pa_mempool_is_shared(c->mempool) &&
+ c->is_local) {
+
+ /* Only enable SHM if both sides are owned by the same
+ * user. This is a security measure because otherwise
+ * data private to the user might leak. */
+
+ const pa_creds *creds;
+ if ((creds = pa_pdispatch_creds(pd)))
+ if (getuid() == creds->uid)
+ pa_pstream_use_shm(c->pstream, 1);
+ }
+
reply = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag);
pa_tagstruct_puts(reply, c->name);
pa_pstream_send_tagstruct(c->pstream, reply);
reply = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag);
pa_tagstruct_puts(reply, c->name);
pa_pstream_send_tagstruct(c->pstream, reply);
assert(!c->pstream);
c->pstream = pa_pstream_new(c->mainloop, io, c->mempool);
assert(!c->pstream);
c->pstream = pa_pstream_new(c->mainloop, io, c->mempool);
- pa_pstream_use_shm(c->pstream, 1);
-
pa_pstream_set_die_callback(c->pstream, pstream_die_callback, c);
pa_pstream_set_recieve_packet_callback(c->pstream, pstream_packet_callback, c);
pa_pstream_set_recieve_memblock_callback(c->pstream, pstream_memblock_callback, c);
pa_pstream_set_die_callback(c->pstream, pstream_die_callback, c);
pa_pstream_set_recieve_packet_callback(c->pstream, pstream_packet_callback, c);
pa_pstream_set_recieve_memblock_callback(c->pstream, pstream_memblock_callback, c);
+ if (pa_iochannel_creds_supported(io))
+ pa_iochannel_creds_enable(io);
+
ucred.uid = getuid();
ucred.gid = getgid();
pa_pstream_send_tagstruct_with_creds(c->pstream, t, &ucred);
}
#else
ucred.uid = getuid();
ucred.gid = getgid();
pa_pstream_send_tagstruct_with_creds(c->pstream, t, &ucred);
}
#else
- pa_pstream_send_tagstruct_with_creds(c->pstream, t, NULL);
+ pa_pstream_send_tagstruct(c->pstream, t, NULL);
#endif
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c, NULL);
#endif
pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c, NULL);
io = pa_iochannel_new(c->mainloop, fds[0], fds[0]);
io = pa_iochannel_new(c->mainloop, fds[0], fds[0]);
if (!(c->client = pa_socket_client_new_string(c->mainloop, u, PA_NATIVE_DEFAULT_PORT)))
continue;
if (!(c->client = pa_socket_client_new_string(c->mainloop, u, PA_NATIVE_DEFAULT_PORT)))
continue;
- c->local = pa_socket_client_is_local(c->client);
+ c->is_local = pa_socket_client_is_local(c->client);
pa_socket_client_set_callback(c->client, on_connection, c);
break;
}
pa_socket_client_set_callback(c->client, on_connection, c);
break;
}
int pa_context_is_local(pa_context *c) {
assert(c);
int pa_context_is_local(pa_context *c) {
assert(c);
}
pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
}
pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
int do_autospawn;
int autospawn_lock_fd;
pa_spawn_api spawn_api;
int do_autospawn;
int autospawn_lock_fd;
pa_spawn_api spawn_api;