Debian Codegraph @

src/xdp-session.c

raw symbols SCIP
1 /*
2 * Copyright © 2017 Red Hat, Inc
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "xdp-session.h"cxx . . $ `<file>/src/xdp-session.h`/
22 #include "xdp-request.h"cxx . . $ `<file>/src/xdp-request.h`/
23 #include "xdp-call.h"cxx . . $ `<file>/src/xdp-call.h`/
24
25 #include <string.h>
26
27 enumcxx . . $ $anonymous_type_e2690c1d1a1ab12e_0#
28 {
29 PROP_0cxx . . $ PROP_0.,
30
31 PROP_SENDERcxx . . $ PROP_SENDER.,
32 PROP_APP_IDcxx . . $ PROP_APP_ID.,
33 PROP_TOKENcxx . . $ PROP_TOKEN.,
34 PROP_CONNECTIONcxx . . $ PROP_CONNECTION.,
35 PROP_IMPL_CONNECTIONcxx . . $ PROP_IMPL_CONNECTION.,
36 PROP_IMPL_DBUS_NAMEcxx . . $ PROP_IMPL_DBUS_NAME.,
37
38 PROP_LASTcxx . . $ PROP_LAST.
39 };
40
41 static GParamSpeccxx . . $ GParamSpec# *obj_propscxx . . $ obj_props.[PROP_LASTcxx . . $ PROP_LAST.];
42
43 G_LOCK_DEFINEcxx . . $ `<external>/457917468643292165/gthread.h:113:9`! (sessions);
44 static GHashTablecxx . . $ GHashTable# *sessionscxx . . $ sessions.;
45
46 static void g_initable_iface_initcxx . . $ g_initable_iface_init(d44eb3c02fde4f8c). (GInitableIfacecxx . . $ GInitableIface# *iface);
47 static void xdp_session_skeleton_iface_initcxx . . $ xdp_session_skeleton_iface_init(858f9834dfa5697a). (XdpDbusSessionIfacecxx . . $ XdpDbusSessionIface# *iface);
48
49 G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (XdpSession, xdp_session, XDP_DBUS_TYPE_SESSION_SKELETONcxx . . $ `build/src/xdp-dbus.h:7745:9`!,
50 G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (G_TYPE_INITABLEcxx . . $ `<external>/8486287435340430869/ginitable.h:34:9`!,
51 g_initable_iface_init)
52 G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (XDP_DBUS_TYPE_SESSIONcxx . . $ `build/src/xdp-dbus.h:7598:9`!,
53 xdp_session_skeleton_iface_init))
54
55 #define XDP_SESSION_GET_CLASScxx . . $ `src/xdp-session.c:55:9`!(o) \
56 (G_TYPE_INSTANCE_GET_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:571:9`! ((o), xdp_session_get_type (), XdpSessionClass))
57
58 const char *
59 lookup_session_tokencxx . . $ lookup_session_token(d2704f6d4d26effc). (GVariantcxx . . $ GVariant# *options)
60 {
61 const char *token = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
62
63 g_variant_lookupcxx . . $ g_variant_lookup(7f27c6838ade8909). (options, "session_handle_token", "&s", &token);
64
65 return token;
66 }
67
68 XdpSessioncxx . . $ XdpSession# *
69 xdp_session_from_requestcxx . . $ xdp_session_from_request(b20d0b7552200bd). (const char *session_handle,
70 XdpRequestcxx . . $ XdpRequest# *request)
71 {
72 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpSession) session = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
73
74 G_LOCKcxx . . $ `<external>/457917468643292165/gthread.h:137:11`! (sessions);
75 session = g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (sessionscxx . . $ sessions., session_handle);
76 if (session)
77 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (session);
78 G_UNLOCKcxx . . $ `<external>/457917468643292165/gthread.h:138:11`! (sessions);
79
80 if (!session)
81 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
82
83 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (session->sendercxx . . $ _XdpSession#sender., request->sendercxx . . $ _XdpRequest#sender.) != 0)
84 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
85
86 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (session->app_idcxx . . $ _XdpSession#app_id., xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (request->app_infocxx . . $ _XdpRequest#app_info.)) != 0)
87 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
88
89 return g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&session);
90 }
91
92 XdpSessioncxx . . $ XdpSession# *
93 xdp_session_from_callcxx . . $ xdp_session_from_call(87af02f4dcb4a89b). (const char *session_handle,
94 XdpCallcxx . . $ XdpCall# *call)
95 {
96 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpSession) session = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
97
98 G_LOCKcxx . . $ `<external>/457917468643292165/gthread.h:137:11`! (sessions);
99 session = g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (sessionscxx . . $ sessions., session_handle);
100 if (session)
101 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (session);
102 G_UNLOCKcxx . . $ `<external>/457917468643292165/gthread.h:138:11`! (sessions);
103
104 if (!session)
105 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
106
107 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (session->sendercxx . . $ _XdpSession#sender., call->sendercxx . . $ _XdpCall#sender.) != 0)
108 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
109
110 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (session->app_idcxx . . $ _XdpSession#app_id., xdp_app_info_get_idcxx . . $ xdp_app_info_get_id(b9a768ac644c9329). (call->app_infocxx . . $ _XdpCall#app_info.)) != 0)
111 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
112
113 return g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&session);
114 }
115
116 XdpSessioncxx . . $ XdpSession# *
117 xdp_session_lookupcxx . . $ xdp_session_lookup(7cb6de4f3c42cd2). (const char *session_handle)
118 {
119 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpSession) session = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
120
121 G_LOCKcxx . . $ `<external>/457917468643292165/gthread.h:137:11`! (sessions);
122 session = g_hash_table_lookupcxx . . $ g_hash_table_lookup(8183d62c39a6a245). (sessionscxx . . $ sessions., session_handle);
123 if (session)
124 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (session);
125 G_UNLOCKcxx . . $ `<external>/457917468643292165/gthread.h:138:11`! (sessions);
126
127 return g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&session);
128 }
129
130 gbooleancxx . . $ gboolean#
131 xdp_session_exportcxx . . $ xdp_session_export(3c2cf3f1073dc4c7). (XdpSessioncxx . . $ XdpSession# *session,
132 GErrorcxx . . $ GError# **error)
133 {
134 if (!g_dbus_interface_skeleton_exportcxx . . $ g_dbus_interface_skeleton_export(b7cdb5e81947cba7). (G_DBUS_INTERFACE_SKELETONcxx . . $ `<external>/1991948168568871819/gdbusinterfaceskeleton.h:32:9`! (session),
135 session->connectioncxx . . $ _XdpSession#connection.,
136 session->idcxx . . $ _XdpSession#id.,
137 error))
138 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
139
140 g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (session);
141 session->exportedcxx . . $ _XdpSession#exported. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
142
143 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
144 }
145
146 static void
147 xdp_session_unexportcxx . . $ xdp_session_unexport(ac695378ab375fe8). (XdpSessioncxx . . $ XdpSession# *session)
148 {
149 session->exportedcxx . . $ _XdpSession#exported. = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
150 g_dbus_interface_skeleton_unexportcxx . . $ g_dbus_interface_skeleton_unexport(ea7137ee396aca18). (G_DBUS_INTERFACE_SKELETONcxx . . $ `<external>/1991948168568871819/gdbusinterfaceskeleton.h:32:9`! (session));
151 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (session);
152 }
153
154 void
155 xdp_session_registercxx . . $ xdp_session_register(ac695378ab375fe8). (XdpSessioncxx . . $ XdpSession# *session)
156 {
157 G_LOCKcxx . . $ `<external>/457917468643292165/gthread.h:137:11`! (sessions);
158 g_hash_table_insertcxx . . $ g_hash_table_insert(6a7c46015dd5ef26). (sessionscxx . . $ sessions., session->idcxx . . $ _XdpSession#id., session);
159 G_UNLOCKcxx . . $ `<external>/457917468643292165/gthread.h:138:11`! (sessions);
160 }
161
162 static void
163 xdp_session_unregistercxx . . $ xdp_session_unregister(ac695378ab375fe8). (XdpSessioncxx . . $ XdpSession# *session)
164 {
165 G_LOCKcxx . . $ `<external>/457917468643292165/gthread.h:137:11`! (sessions);
166 g_hash_table_removecxx . . $ g_hash_table_remove(453ebbf4abdbe50e). (sessionscxx . . $ sessions., session->idcxx . . $ _XdpSession#id.);
167 G_UNLOCKcxx . . $ `<external>/457917468643292165/gthread.h:138:11`! (sessions);
168 }
169
170 void
171 xdp_session_closecxx . . $ xdp_session_close(e4dd02f38fc14a2). (XdpSessioncxx . . $ XdpSession# *session,
172 gbooleancxx . . $ gboolean# notify_closed)
173 {
174 if (session->closedcxx . . $ _XdpSession#closed.)
175 return;
176
177 XDP_SESSION_GET_CLASScxx . . $ `src/xdp-session.c:55:9`! (session)->closecxx . . $ _XdpSessionClass#close. (session);
178
179 if (notify_closed)
180 {
181 g_autocxx . . $ `<external>/12741050725406041920/gmacros.h:1428:9`!(GVariantBuilder) details_builder =
182 G_VARIANT_BUILDER_INITcxx . . $ `<external>/10279604295420929244/gvariant.h:369:9`! (G_VARIANT_TYPE_VARDICTcxx . . $ `<external>/14064154155447831270/gvarianttype.h:279:9`!);
183
184 g_dbus_connection_emit_signalcxx . . $ g_dbus_connection_emit_signal(e1c7067f953d4fcb). (session->connectioncxx . . $ _XdpSession#connection.,
185 session->sendercxx . . $ _XdpSession#sender.,
186 session->idcxx . . $ _XdpSession#id.,
187 "org.freedesktop.portal.Session",
188 "Closed",
189 g_variant_newcxx . . $ g_variant_new(59b7d1999758b6d9). ("(@a{sv})", g_variant_builder_endcxx . . $ g_variant_builder_end(6d60952e65fc2b86). (&details_builder)),
190 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
191 }
192
193 if (session->exportedcxx . . $ _XdpSession#exported.)
194 xdp_session_unexportcxx . . $ xdp_session_unexport(ac695378ab375fe8). (session);
195
196 xdp_session_unregistercxx . . $ xdp_session_unregister(ac695378ab375fe8). (session);
197
198 if (session->impl_sessioncxx . . $ _XdpSession#impl_session.)
199 {
200 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GError) error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
201
202 if (!xdp_dbus_impl_session_call_close_synccxx . . $ xdp_dbus_impl_session_call_close_sync(9cfd885e04eb7c74). (session->impl_sessioncxx . . $ _XdpSession#impl_session.,
203 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, &error))
204 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:365:9`! ("Failed to close session implementation: %s",
205 error->message);
206
207 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&session->impl_session);
208 }
209
210 session->closedcxx . . $ _XdpSession#closed. = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
211
212
213 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (session);
214 }
215
216 static gbooleancxx . . $ gboolean#
217 handle_closecxx . . $ handle_close(e6a697152905a2fd). (XdpDbusSessioncxx . . $ XdpDbusSession# *object,
218 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation)
219 {
220 XdpSessioncxx . . $ XdpSession# *session = XDP_SESSIONcxx . . $ XDP_SESSION(a424cc90118498e6). (object);
221
222 SESSION_AUTOLOCK_UNREFcxx . . $ `src/xdp-session.h:115:9`! (g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (session));
223
224 xdp_session_closecxx . . $ xdp_session_close(e4dd02f38fc14a2). (session, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
225
226 xdp_dbus_session_complete_closecxx . . $ xdp_dbus_session_complete_close(e6e0b54d9738c9df). (object, invocation);
227
228 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
229 }
230
231 static void
232 xdp_session_skeleton_iface_initcxx . . $ xdp_session_skeleton_iface_init(858f9834dfa5697a). (XdpDbusSessionIfacecxx . . $ XdpDbusSessionIface# *iface)
233 {
234 iface->handle_closecxx . . $ _XdpDbusSessionIface#handle_close. = handle_closecxx . . $ handle_close(e6a697152905a2fd).;
235 }
236
237 static void
238 close_sessions_in_thread_funccxx . . $ close_sessions_in_thread_func(4704ff26353eb8ae). (GTaskcxx . . $ GTask# *task,
239 gpointercxx . . $ gpointer# source_object,
240 gpointercxx . . $ gpointer# task_data,
241 GCancellablecxx . . $ GCancellable# *cancellable)
242 {
243 const char *sender = (const char *)task_data;
244 GSListcxx . . $ GSList# *list = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
245 GSListcxx . . $ GSList# *l;
246 GHashTableItercxx . . $ GHashTableIter# iter;
247 XdpSessioncxx . . $ XdpSession# *session;
248
249 G_LOCKcxx . . $ `<external>/457917468643292165/gthread.h:137:11`! (sessions);
250 if (sessionscxx . . $ sessions.)
251 {
252 g_hash_table_iter_initcxx . . $ g_hash_table_iter_init(1fd6bbae530c3b4). (&iter, sessionscxx . . $ sessions.);
253 while (g_hash_table_iter_nextcxx . . $ g_hash_table_iter_next(1740d3f8cffea03c). (&iter, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, (gpointercxx . . $ gpointer# *)&session))
254 {
255 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (sender, session->sendercxx . . $ _XdpSession#sender.) == 0)
256 list = g_slist_prependcxx . . $ g_slist_prepend(6eb923d8c45a5456). (list, g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (session));
257 }
258 }
259 G_UNLOCKcxx . . $ `<external>/457917468643292165/gthread.h:138:11`! (sessions);
260
261 for (l = list; l; l = l->nextcxx . . $ _GSList#next.)
262 {
263 XdpSessioncxx . . $ XdpSession# *session = l->datacxx . . $ _GSList#data.;
264
265 SESSION_AUTOLOCKcxx . . $ `src/xdp-session.h:110:9`! (session);
266 xdp_session_closecxx . . $ xdp_session_close(e4dd02f38fc14a2). (session, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
267 }
268
269 g_slist_free_fullcxx . . $ g_slist_free_full(5c74ad7c36eb6b1f). (list, g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
270 g_task_return_booleancxx . . $ g_task_return_boolean(b34b01b5a2b59ad8). (task, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
271 }
272
273 void
274 close_sessions_for_sendercxx . . $ close_sessions_for_sender(85c52e162fed56f9). (const char *sender)
275 {
276 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(GTask) task = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
277
278 task = g_task_newcxx . . $ g_task_new(292d224db8478659). (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
279 g_task_set_task_datacxx . . $ g_task_set_task_data(2e97a86ccb74176a). (task, g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (sender), g_freecxx . . $ g_free(5d22bdacc48458e8).);
280 g_task_run_in_threadcxx . . $ g_task_run_in_thread(9210d4c97157796e). (task, close_sessions_in_thread_funccxx . . $ close_sessions_in_thread_func(4704ff26353eb8ae).);
281 }
282
283 static void
284 on_closedcxx . . $ on_closed(7cfd3ed488ed7d1c). (XdpDbusImplSessioncxx . . $ XdpDbusImplSession# *object, GObjectcxx . . $ GObject# *data)
285 {
286 XdpSessioncxx . . $ XdpSession# *session = XDP_SESSIONcxx . . $ XDP_SESSION(a424cc90118498e6). (data);
287
288 SESSION_AUTOLOCK_UNREFcxx . . $ `src/xdp-session.h:115:9`! (g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (session));
289
290 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&session->impl_session);
291 xdp_session_closecxx . . $ xdp_session_close(e4dd02f38fc14a2). (session, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!);
292 }
293
294 static gbooleancxx . . $ gboolean#
295 xdp_session_authorize_callbackcxx . . $ xdp_session_authorize_callback(a372c9f6c5124328). (GDBusInterfaceSkeletoncxx . . $ GDBusInterfaceSkeleton# *interface,
296 GDBusMethodInvocationcxx . . $ GDBusMethodInvocation# *invocation,
297 gpointercxx . . $ gpointer# user_data)
298 {
299 const gcharcxx . . $ gchar# *session_owner = user_data;
300 const gcharcxx . . $ gchar# *sender = g_dbus_method_invocation_get_sendercxx . . $ g_dbus_method_invocation_get_sender(fb2cbbb785aa0d4d). (invocation);
301
302 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88). (sender, session_owner) != 0)
303 {
304 g_dbus_method_invocation_return_errorcxx . . $ g_dbus_method_invocation_return_error(2860f9a06c72d77e). (invocation,
305 G_DBUS_ERRORcxx . . $ `<external>/517763016858796244/gdbuserror.h:49:9`!,
306 G_DBUS_ERROR_ACCESS_DENIEDcxx . . $ G_DBUS_ERROR_ACCESS_DENIED.,
307 "Portal operation not allowed, Unmatched caller");
308 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
309 }
310
311 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
312 }
313
314 static gbooleancxx . . $ gboolean#
315 is_valid_tokencxx . . $ is_valid_token(5c4306d8553b3696). (const char *token)
316 {
317 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
318 int i;
319
320 for (i = 0; token[i]; i++)
321 {
322 if (token[i] == '/')
323 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
324 }
325
326 path = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/foo/%s", token);
327
328 return g_variant_is_object_pathcxx . . $ g_variant_is_object_path(5c4306d8553b3696). (path);
329 }
330
331 static gbooleancxx . . $ gboolean#
332 xdp_session_initable_initcxx . . $ xdp_session_initable_init(4c297c0fcb9fff71). (GInitablecxx . . $ GInitable# *initable,
333 GCancellablecxx . . $ GCancellable# *cancellable,
334 GErrorcxx . . $ GError# **error)
335 {
336 XdpSessioncxx . . $ XdpSession# *session = XDP_SESSIONcxx . . $ XDP_SESSION(a424cc90118498e6). (initable);
337 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *sender_escaped = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
338 g_autofreecxx . . $ `<external>/12741050725406041920/gmacros.h:1429:9`! char *id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
339 g_autoptrcxx . . $ `<external>/12741050725406041920/gmacros.h:1424:9`!(XdpDbusImplSession) impl_session = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
340 int i;
341
342 sender_escaped = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (session->sender + 1);
343 for (i = 0; sender_escaped[i]; i++)
344 {
345 if (sender_escaped[i] == '.')
346 sender_escaped[i] = '_';
347 }
348
349 if (!session->tokencxx . . $ _XdpSession#token.)
350 {
351 g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error, G_IO_ERRORcxx . . $ `<external>/13894955190784973534/gioerror.h:42:9`!, G_IO_ERROR_FAILEDcxx . . $ G_IO_ERROR_FAILED., "Missing token");
352 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
353 }
354
355 if (!is_valid_tokencxx . . $ is_valid_token(5c4306d8553b3696). (session->tokencxx . . $ _XdpSession#token.))
356 {
357 g_set_errorcxx . . $ g_set_error(ca0c191bc68fc328). (error,
358 XDG_DESKTOP_PORTAL_ERRORcxx . . $ `src/xdp-utils.h:98:9`!,
359 XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENTcxx . . $ XDG_DESKTOP_PORTAL_ERROR_INVALID_ARGUMENT.,
360 "Invalid token '%s'", session->tokencxx . . $ _XdpSession#token.);
361 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
362 }
363
364 id = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("/org/freedesktop/portal/desktop/session/%s/%s",
365 sender_escaped, session->tokencxx . . $ _XdpSession#token.);
366
367 if (session->impl_dbus_namecxx . . $ _XdpSession#impl_dbus_name.)
368 {
369 impl_session =
370 xdp_dbus_impl_session_proxy_new_synccxx . . $ xdp_dbus_impl_session_proxy_new_sync(fe857ca025a7257d). (session->impl_connectioncxx . . $ _XdpSession#impl_connection.,
371 G_DBUS_PROXY_FLAGS_NONEcxx . . $ G_DBUS_PROXY_FLAGS_NONE.,
372 session->impl_dbus_namecxx . . $ _XdpSession#impl_dbus_name.,
373 id,
374 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, error);
375 if (!impl_session)
376 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
377
378 g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (impl_session, "closed", G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (on_closed), session);
379
380 session->impl_sessioncxx . . $ _XdpSession#impl_session. = g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&impl_session);
381 }
382
383 session->idcxx . . $ _XdpSession#id. = g_steal_pointercxx . . $ `<external>/1123956534522462559/gmem.h:250:9`! (&id);
384
385 g_dbus_interface_skeleton_set_flagscxx . . $ g_dbus_interface_skeleton_set_flags(9e6b05200e191a32). (G_DBUS_INTERFACE_SKELETONcxx . . $ `<external>/1991948168568871819/gdbusinterfaceskeleton.h:32:9`! (session),
386 G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREADcxx . . $ G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD.);
387 g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (session, "g-authorize-method",
388 G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (xdp_session_authorize_callback),
389 session->sender);
390
391 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
392 }
393
394 static void
395 g_initable_iface_initcxx . . $ g_initable_iface_init(d44eb3c02fde4f8c). (GInitableIfacecxx . . $ GInitableIface# *iface)
396 {
397 iface->initcxx . . $ _GInitableIface#init. = xdp_session_initable_initcxx . . $ xdp_session_initable_init(4c297c0fcb9fff71).;
398 }
399
400 static void
401 xdp_session_set_propertycxx . . $ xdp_session_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object,
402 guintcxx . . $ guint# prop_id,
403 const GValuecxx . . $ GValue# *value,
404 GParamSpeccxx . . $ GParamSpec# *pspec)
405 {
406 XdpSessioncxx . . $ XdpSession# *session = XDP_SESSIONcxx . . $ XDP_SESSION(a424cc90118498e6). (object);
407
408 switch (prop_id)
409 {
410 case PROP_SENDERcxx . . $ PROP_SENDER.:
411 session->sendercxx . . $ _XdpSession#sender. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (g_value_get_string (value));
412 break;
413
414 case PROP_APP_IDcxx . . $ PROP_APP_ID.:
415 session->app_idcxx . . $ _XdpSession#app_id. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (g_value_get_string (value));
416 break;
417
418 case PROP_TOKENcxx . . $ PROP_TOKEN.:
419 session->tokencxx . . $ _XdpSession#token. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (g_value_get_string (value));
420 break;
421
422 case PROP_CONNECTIONcxx . . $ PROP_CONNECTION.:
423 g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&session->connection, g_value_get_object (value));
424 break;
425
426 case PROP_IMPL_CONNECTIONcxx . . $ PROP_IMPL_CONNECTION.:
427 g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&session->impl_connection, g_value_get_object (value));
428 break;
429
430 case PROP_IMPL_DBUS_NAMEcxx . . $ PROP_IMPL_DBUS_NAME.:
431 session->impl_dbus_namecxx . . $ _XdpSession#impl_dbus_name. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (g_value_get_string (value));
432 break;
433
434 default:
435 G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec);
436 }
437 }
438
439 static void
440 xdp_session_get_propertycxx . . $ xdp_session_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object,
441 guintcxx . . $ guint# prop_id,
442 GValuecxx . . $ GValue# *value,
443 GParamSpeccxx . . $ GParamSpec# *pspec)
444 {
445 XdpSessioncxx . . $ XdpSession# *session = XDP_SESSIONcxx . . $ XDP_SESSION(a424cc90118498e6). (object);
446
447 switch (prop_id)
448 {
449 case PROP_SENDERcxx . . $ PROP_SENDER.:
450 g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, session->sendercxx . . $ _XdpSession#sender.);
451 break;
452
453 case PROP_APP_IDcxx . . $ PROP_APP_ID.:
454 g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, session->app_idcxx . . $ _XdpSession#app_id.);
455 break;
456
457 case PROP_TOKENcxx . . $ PROP_TOKEN.:
458 g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, session->tokencxx . . $ _XdpSession#token.);
459 break;
460
461 case PROP_CONNECTIONcxx . . $ PROP_CONNECTION.:
462 g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, session->connectioncxx . . $ _XdpSession#connection.);
463 break;
464
465 case PROP_IMPL_CONNECTIONcxx . . $ PROP_IMPL_CONNECTION.:
466 g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, session->impl_connectioncxx . . $ _XdpSession#impl_connection.);
467 break;
468
469 case PROP_IMPL_DBUS_NAMEcxx . . $ PROP_IMPL_DBUS_NAME.:
470 g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, session->impl_dbus_namecxx . . $ _XdpSession#impl_dbus_name.);
471 break;
472
473 default:
474 G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec);
475 }
476 }
477
478 static void
479 xdp_session_finalizecxx . . $ xdp_session_finalize(6087475fa43034d3). (GObjectcxx . . $ GObject# *object)
480 {
481 XdpSessioncxx . . $ XdpSession# *session = XDP_SESSIONcxx . . $ XDP_SESSION(a424cc90118498e6). (object);
482
483 g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (!session->id || !g_hash_table_lookup (sessions, session->id));
484
485 g_freecxx . . $ g_free(5d22bdacc48458e8). (session->sendercxx . . $ _XdpSession#sender.);
486 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&session->connection);
487
488 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&session->impl_connection);
489 g_freecxx . . $ g_free(5d22bdacc48458e8). (session->impl_dbus_namecxx . . $ _XdpSession#impl_dbus_name.);
490 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&session->impl_session);
491
492 g_freecxx . . $ g_free(5d22bdacc48458e8). (session->app_idcxx . . $ _XdpSession#app_id.);
493 g_freecxx . . $ g_free(5d22bdacc48458e8). (session->idcxx . . $ _XdpSession#id.);
494 g_freecxx . . $ g_free(5d22bdacc48458e8). (session->tokencxx . . $ _XdpSession#token.);
495
496 g_mutex_clearcxx . . $ g_mutex_clear(d80b1953a7cb7fd1). (&session->mutexcxx . . $ _XdpSession#mutex.);
497
498 G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (xdp_session_parent_class)->finalizecxx . . $ _GObjectClass#finalize. (object);
499 }
500
501 static void
502 xdp_session_initcxx . . $ xdp_session_init(ac695378ab375fe8). (XdpSessioncxx . . $ XdpSession# *session)
503 {
504 g_mutex_initcxx . . $ g_mutex_init(d80b1953a7cb7fd1). (&session->mutexcxx . . $ _XdpSession#mutex.);
505 }
506
507 static void
508 xdp_session_class_initcxx . . $ xdp_session_class_init(14fc59113f743ea3). (XdpSessionClasscxx . . $ XdpSessionClass# *klass)
509 {
510 GObjectClasscxx . . $ GObjectClass# *gobject_class;
511
512 sessionscxx . . $ sessions. = g_hash_table_new_fullcxx . . $ g_hash_table_new_full(e2dd12b570de7430). (g_str_hashcxx . . $ g_str_hash(b11f534102b1ad6)., g_str_equalcxx . . $ g_str_equal(9148c8c3ff42c9d8).,
513 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
514
515 gobject_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass);
516 gobject_class->finalizecxx . . $ _GObjectClass#finalize. = xdp_session_finalizecxx . . $ xdp_session_finalize(6087475fa43034d3).;
517 gobject_class->set_propertycxx . . $ _GObjectClass#set_property. = xdp_session_set_propertycxx . . $ xdp_session_set_property(d7c4bb29f36c0dc4).;
518 gobject_class->get_propertycxx . . $ _GObjectClass#get_property. = xdp_session_get_propertycxx . . $ xdp_session_get_property(cee2c52f22407c66).;
519
520 obj_propscxx . . $ obj_props.[PROP_SENDERcxx . . $ PROP_SENDER.] =
521 g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("sender", "Sender", "Sender",
522 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
523 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
524 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY. |
525 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
526
527 obj_propscxx . . $ obj_props.[PROP_APP_IDcxx . . $ PROP_APP_ID.] =
528 g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("app-id", "app-id", "App ID",
529 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
530 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
531 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY. |
532 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
533
534 obj_propscxx . . $ obj_props.[PROP_TOKENcxx . . $ PROP_TOKEN.] =
535 g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("token", "token", "Token",
536 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
537 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
538 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY. |
539 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
540
541 obj_propscxx . . $ obj_props.[PROP_CONNECTIONcxx . . $ PROP_CONNECTION.] =
542 g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("connection", "connection",
543 "DBus connection",
544 G_TYPE_DBUS_CONNECTIONcxx . . $ `<external>/12412075152584512215/gdbusconnection.h:34:9`!,
545 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
546 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY. |
547 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
548
549 obj_propscxx . . $ obj_props.[PROP_IMPL_CONNECTIONcxx . . $ PROP_IMPL_CONNECTION.] =
550 g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("impl-connection", "impl-connection",
551 "impl DBus connection",
552 G_TYPE_DBUS_CONNECTIONcxx . . $ `<external>/12412075152584512215/gdbusconnection.h:34:9`!,
553 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
554 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY. |
555 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
556
557 obj_propscxx . . $ obj_props.[PROP_IMPL_DBUS_NAMEcxx . . $ PROP_IMPL_DBUS_NAME.] =
558 g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("impl-dbus-name", "impl-dbus-name",
559 "impl DBus name",
560 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
561 G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. |
562 G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY. |
563 G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
564
565 g_object_class_install_propertiescxx . . $ g_object_class_install_properties(569d03e6a4088541). (gobject_class, PROP_LASTcxx . . $ PROP_LAST., obj_propscxx . . $ obj_props.);
566 }