mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
auth support in esound and native
AUTH and SET_NAME operatins in native simple library git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@51 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
722c2c8c87
commit
f8cbde54da
22 changed files with 615 additions and 98 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <arpa/inet.h>
|
||||
|
|
@ -50,13 +52,24 @@ int module_init(struct pa_core *c, struct pa_module*m) {
|
|||
assert(c && m);
|
||||
|
||||
#ifdef USE_TCP_SOCKETS
|
||||
if (!(s = pa_socket_server_new_ipv4(c->mainloop, INADDR_LOOPBACK, IPV4_PORT)))
|
||||
if (!(s = pa_socket_server_new_ipv4(c->mainloop, INADDR_ANY, IPV4_PORT)))
|
||||
return -1;
|
||||
#else
|
||||
if (pa_make_secure_dir(UNIX_SOCKET_DIR) < 0) {
|
||||
fprintf(stderr, "Failed to create secure socket directory.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
int r;
|
||||
if ((r = pa_unix_socket_remove_stale(UNIX_SOCKET)) < 0) {
|
||||
fprintf(stderr, "Failed to remove stale UNIX socket '%s': %s\n", UNIX_SOCKET, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (r)
|
||||
fprintf(stderr, "Removed stale UNIX socket '%s'.", UNIX_SOCKET);
|
||||
}
|
||||
|
||||
if (!(s = pa_socket_server_new_unix(c->mainloop, UNIX_SOCKET))) {
|
||||
rmdir(UNIX_SOCKET_DIR);
|
||||
|
|
@ -69,8 +82,12 @@ int module_init(struct pa_core *c, struct pa_module*m) {
|
|||
#else
|
||||
m->userdata = protocol_new(c, s);
|
||||
#endif
|
||||
|
||||
assert(m->userdata);
|
||||
|
||||
if (!m->userdata) {
|
||||
pa_socket_server_free(s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue