1 /* dbus-client.c generated by valac 0.10.4, the Vala compiler
2 * generated from dbus-client.vala, do not modify */
6 #include <glib-object.h>
9 #include <dbus/dbus-glib-lowlevel.h>
10 #include <dbus/dbus-glib.h>
11 #include <dbus/dbus.h>
15 #define TYPE_MOONSHOT (moonshot_get_type ())
16 #define MOONSHOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MOONSHOT, Moonshot))
17 #define IS_MOONSHOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MOONSHOT))
18 #define MOONSHOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MOONSHOT, MoonshotIface))
20 typedef struct _Moonshot Moonshot;
21 typedef struct _MoonshotIface MoonshotIface;
22 typedef struct _DBusObjectVTable _DBusObjectVTable;
23 #define _g_free0(var) (var = (g_free (var), NULL))
24 typedef struct _MoonshotDBusProxy MoonshotDBusProxy;
25 typedef DBusGProxyClass MoonshotDBusProxyClass;
26 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
27 #define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL)))
28 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
30 struct _MoonshotIface {
31 GTypeInterface parent_iface;
32 gboolean (*get_identity) (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error);
33 gboolean (*get_default_identity) (Moonshot* self, char** nai_out, char** password_out, GError** error);
36 struct _DBusObjectVTable {
37 void (*register_object) (DBusConnection*, const char*, void*);
40 struct _MoonshotDBusProxy {
41 DBusGProxy parent_instance;
47 Moonshot* moonshot_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
48 GType moonshot_get_type (void) G_GNUC_CONST;
49 gboolean moonshot_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error);
50 gboolean moonshot_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error);
51 static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object);
52 static void _vala_dbus_unregister_object (gpointer connection, GObject* object);
53 void moonshot_dbus_register_object (DBusConnection* connection, const char* path, void* object);
54 void _moonshot_dbus_unregister (DBusConnection* connection, void* _user_data_);
55 DBusHandlerResult moonshot_dbus_message (DBusConnection* connection, DBusMessage* message, void* object);
56 static DBusHandlerResult _dbus_moonshot_introspect (Moonshot* self, DBusConnection* connection, DBusMessage* message);
57 static DBusHandlerResult _dbus_moonshot_property_get_all (Moonshot* self, DBusConnection* connection, DBusMessage* message);
58 static DBusHandlerResult _dbus_moonshot_get_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message);
59 static DBusHandlerResult _dbus_moonshot_get_default_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message);
60 GType moonshot_dbus_proxy_get_type (void) G_GNUC_CONST;
61 DBusHandlerResult moonshot_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data);
63 MOONSHOT_DBUS_PROXY_DUMMY_PROPERTY
65 static gboolean moonshot_dbus_proxy_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error);
66 static gboolean moonshot_dbus_proxy_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error);
67 static void moonshot_dbus_proxy_moonshot__interface_init (MoonshotIface* iface);
68 static void moonshot_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
69 static void moonshot_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
70 void _vala_main (void);
72 static const DBusObjectPathVTable _moonshot_dbus_path_vtable = {_moonshot_dbus_unregister, moonshot_dbus_message};
73 static const _DBusObjectVTable _moonshot_dbus_vtable = {moonshot_dbus_register_object};
76 gboolean moonshot_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error) {
77 return MOONSHOT_GET_INTERFACE (self)->get_identity (self, nai, password, service, nai_out, password_out, server_certificate_hash, ca_certificate, subject_name_constraint, subject_alt_name_constraint, error);
81 gboolean moonshot_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error) {
82 return MOONSHOT_GET_INTERFACE (self)->get_default_identity (self, nai_out, password_out, error);
86 static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
87 const _DBusObjectVTable * vtable;
88 vtable = g_type_get_qdata (G_TYPE_FROM_INSTANCE (object), g_quark_from_static_string ("DBusObjectVTable"));
90 vtable->register_object (connection, path, object);
92 g_warning ("Object does not implement any D-Bus interface");
97 static void _vala_dbus_unregister_object (gpointer connection, GObject* object) {
99 path = g_object_steal_data ((GObject*) object, "dbus_object_path");
100 dbus_connection_unregister_object_path (connection, path);
105 void _moonshot_dbus_unregister (DBusConnection* connection, void* _user_data_) {
109 static DBusHandlerResult _dbus_moonshot_introspect (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
111 DBusMessageIter iter;
115 reply = dbus_message_new_method_return (message);
116 dbus_message_iter_init_append (reply, &iter);
117 xml_data = g_string_new ("<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n");
118 g_string_append (xml_data, "<node>\n<interface name=\"org.freedesktop.DBus.Introspectable\">\n <method name=\"Introspect\">\n <arg name=\"data\" direction=\"out\" type=\"s\"/>\n </method>\n</interface>\n<interface name=\"org.freedesktop.DBus.Properties\">\n <method name=\"Get\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"out\" type=\"v\"/>\n </method>\n <method name=\"Set\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n <arg name=\"value\" direction=\"in\" type=\"v\"/>\n </method>\n <method name=\"GetAll\">\n <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n </method>\n</interface>\n<interface name=\"org.janet.Moonshot\">\n <method name=\"GetIdentity\">\n <arg name=\"nai\" type=\"s\" direction=\"in\"/>\n <arg name=\"password\" type=\"s\" direction=\"in\"/>\n <arg name=\"service\" type=\"s\" direction=\"in\"/>\n <arg name=\"nai_out\" type=\"s\" direction=\"out\"/>\n <arg name=\"password_out\" type=\"s\" direction=\"out\"/>\n <arg name=\"server_certificate_hash\" type=\"s\" direction=\"out\"/>\n <arg name=\"ca_certificate\" type=\"s\" direction=\"out\"/>\n <arg name=\"subject_name_constraint\" type=\"s\" direction=\"out\"/>\n <arg name=\"subject_alt_name_constraint\" type=\"s\" direction=\"out\"/>\n <arg name=\"result\" type=\"b\" direction=\"out\"/>\n </method>\n <method name=\"GetDefaultIdentity\">\n <arg name=\"nai_out\" type=\"s\" direction=\"out\"/>\n <arg name=\"password_out\" type=\"s\" direction=\"out\"/>\n <arg name=\"result\" type=\"b\" direction=\"out\"/>\n </method>\n</interface>\n");
119 dbus_connection_list_registered (connection, g_object_get_data ((GObject *) self, "dbus_object_path"), &children);
120 for (i = 0; children[i]; i++) {
121 g_string_append_printf (xml_data, "<node name=\"%s\"/>\n", children[i]);
123 dbus_free_string_array (children);
124 g_string_append (xml_data, "</node>\n");
125 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &xml_data->str);
126 g_string_free (xml_data, TRUE);
128 dbus_connection_send (connection, reply, NULL);
129 dbus_message_unref (reply);
130 return DBUS_HANDLER_RESULT_HANDLED;
132 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
137 static DBusHandlerResult _dbus_moonshot_property_get_all (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
139 DBusMessageIter iter, reply_iter, subiter;
140 char* interface_name;
142 if (strcmp (dbus_message_get_signature (message), "s")) {
143 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
145 dbus_message_iter_init (message, &iter);
146 reply = dbus_message_new_method_return (message);
147 dbus_message_iter_init_append (reply, &reply_iter);
148 dbus_message_iter_get_basic (&iter, &_tmp0_);
149 dbus_message_iter_next (&iter);
150 interface_name = g_strdup (_tmp0_);
151 if (strcmp (interface_name, "org.janet.Moonshot") == 0) {
152 dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_ARRAY, "{sv}", &subiter);
153 dbus_message_iter_close_container (&reply_iter, &subiter);
155 dbus_message_unref (reply);
158 g_free (interface_name);
160 dbus_connection_send (connection, reply, NULL);
161 dbus_message_unref (reply);
162 return DBUS_HANDLER_RESULT_HANDLED;
164 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
169 static DBusHandlerResult _dbus_moonshot_get_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
170 DBusMessageIter iter;
174 char* password = NULL;
176 char* service = NULL;
178 char* nai_out = NULL;
179 char* password_out = NULL;
180 char* server_certificate_hash = NULL;
181 char* ca_certificate = NULL;
182 char* subject_name_constraint = NULL;
183 char* subject_alt_name_constraint = NULL;
194 if (strcmp (dbus_message_get_signature (message), "sss")) {
195 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
197 dbus_message_iter_init (message, &iter);
198 dbus_message_iter_get_basic (&iter, &_tmp1_);
199 dbus_message_iter_next (&iter);
200 nai = g_strdup (_tmp1_);
201 dbus_message_iter_get_basic (&iter, &_tmp2_);
202 dbus_message_iter_next (&iter);
203 password = g_strdup (_tmp2_);
204 dbus_message_iter_get_basic (&iter, &_tmp3_);
205 dbus_message_iter_next (&iter);
206 service = g_strdup (_tmp3_);
207 result = moonshot_get_identity (self, nai, password, service, &nai_out, &password_out, &server_certificate_hash, &ca_certificate, &subject_name_constraint, &subject_alt_name_constraint, &error);
209 if (error->domain == DBUS_GERROR) {
210 switch (error->code) {
211 case DBUS_GERROR_FAILED:
212 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
214 case DBUS_GERROR_NO_MEMORY:
215 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
217 case DBUS_GERROR_SERVICE_UNKNOWN:
218 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
220 case DBUS_GERROR_NAME_HAS_NO_OWNER:
221 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
223 case DBUS_GERROR_NO_REPLY:
224 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
226 case DBUS_GERROR_IO_ERROR:
227 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
229 case DBUS_GERROR_BAD_ADDRESS:
230 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
232 case DBUS_GERROR_NOT_SUPPORTED:
233 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
235 case DBUS_GERROR_LIMITS_EXCEEDED:
236 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
238 case DBUS_GERROR_ACCESS_DENIED:
239 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
241 case DBUS_GERROR_AUTH_FAILED:
242 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
244 case DBUS_GERROR_NO_SERVER:
245 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
247 case DBUS_GERROR_TIMEOUT:
248 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
250 case DBUS_GERROR_NO_NETWORK:
251 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
253 case DBUS_GERROR_ADDRESS_IN_USE:
254 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
256 case DBUS_GERROR_DISCONNECTED:
257 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
259 case DBUS_GERROR_INVALID_ARGS:
260 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
262 case DBUS_GERROR_FILE_NOT_FOUND:
263 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
265 case DBUS_GERROR_FILE_EXISTS:
266 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
268 case DBUS_GERROR_UNKNOWN_METHOD:
269 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
271 case DBUS_GERROR_TIMED_OUT:
272 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
274 case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
275 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
277 case DBUS_GERROR_MATCH_RULE_INVALID:
278 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
280 case DBUS_GERROR_SPAWN_EXEC_FAILED:
281 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
283 case DBUS_GERROR_SPAWN_FORK_FAILED:
284 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
286 case DBUS_GERROR_SPAWN_CHILD_EXITED:
287 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
289 case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
290 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
292 case DBUS_GERROR_SPAWN_FAILED:
293 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
295 case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
296 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
298 case DBUS_GERROR_INVALID_SIGNATURE:
299 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
301 case DBUS_GERROR_INVALID_FILE_CONTENT:
302 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
304 case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
305 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
307 case DBUS_GERROR_REMOTE_EXCEPTION:
308 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
312 dbus_connection_send (connection, reply, NULL);
313 dbus_message_unref (reply);
314 return DBUS_HANDLER_RESULT_HANDLED;
316 reply = dbus_message_new_method_return (message);
317 dbus_message_iter_init_append (reply, &iter);
322 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp4_);
324 _tmp5_ = password_out;
325 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp5_);
326 _g_free0 (password_out);
327 _tmp6_ = server_certificate_hash;
328 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp6_);
329 _g_free0 (server_certificate_hash);
330 _tmp7_ = ca_certificate;
331 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp7_);
332 _g_free0 (ca_certificate);
333 _tmp8_ = subject_name_constraint;
334 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp8_);
335 _g_free0 (subject_name_constraint);
336 _tmp9_ = subject_alt_name_constraint;
337 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp9_);
338 _g_free0 (subject_alt_name_constraint);
340 dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &_tmp10_);
342 dbus_connection_send (connection, reply, NULL);
343 dbus_message_unref (reply);
344 return DBUS_HANDLER_RESULT_HANDLED;
346 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
351 static DBusHandlerResult _dbus_moonshot_get_default_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
352 DBusMessageIter iter;
354 char* nai_out = NULL;
355 char* password_out = NULL;
362 if (strcmp (dbus_message_get_signature (message), "")) {
363 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
365 dbus_message_iter_init (message, &iter);
366 result = moonshot_get_default_identity (self, &nai_out, &password_out, &error);
368 if (error->domain == DBUS_GERROR) {
369 switch (error->code) {
370 case DBUS_GERROR_FAILED:
371 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
373 case DBUS_GERROR_NO_MEMORY:
374 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
376 case DBUS_GERROR_SERVICE_UNKNOWN:
377 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
379 case DBUS_GERROR_NAME_HAS_NO_OWNER:
380 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
382 case DBUS_GERROR_NO_REPLY:
383 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
385 case DBUS_GERROR_IO_ERROR:
386 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
388 case DBUS_GERROR_BAD_ADDRESS:
389 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
391 case DBUS_GERROR_NOT_SUPPORTED:
392 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
394 case DBUS_GERROR_LIMITS_EXCEEDED:
395 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
397 case DBUS_GERROR_ACCESS_DENIED:
398 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
400 case DBUS_GERROR_AUTH_FAILED:
401 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
403 case DBUS_GERROR_NO_SERVER:
404 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
406 case DBUS_GERROR_TIMEOUT:
407 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
409 case DBUS_GERROR_NO_NETWORK:
410 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
412 case DBUS_GERROR_ADDRESS_IN_USE:
413 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
415 case DBUS_GERROR_DISCONNECTED:
416 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
418 case DBUS_GERROR_INVALID_ARGS:
419 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
421 case DBUS_GERROR_FILE_NOT_FOUND:
422 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
424 case DBUS_GERROR_FILE_EXISTS:
425 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
427 case DBUS_GERROR_UNKNOWN_METHOD:
428 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
430 case DBUS_GERROR_TIMED_OUT:
431 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
433 case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
434 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
436 case DBUS_GERROR_MATCH_RULE_INVALID:
437 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
439 case DBUS_GERROR_SPAWN_EXEC_FAILED:
440 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
442 case DBUS_GERROR_SPAWN_FORK_FAILED:
443 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
445 case DBUS_GERROR_SPAWN_CHILD_EXITED:
446 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
448 case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
449 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
451 case DBUS_GERROR_SPAWN_FAILED:
452 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
454 case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
455 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
457 case DBUS_GERROR_INVALID_SIGNATURE:
458 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
460 case DBUS_GERROR_INVALID_FILE_CONTENT:
461 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
463 case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
464 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
466 case DBUS_GERROR_REMOTE_EXCEPTION:
467 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
471 dbus_connection_send (connection, reply, NULL);
472 dbus_message_unref (reply);
473 return DBUS_HANDLER_RESULT_HANDLED;
475 reply = dbus_message_new_method_return (message);
476 dbus_message_iter_init_append (reply, &iter);
478 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp11_);
480 _tmp12_ = password_out;
481 dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp12_);
482 _g_free0 (password_out);
484 dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &_tmp13_);
486 dbus_connection_send (connection, reply, NULL);
487 dbus_message_unref (reply);
488 return DBUS_HANDLER_RESULT_HANDLED;
490 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
495 DBusHandlerResult moonshot_dbus_message (DBusConnection* connection, DBusMessage* message, void* object) {
496 DBusHandlerResult result;
497 result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
498 if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
499 result = _dbus_moonshot_introspect (object, connection, message);
500 } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "GetAll")) {
501 result = _dbus_moonshot_property_get_all (object, connection, message);
502 } else if (dbus_message_is_method_call (message, "org.janet.Moonshot", "GetIdentity")) {
503 result = _dbus_moonshot_get_identity (object, connection, message);
504 } else if (dbus_message_is_method_call (message, "org.janet.Moonshot", "GetDefaultIdentity")) {
505 result = _dbus_moonshot_get_default_identity (object, connection, message);
507 if (result == DBUS_HANDLER_RESULT_HANDLED) {
510 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
515 void moonshot_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
516 if (!g_object_get_data (object, "dbus_object_path")) {
517 g_object_set_data (object, "dbus_object_path", g_strdup (path));
518 dbus_connection_register_object_path (connection, path, &_moonshot_dbus_path_vtable, object);
519 g_object_weak_ref (object, _vala_dbus_unregister_object, connection);
524 static void moonshot_base_init (MoonshotIface * iface) {
525 static gboolean initialized = FALSE;
528 g_type_set_qdata (TYPE_MOONSHOT, g_quark_from_static_string ("DBusObjectVTable"), (void*) (&_moonshot_dbus_vtable));
533 GType moonshot_get_type (void) {
534 static volatile gsize moonshot_type_id__volatile = 0;
535 if (g_once_init_enter (&moonshot_type_id__volatile)) {
536 static const GTypeInfo g_define_type_info = { sizeof (MoonshotIface), (GBaseInitFunc) moonshot_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
537 GType moonshot_type_id;
538 moonshot_type_id = g_type_register_static (G_TYPE_INTERFACE, "Moonshot", &g_define_type_info, 0);
539 g_type_interface_add_prerequisite (moonshot_type_id, G_TYPE_OBJECT);
540 g_type_set_qdata (moonshot_type_id, g_quark_from_string ("ValaDBusInterfaceProxyType"), &moonshot_dbus_proxy_get_type);
541 g_once_init_leave (&moonshot_type_id__volatile, moonshot_type_id);
543 return moonshot_type_id__volatile;
547 G_DEFINE_TYPE_EXTENDED (MoonshotDBusProxy, moonshot_dbus_proxy, DBUS_TYPE_G_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MOONSHOT, moonshot_dbus_proxy_moonshot__interface_init) );
548 Moonshot* moonshot_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path) {
550 self = g_object_new (moonshot_dbus_proxy_get_type (), "connection", connection, "name", name, "path", path, "interface", "org.janet.Moonshot", NULL);
555 static GObject* moonshot_dbus_proxy_construct (GType gtype, guint n_properties, GObjectConstructParam* properties) {
557 DBusGConnection *connection;
560 self = G_OBJECT_CLASS (moonshot_dbus_proxy_parent_class)->constructor (gtype, n_properties, properties);
561 g_object_get (self, "connection", &connection, NULL);
562 g_object_get (self, "path", &path, NULL);
563 dbus_connection_add_filter (dbus_g_connection_get_connection (connection), moonshot_dbus_proxy_filter, self, NULL);
564 filter = g_strdup_printf ("type='signal',path='%s',interface='org.janet.Moonshot'", path);
565 dbus_bus_add_match (dbus_g_connection_get_connection (connection), filter, NULL);
566 dbus_g_connection_unref (connection);
573 DBusHandlerResult moonshot_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data) {
574 if (dbus_message_has_path (message, dbus_g_proxy_get_path (user_data))) {
576 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
580 static void moonshot_dbus_proxy_dispose (GObject* self) {
581 DBusGConnection *connection;
582 if (((MoonshotDBusProxy*) self)->disposed) {
585 ((MoonshotDBusProxy*) self)->disposed = TRUE;
586 g_object_get (self, "connection", &connection, NULL);
587 dbus_connection_remove_filter (dbus_g_connection_get_connection (connection), moonshot_dbus_proxy_filter, self);
588 G_OBJECT_CLASS (moonshot_dbus_proxy_parent_class)->dispose (self);
592 static void moonshot_dbus_proxy_class_init (MoonshotDBusProxyClass* klass) {
593 G_OBJECT_CLASS (klass)->constructor = moonshot_dbus_proxy_construct;
594 G_OBJECT_CLASS (klass)->dispose = moonshot_dbus_proxy_dispose;
595 G_OBJECT_CLASS (klass)->get_property = moonshot_dbus_proxy_get_property;
596 G_OBJECT_CLASS (klass)->set_property = moonshot_dbus_proxy_set_property;
600 static void moonshot_dbus_proxy_init (MoonshotDBusProxy* self) {
604 static gboolean moonshot_dbus_proxy_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error) {
605 DBusError _dbus_error;
606 DBusGConnection *_connection;
607 DBusMessage *_message, *_reply;
608 DBusMessageIter _iter;
616 char* _server_certificate_hash;
618 char* _ca_certificate;
620 char* _subject_name_constraint;
622 char* _subject_alt_name_constraint;
626 if (((MoonshotDBusProxy*) self)->disposed) {
627 g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed");
630 _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.janet.Moonshot", "GetIdentity");
631 dbus_message_iter_init_append (_message, &_iter);
633 dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp0_);
635 dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp1_);
637 dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp2_);
638 g_object_get (self, "connection", &_connection, NULL);
639 dbus_error_init (&_dbus_error);
640 _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
641 dbus_g_connection_unref (_connection);
642 dbus_message_unref (_message);
643 if (dbus_error_is_set (&_dbus_error)) {
646 if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
648 _edomain = DBUS_GERROR;
649 _tmp10_ = _dbus_error.name + 27;
650 if (strcmp (_tmp10_, "Failed") == 0) {
651 _ecode = DBUS_GERROR_FAILED;
652 } else if (strcmp (_tmp10_, "NoMemory") == 0) {
653 _ecode = DBUS_GERROR_NO_MEMORY;
654 } else if (strcmp (_tmp10_, "ServiceUnknown") == 0) {
655 _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
656 } else if (strcmp (_tmp10_, "NameHasNoOwner") == 0) {
657 _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
658 } else if (strcmp (_tmp10_, "NoReply") == 0) {
659 _ecode = DBUS_GERROR_NO_REPLY;
660 } else if (strcmp (_tmp10_, "IOError") == 0) {
661 _ecode = DBUS_GERROR_IO_ERROR;
662 } else if (strcmp (_tmp10_, "BadAddress") == 0) {
663 _ecode = DBUS_GERROR_BAD_ADDRESS;
664 } else if (strcmp (_tmp10_, "NotSupported") == 0) {
665 _ecode = DBUS_GERROR_NOT_SUPPORTED;
666 } else if (strcmp (_tmp10_, "LimitsExceeded") == 0) {
667 _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
668 } else if (strcmp (_tmp10_, "AccessDenied") == 0) {
669 _ecode = DBUS_GERROR_ACCESS_DENIED;
670 } else if (strcmp (_tmp10_, "AuthFailed") == 0) {
671 _ecode = DBUS_GERROR_AUTH_FAILED;
672 } else if (strcmp (_tmp10_, "NoServer") == 0) {
673 _ecode = DBUS_GERROR_NO_SERVER;
674 } else if (strcmp (_tmp10_, "Timeout") == 0) {
675 _ecode = DBUS_GERROR_TIMEOUT;
676 } else if (strcmp (_tmp10_, "NoNetwork") == 0) {
677 _ecode = DBUS_GERROR_NO_NETWORK;
678 } else if (strcmp (_tmp10_, "AddressInUse") == 0) {
679 _ecode = DBUS_GERROR_ADDRESS_IN_USE;
680 } else if (strcmp (_tmp10_, "Disconnected") == 0) {
681 _ecode = DBUS_GERROR_DISCONNECTED;
682 } else if (strcmp (_tmp10_, "InvalidArgs") == 0) {
683 _ecode = DBUS_GERROR_INVALID_ARGS;
684 } else if (strcmp (_tmp10_, "FileNotFound") == 0) {
685 _ecode = DBUS_GERROR_FILE_NOT_FOUND;
686 } else if (strcmp (_tmp10_, "FileExists") == 0) {
687 _ecode = DBUS_GERROR_FILE_EXISTS;
688 } else if (strcmp (_tmp10_, "UnknownMethod") == 0) {
689 _ecode = DBUS_GERROR_UNKNOWN_METHOD;
690 } else if (strcmp (_tmp10_, "TimedOut") == 0) {
691 _ecode = DBUS_GERROR_TIMED_OUT;
692 } else if (strcmp (_tmp10_, "MatchRuleNotFound") == 0) {
693 _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
694 } else if (strcmp (_tmp10_, "MatchRuleInvalid") == 0) {
695 _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
696 } else if (strcmp (_tmp10_, "Spawn.ExecFailed") == 0) {
697 _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
698 } else if (strcmp (_tmp10_, "Spawn.ForkFailed") == 0) {
699 _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
700 } else if (strcmp (_tmp10_, "Spawn.ChildExited") == 0) {
701 _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
702 } else if (strcmp (_tmp10_, "Spawn.ChildSignaled") == 0) {
703 _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
704 } else if (strcmp (_tmp10_, "Spawn.Failed") == 0) {
705 _ecode = DBUS_GERROR_SPAWN_FAILED;
706 } else if (strcmp (_tmp10_, "UnixProcessIdUnknown") == 0) {
707 _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
708 } else if (strcmp (_tmp10_, "InvalidSignature") == 0) {
709 _ecode = DBUS_GERROR_INVALID_SIGNATURE;
710 } else if (strcmp (_tmp10_, "InvalidFileContent") == 0) {
711 _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
712 } else if (strcmp (_tmp10_, "SELinuxSecurityContextUnknown") == 0) {
713 _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
714 } else if (strcmp (_tmp10_, "RemoteException") == 0) {
715 _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
718 g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
719 dbus_error_free (&_dbus_error);
722 if (strcmp (dbus_message_get_signature (_reply), "ssssssb")) {
723 g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "ssssssb", dbus_message_get_signature (_reply));
724 dbus_message_unref (_reply);
727 dbus_message_iter_init (_reply, &_iter);
728 dbus_message_iter_get_basic (&_iter, &_tmp3_);
729 dbus_message_iter_next (&_iter);
730 _nai_out = g_strdup (_tmp3_);
732 dbus_message_iter_get_basic (&_iter, &_tmp4_);
733 dbus_message_iter_next (&_iter);
734 _password_out = g_strdup (_tmp4_);
735 *password_out = _password_out;
736 dbus_message_iter_get_basic (&_iter, &_tmp5_);
737 dbus_message_iter_next (&_iter);
738 _server_certificate_hash = g_strdup (_tmp5_);
739 *server_certificate_hash = _server_certificate_hash;
740 dbus_message_iter_get_basic (&_iter, &_tmp6_);
741 dbus_message_iter_next (&_iter);
742 _ca_certificate = g_strdup (_tmp6_);
743 *ca_certificate = _ca_certificate;
744 dbus_message_iter_get_basic (&_iter, &_tmp7_);
745 dbus_message_iter_next (&_iter);
746 _subject_name_constraint = g_strdup (_tmp7_);
747 *subject_name_constraint = _subject_name_constraint;
748 dbus_message_iter_get_basic (&_iter, &_tmp8_);
749 dbus_message_iter_next (&_iter);
750 _subject_alt_name_constraint = g_strdup (_tmp8_);
751 *subject_alt_name_constraint = _subject_alt_name_constraint;
752 dbus_message_iter_get_basic (&_iter, &_tmp9_);
753 dbus_message_iter_next (&_iter);
755 dbus_message_unref (_reply);
760 static gboolean moonshot_dbus_proxy_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error) {
761 DBusError _dbus_error;
762 DBusGConnection *_connection;
763 DBusMessage *_message, *_reply;
764 DBusMessageIter _iter;
771 if (((MoonshotDBusProxy*) self)->disposed) {
772 g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed");
775 _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.janet.Moonshot", "GetDefaultIdentity");
776 dbus_message_iter_init_append (_message, &_iter);
777 g_object_get (self, "connection", &_connection, NULL);
778 dbus_error_init (&_dbus_error);
779 _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
780 dbus_g_connection_unref (_connection);
781 dbus_message_unref (_message);
782 if (dbus_error_is_set (&_dbus_error)) {
785 if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
787 _edomain = DBUS_GERROR;
788 _tmp14_ = _dbus_error.name + 27;
789 if (strcmp (_tmp14_, "Failed") == 0) {
790 _ecode = DBUS_GERROR_FAILED;
791 } else if (strcmp (_tmp14_, "NoMemory") == 0) {
792 _ecode = DBUS_GERROR_NO_MEMORY;
793 } else if (strcmp (_tmp14_, "ServiceUnknown") == 0) {
794 _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
795 } else if (strcmp (_tmp14_, "NameHasNoOwner") == 0) {
796 _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
797 } else if (strcmp (_tmp14_, "NoReply") == 0) {
798 _ecode = DBUS_GERROR_NO_REPLY;
799 } else if (strcmp (_tmp14_, "IOError") == 0) {
800 _ecode = DBUS_GERROR_IO_ERROR;
801 } else if (strcmp (_tmp14_, "BadAddress") == 0) {
802 _ecode = DBUS_GERROR_BAD_ADDRESS;
803 } else if (strcmp (_tmp14_, "NotSupported") == 0) {
804 _ecode = DBUS_GERROR_NOT_SUPPORTED;
805 } else if (strcmp (_tmp14_, "LimitsExceeded") == 0) {
806 _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
807 } else if (strcmp (_tmp14_, "AccessDenied") == 0) {
808 _ecode = DBUS_GERROR_ACCESS_DENIED;
809 } else if (strcmp (_tmp14_, "AuthFailed") == 0) {
810 _ecode = DBUS_GERROR_AUTH_FAILED;
811 } else if (strcmp (_tmp14_, "NoServer") == 0) {
812 _ecode = DBUS_GERROR_NO_SERVER;
813 } else if (strcmp (_tmp14_, "Timeout") == 0) {
814 _ecode = DBUS_GERROR_TIMEOUT;
815 } else if (strcmp (_tmp14_, "NoNetwork") == 0) {
816 _ecode = DBUS_GERROR_NO_NETWORK;
817 } else if (strcmp (_tmp14_, "AddressInUse") == 0) {
818 _ecode = DBUS_GERROR_ADDRESS_IN_USE;
819 } else if (strcmp (_tmp14_, "Disconnected") == 0) {
820 _ecode = DBUS_GERROR_DISCONNECTED;
821 } else if (strcmp (_tmp14_, "InvalidArgs") == 0) {
822 _ecode = DBUS_GERROR_INVALID_ARGS;
823 } else if (strcmp (_tmp14_, "FileNotFound") == 0) {
824 _ecode = DBUS_GERROR_FILE_NOT_FOUND;
825 } else if (strcmp (_tmp14_, "FileExists") == 0) {
826 _ecode = DBUS_GERROR_FILE_EXISTS;
827 } else if (strcmp (_tmp14_, "UnknownMethod") == 0) {
828 _ecode = DBUS_GERROR_UNKNOWN_METHOD;
829 } else if (strcmp (_tmp14_, "TimedOut") == 0) {
830 _ecode = DBUS_GERROR_TIMED_OUT;
831 } else if (strcmp (_tmp14_, "MatchRuleNotFound") == 0) {
832 _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
833 } else if (strcmp (_tmp14_, "MatchRuleInvalid") == 0) {
834 _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
835 } else if (strcmp (_tmp14_, "Spawn.ExecFailed") == 0) {
836 _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
837 } else if (strcmp (_tmp14_, "Spawn.ForkFailed") == 0) {
838 _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
839 } else if (strcmp (_tmp14_, "Spawn.ChildExited") == 0) {
840 _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
841 } else if (strcmp (_tmp14_, "Spawn.ChildSignaled") == 0) {
842 _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
843 } else if (strcmp (_tmp14_, "Spawn.Failed") == 0) {
844 _ecode = DBUS_GERROR_SPAWN_FAILED;
845 } else if (strcmp (_tmp14_, "UnixProcessIdUnknown") == 0) {
846 _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
847 } else if (strcmp (_tmp14_, "InvalidSignature") == 0) {
848 _ecode = DBUS_GERROR_INVALID_SIGNATURE;
849 } else if (strcmp (_tmp14_, "InvalidFileContent") == 0) {
850 _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
851 } else if (strcmp (_tmp14_, "SELinuxSecurityContextUnknown") == 0) {
852 _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
853 } else if (strcmp (_tmp14_, "RemoteException") == 0) {
854 _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
857 g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
858 dbus_error_free (&_dbus_error);
861 if (strcmp (dbus_message_get_signature (_reply), "ssb")) {
862 g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "ssb", dbus_message_get_signature (_reply));
863 dbus_message_unref (_reply);
866 dbus_message_iter_init (_reply, &_iter);
867 dbus_message_iter_get_basic (&_iter, &_tmp11_);
868 dbus_message_iter_next (&_iter);
869 _nai_out = g_strdup (_tmp11_);
871 dbus_message_iter_get_basic (&_iter, &_tmp12_);
872 dbus_message_iter_next (&_iter);
873 _password_out = g_strdup (_tmp12_);
874 *password_out = _password_out;
875 dbus_message_iter_get_basic (&_iter, &_tmp13_);
876 dbus_message_iter_next (&_iter);
878 dbus_message_unref (_reply);
883 static void moonshot_dbus_proxy_moonshot__interface_init (MoonshotIface* iface) {
884 iface->get_identity = moonshot_dbus_proxy_get_identity;
885 iface->get_default_identity = moonshot_dbus_proxy_get_default_identity;
889 static void moonshot_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
893 static void moonshot_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
897 void _vala_main (void) {
898 GError * _inner_error_ = NULL;
902 char* certificate_out;
906 DBusGConnection* conn;
918 char* _tmp10_ = NULL;
921 char* _tmp13_ = NULL;
924 char* _tmp16_ = NULL;
927 char* _tmp19_ = NULL;
930 char* _tmp22_ = NULL;
936 certificate_out = NULL;
940 conn = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_);
941 if (_inner_error_ != NULL) {
945 _g_free0 (certificate_out);
946 _g_free0 (password_out);
948 if (_inner_error_->domain == DBUS_GERROR) {
949 goto __catch0_dbus_gerror;
954 _g_free0 (certificate_out);
955 _g_free0 (password_out);
957 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
958 g_clear_error (&_inner_error_);
961 demo = moonshot_dbus_proxy_new (conn, "org.janet.Moonshot", "/org/janet/moonshot");
962 _tmp6_ = (_tmp4_ = (_tmp1_ = moonshot_get_default_identity (demo, &_tmp0_, &_tmp3_, &_inner_error_), nai_out = (_tmp2_ = _tmp0_, _g_free0 (nai_out), _tmp2_), _tmp1_), password_out = (_tmp5_ = _tmp3_, _g_free0 (password_out), _tmp5_), _tmp4_);
963 if (_inner_error_ != NULL) {
964 _g_object_unref0 (demo);
965 _dbus_g_connection_unref0 (conn);
969 _g_free0 (certificate_out);
970 _g_free0 (password_out);
972 if (_inner_error_->domain == DBUS_GERROR) {
973 goto __catch0_dbus_gerror;
975 _g_object_unref0 (demo);
976 _dbus_g_connection_unref0 (conn);
980 _g_free0 (certificate_out);
981 _g_free0 (password_out);
983 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
984 g_clear_error (&_inner_error_);
988 fprintf (stdout, "default identity: %s %s\n", nai_out, password_out);
990 fprintf (stdout, "Unable to get default identity.\n");
992 _tmp25_ = (_tmp23_ = (_tmp20_ = (_tmp17_ = (_tmp14_ = (_tmp11_ = (_tmp8_ = moonshot_get_identity (demo, "username@issuer", "pass", "", &_tmp7_, &_tmp10_, &_tmp13_, &_tmp16_, &_tmp19_, &_tmp22_, &_inner_error_), nai_out = (_tmp9_ = _tmp7_, _g_free0 (nai_out), _tmp9_), _tmp8_), password_out = (_tmp12_ = _tmp10_, _g_free0 (password_out), _tmp12_), _tmp11_), certificate_out = (_tmp15_ = _tmp13_, _g_free0 (certificate_out), _tmp15_), _tmp14_), a = (_tmp18_ = _tmp16_, _g_free0 (a), _tmp18_), _tmp17_), b = (_tmp21_ = _tmp19_, _g_free0 (b), _tmp21_), _tmp20_), c = (_tmp24_ = _tmp22_, _g_free0 (c), _tmp24_), _tmp23_);
993 if (_inner_error_ != NULL) {
994 _g_object_unref0 (demo);
995 _dbus_g_connection_unref0 (conn);
999 _g_free0 (certificate_out);
1000 _g_free0 (password_out);
1002 if (_inner_error_->domain == DBUS_GERROR) {
1003 goto __catch0_dbus_gerror;
1005 _g_object_unref0 (demo);
1006 _dbus_g_connection_unref0 (conn);
1010 _g_free0 (certificate_out);
1011 _g_free0 (password_out);
1013 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1014 g_clear_error (&_inner_error_);
1018 fprintf (stdout, "%s %s %s\n", nai_out, password_out, certificate_out);
1020 fprintf (stdout, "The nai, password or service doesnt match the selected id_card\n");
1022 _g_object_unref0 (demo);
1023 _dbus_g_connection_unref0 (conn);
1027 _g_free0 (certificate_out);
1028 _g_free0 (password_out);
1032 __catch0_dbus_gerror:
1036 _inner_error_ = NULL;
1038 fprintf (stderr, "%s\n", e->message);
1043 if (_inner_error_ != NULL) {
1044 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1045 g_clear_error (&_inner_error_);
1051 int main (int argc, char ** argv) {