pulse: sanitize the remote name

We use the remote name as a suffix for the default server address and so
it should not contain any slashes. Take everything after the last slash
if there is one.
This commit is contained in:
Wim Taymans 2025-01-29 12:09:36 +01:00
parent 70ca546c6a
commit 546de65c67

View file

@ -148,12 +148,14 @@ pid_t get_client_pid(struct client *client, int client_fd)
const char *get_server_name(struct pw_context *context)
{
const char *name = NULL;
const char *name = NULL, *sep;
const struct pw_properties *props = pw_context_get_properties(context);
name = getenv("PIPEWIRE_REMOTE");
if ((name == NULL || name[0] == '\0') && props != NULL)
name = pw_properties_get(props, PW_KEY_REMOTE_NAME);
if (name != NULL && (sep = strrchr(name, '/')) != NULL)
name = sep+1;
if (name == NULL || name[0] == '\0')
name = PW_DEFAULT_REMOTE;
return name;