From 6f0fb6644fbb9fe2c05f1719e619ce4d0073728d Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sun, 21 Apr 2024 15:30:07 +0530 Subject: npassd/session: free session when owner service disconnects from the bus --- include/npassd/session.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/npassd') diff --git a/include/npassd/session.h b/include/npassd/session.h index 6763c6a..a3aa705 100644 --- a/include/npassd/session.h +++ b/include/npassd/session.h @@ -4,11 +4,13 @@ #include "npassd/common.h" #define SESSION_IFACE "org.freedesktop.Secret.Session" +#define MAX_OWNER_LEN 64 /* reusable slots */ struct session { bool isactive; sd_bus_slot *slot; + char owner[MAX_OWNER_LEN]; /* +32 for snprintf("/session/%d") */ char path[sizeof(DBUS_OBJECT_PATH) + 32]; }; @@ -16,4 +18,5 @@ struct session { void session_init(struct session *s, size_t n); int session_slot_available(struct session *s, size_t n); int session_free(struct session *s); -int session_new(sd_bus *bus, struct session *s, unsigned slot_no); +int session_new(sd_bus *bus, struct session *session, unsigned session_no, + const char *owner); -- cgit v1.2.3