static void cockpit_pipe_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { CockpitPipeTransport *self = COCKPIT_PIPE_TRANSPORT (object); switch (prop_id) { case PROP_NAME: g_value_set_string (value, self->name); break; case PROP_PIPE: g_value_set_object (value, cockpit_pipe_transport_get_pipe (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void on_other_closed (CockpitTransport *transport, const gchar *problem, gpointer user_data) { CockpitPortal *self = user_data; const gchar **argv; CockpitPipe *pipe; gint status; if (!problem) problem = "disconnected"; if (self->state == PORTAL_OPENING) { pipe = cockpit_pipe_transport_get_pipe (COCKPIT_PIPE_TRANSPORT (self->other)); status = cockpit_pipe_exit_status (pipe); if (status != -1) { argv = current_argv (self); /* These are the problem codes from pkexec. */ if (WIFEXITED (status)) { if (g_str_equal (argv[0], PATH_PKEXEC) && (WEXITSTATUS (status) == 127 || WEXITSTATUS (status) == 126)) problem = "access-denied"; else if (g_str_equal (argv[0], PATH_SUDO) && WEXITSTATUS (status) == 1) problem = "access-denied"; } } g_debug ("other bridge failed: %s", problem); if (self->argvs[self->argvi + 1] != NULL && (g_str_equal (problem, "no-cockpit") || g_str_equal (problem, "not-found") || g_str_equal (problem, "access-denied"))) { self->argvi += 1; disconnect_portal_bridge (self); spawn_portal_bridge (self); return; } if (g_str_equal (problem, "no-cockpit") || g_str_equal (problem, "not-found")) problem = "not-supported"; } else { g_debug ("other bridge closed: %s", problem); } g_free (self->problem); self->problem = g_strdup (problem); if (self->state == PORTAL_OPENING) transition_failed (self); else transition_none (self); }