1
Fork 0

pipewire: add PW_KEY_SEC_SOCKET and set it in protocol

Add client key PW_KEY_SEC_SOCKET that indicates which socket the client used
to connect to the server.

This can be used by other modules as an access control mechanism.
This commit is contained in:
Pauli Virtanen 2023-10-07 12:37:10 +03:00
parent 72462ebd07
commit bb120a070f
3 changed files with 5 additions and 0 deletions

View File

@ -578,6 +578,8 @@ static struct client_data *client_new(struct server *s, int fd)
if (props == NULL)
goto exit;
pw_properties_set(props, PW_KEY_SEC_SOCKET, s->socket_info.name);
#if defined(__linux__)
len = sizeof(ucred);
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) {

View File

@ -524,6 +524,7 @@ int pw_impl_client_register(struct pw_impl_client *client,
PW_KEY_SEC_UID,
PW_KEY_SEC_GID,
PW_KEY_SEC_LABEL,
PW_KEY_SEC_SOCKET,
NULL
};

View File

@ -38,6 +38,8 @@ extern "C" {
#define PW_KEY_SEC_GID "pipewire.sec.gid" /**< client gid, set by protocol*/
#define PW_KEY_SEC_LABEL "pipewire.sec.label" /**< client security label, set by protocol*/
#define PW_KEY_SEC_SOCKET "pipewire.sec.socket" /**< client socket name, set by protocol */
#define PW_KEY_LIBRARY_NAME_SYSTEM "library.name.system" /**< name of the system library to use */
#define PW_KEY_LIBRARY_NAME_LOOP "library.name.loop" /**< name of the loop library to use */
#define PW_KEY_LIBRARY_NAME_DBUS "library.name.dbus" /**< name of the dbus library to use */