Skip to content

Commit

Permalink
MONITOR: Set destructor for the right connection
Browse files Browse the repository at this point in the history
When the monitor receives a `sssd.monitor.RegisterService` D-Bus method,
it is received on the listening connection and not on the client's
connection. Because of this, the destructor is set for to the listening
connection (taken from the sbus_request) and instead of the client
connection.

The client connection can be retrieved searching it by the sender's
name in the `sbus_server` accessible from the `mt_ctx`, to set the
destructor to the correct connection in the function
`monitor_sbus_RegisterService()`.

Resolves: SSSD#6897

Reviewed-by: Alexey Tikhonov <[email protected]>
Reviewed-by: Pavel Březina <[email protected]>
  • Loading branch information
aplopez authored and alexey-tikhonov committed Oct 9, 2024
1 parent 1c91ea0 commit e0ec488
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/monitor/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ monitor_sbus_RegisterService(TALLOC_CTX *mem_ctx,
}

/* Fill in svc structure with connection data */
svc->conn = sbus_req->conn;
svc->conn = sbus_server_find_connection(mt_ctx->sbus_server, svc->busname);
if (svc->conn == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE,
"Bug: No connection found for '%s'\n", svc->busname);
return ERR_SBUS_KILL_CONNECTION;
}

/* For {dbus,socket}-activated services we will have to unregister then
* when the sbus_connection is freed. That's the reason we have to
Expand Down

0 comments on commit e0ec488

Please sign in to comment.