Skip to content
Snippets Groups Projects
Commit 359cceda authored by Jakub Janků's avatar Jakub Janků Committed by Victor Toso
Browse files

udscs: add udscs_get_peer_pid()


udscs_get_peer_cred() is currently used only in
vdagentd.c to obtain PID, so let's drop udscs_get_peer_cred()
and add udscs_get_peer_pid() instead.

Acked-by: default avatarVictor Toso <victortoso@redhat.com>
parent 0a05a7cf
No related branches found
No related tags found
No related merge requests found
Pipeline #3613 passed
......@@ -490,9 +490,9 @@ void udscs_destroy_server(struct udscs_server *server)
free(server);
}
struct ucred udscs_get_peer_cred(struct udscs_connection *conn)
int udscs_get_peer_pid(struct udscs_connection *conn)
{
return conn->peer_cred;
return (int)conn->peer_cred.pid;
}
static void udscs_server_accept(struct udscs_server *server) {
......@@ -541,7 +541,7 @@ static void udscs_server_accept(struct udscs_server *server) {
if (server->debug)
syslog(LOG_DEBUG, "new client accepted: %p, pid: %d",
new_conn, (int)new_conn->peer_cred.pid);
new_conn, udscs_get_peer_pid(new_conn));
if (server->connect_callback)
server->connect_callback(new_conn);
......
......@@ -171,8 +171,8 @@ int udscs_server_fill_fds(struct udscs_server *server, fd_set *readfds,
void udscs_server_handle_fds(struct udscs_server *server, fd_set *readfds,
fd_set *writefds);
/* Returns the peer's user credentials. */
struct ucred udscs_get_peer_cred(struct udscs_connection *conn);
/* Returns the peer's PID. */
int udscs_get_peer_pid(struct udscs_connection *conn);
#endif
......
......@@ -852,7 +852,7 @@ static void agent_connect(struct udscs_connection *conn)
}
if (session_info) {
uint32_t pid = udscs_get_peer_cred(conn).pid;
uint32_t pid = udscs_get_peer_pid(conn);
agent_data->session = session_info_session_for_pid(session_info, pid);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment