mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
pulse-server: add auth-anonymous option
Add the auth-anonymous option to module-native-protocol-tcp. It does not exactly do what pulseaudio does but it will enable unrestricted access instead. Fixes #1899
This commit is contained in:
parent
aa33c2841c
commit
1fad806b8d
1 changed files with 23 additions and 3 deletions
|
|
@ -74,7 +74,8 @@ static const struct spa_dict_item module_native_protocol_tcp_info[] = {
|
||||||
{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
|
{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
|
||||||
{ PW_KEY_MODULE_DESCRIPTION, "Native protocol (TCP sockets)" },
|
{ PW_KEY_MODULE_DESCRIPTION, "Native protocol (TCP sockets)" },
|
||||||
{ PW_KEY_MODULE_USAGE, "port=<TCP port number> "
|
{ PW_KEY_MODULE_USAGE, "port=<TCP port number> "
|
||||||
"listen=<address to listen on>" },
|
"listen=<address to listen on> "
|
||||||
|
"auth-anonymous=<don't check for cookies?>"},
|
||||||
{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
|
{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -83,7 +84,10 @@ struct module *create_module_native_protocol_tcp(struct impl *impl, const char *
|
||||||
struct module *module;
|
struct module *module;
|
||||||
struct module_native_protocol_tcp_data *d;
|
struct module_native_protocol_tcp_data *d;
|
||||||
struct pw_properties *props = NULL;
|
struct pw_properties *props = NULL;
|
||||||
const char *port, *listen;
|
const char *port, *listen, *auth;
|
||||||
|
FILE *f;
|
||||||
|
char *args;
|
||||||
|
size_t size;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
PW_LOG_TOPIC_INIT(mod_topic);
|
PW_LOG_TOPIC_INIT(mod_topic);
|
||||||
|
|
@ -101,8 +105,24 @@ struct module *create_module_native_protocol_tcp(struct impl *impl, const char *
|
||||||
|
|
||||||
listen = pw_properties_get(props, "listen");
|
listen = pw_properties_get(props, "listen");
|
||||||
|
|
||||||
pw_properties_setf(props, "pulse.tcp", "[ \"tcp:%s%s%s\" ]",
|
auth = pw_properties_get(props, "auth-anonymous");
|
||||||
|
|
||||||
|
f = open_memstream(&args, &size);
|
||||||
|
if (f == NULL) {
|
||||||
|
res = -errno;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(f, "[ { ");
|
||||||
|
fprintf(f, " \"address\": \"tcp:%s%s%s\" ",
|
||||||
listen ? listen : "", listen ? ":" : "", port);
|
listen ? listen : "", listen ? ":" : "", port);
|
||||||
|
if (auth && pw_properties_parse_bool(auth))
|
||||||
|
fprintf(f, " \"client.access\": \"unrestricted\" ");
|
||||||
|
fprintf(f, "} ]");
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
pw_properties_set(props, "pulse.tcp", args);
|
||||||
|
free(args);
|
||||||
|
|
||||||
module = module_new(impl, sizeof(*d));
|
module = module_new(impl, sizeof(*d));
|
||||||
if (module == NULL) {
|
if (module == NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue