diff options
-rw-r--r-- | daemon/Makefile.am | 8 | ||||
-rw-r--r-- | daemon/gdm-launch-environment.c (renamed from daemon/gdm-welcome-session.c) | 460 | ||||
-rw-r--r-- | daemon/gdm-launch-environment.h | 73 | ||||
-rw-r--r-- | daemon/gdm-simple-slave.c | 101 | ||||
-rw-r--r-- | daemon/gdm-welcome-session.h | 73 | ||||
-rw-r--r-- | daemon/gdm-xdmcp-chooser-slave.c | 48 | ||||
-rw-r--r-- | data/Makefile.am | 4 | ||||
-rw-r--r-- | data/pam-openembedded/gdm-launch-environment.pam (renamed from data/pam-openembedded/gdm-welcome.pam) | 0 | ||||
-rw-r--r-- | data/pam-redhat/gdm-launch-environment.pam (renamed from data/pam-redhat/gdm-welcome.pam) | 0 |
9 files changed, 385 insertions, 382 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am index b7c86c4e..1e497e55 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -150,8 +150,8 @@ endif gdm_simple_slave_SOURCES = \ simple-slave-main.c \ - gdm-welcome-session.c \ - gdm-welcome-session.h \ + gdm-launch-environment.c \ + gdm-launch-environment.h \ gdm-server.c \ gdm-server.h \ gdm-session.c \ @@ -208,8 +208,8 @@ gdm_xdmcp_chooser_slave_SOURCES = \ gdm-session-worker-common.h \ gdm-session-worker-job.c \ gdm-session-worker-job.h \ - gdm-welcome-session.c \ - gdm-welcome-session.h \ + gdm-launch-environment.c \ + gdm-launch-environment.h \ gdm-xerrors.h \ gdm-xerrors.c \ gdm-slave.c \ diff --git a/daemon/gdm-welcome-session.c b/daemon/gdm-launch-environment.c index 2662ecf9..46307078 100644 --- a/daemon/gdm-welcome-session.c +++ b/daemon/gdm-launch-environment.c @@ -44,7 +44,7 @@ #include "gdm-common.h" #include "gdm-session-enum-types.h" -#include "gdm-welcome-session.h" +#include "gdm-launch-environment.h" #define DBUS_LAUNCH_COMMAND BINDIR "/dbus-launch" @@ -52,9 +52,9 @@ extern char **environ; -#define GDM_WELCOME_SESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_WELCOME_SESSION, GdmWelcomeSessionPrivate)) +#define GDM_LAUNCH_ENVIRONMENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LAUNCH_ENVIRONMENT, GdmLaunchEnvironmentPrivate)) -struct GdmWelcomeSessionPrivate +struct GdmLaunchEnvironmentPrivate { GdmSession *session; char *command; @@ -104,11 +104,11 @@ enum { static guint signals [LAST_SIGNAL] = { 0, }; -static void gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass); -static void gdm_welcome_session_init (GdmWelcomeSession *welcome_session); -static void gdm_welcome_session_finalize (GObject *object); +static void gdm_launch_environment_class_init (GdmLaunchEnvironmentClass *klass); +static void gdm_launch_environment_init (GdmLaunchEnvironment *launch_environment); +static void gdm_launch_environment_finalize (GObject *object); -G_DEFINE_TYPE (GdmWelcomeSession, gdm_welcome_session, G_TYPE_OBJECT) +G_DEFINE_TYPE (GdmLaunchEnvironment, gdm_launch_environment, G_TYPE_OBJECT) static void listify_hash (const char *key, @@ -117,7 +117,7 @@ listify_hash (const char *key, { char *str; str = g_strdup_printf ("%s=%s", key, value); - g_debug ("GdmWelcomeSession: welcome environment: %s", str); + g_debug ("GdmLaunchEnvironment: launch environment: %s", str); g_ptr_array_add (env, str); } @@ -225,8 +225,8 @@ next_line: } static GHashTable * -build_welcome_environment (GdmWelcomeSession *welcome_session, - gboolean start_session) +build_launch_environment (GdmLaunchEnvironment *launch_environment, + gboolean start_session) { GHashTable *hash; struct passwd *pwent; @@ -265,18 +265,18 @@ build_welcome_environment (GdmWelcomeSession *welcome_session, system_data_dirs)); g_free (system_data_dirs); - if (welcome_session->priv->dbus_bus_address != NULL) { + if (launch_environment->priv->dbus_bus_address != NULL) { g_hash_table_insert (hash, g_strdup ("DBUS_SESSION_BUS_ADDRESS"), - g_strdup (welcome_session->priv->dbus_bus_address)); + g_strdup (launch_environment->priv->dbus_bus_address)); } - g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (welcome_session->priv->x11_authority_file)); - g_hash_table_insert (hash, g_strdup ("DISPLAY"), g_strdup (welcome_session->priv->x11_display_name)); + g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (launch_environment->priv->x11_authority_file)); + g_hash_table_insert (hash, g_strdup ("DISPLAY"), g_strdup (launch_environment->priv->x11_display_name)); - g_hash_table_insert (hash, g_strdup ("LOGNAME"), g_strdup (welcome_session->priv->user_name)); - g_hash_table_insert (hash, g_strdup ("USER"), g_strdup (welcome_session->priv->user_name)); - g_hash_table_insert (hash, g_strdup ("USERNAME"), g_strdup (welcome_session->priv->user_name)); + g_hash_table_insert (hash, g_strdup ("LOGNAME"), g_strdup (launch_environment->priv->user_name)); + g_hash_table_insert (hash, g_strdup ("USER"), g_strdup (launch_environment->priv->user_name)); + g_hash_table_insert (hash, g_strdup ("USERNAME"), g_strdup (launch_environment->priv->user_name)); g_hash_table_insert (hash, g_strdup ("GDM_VERSION"), g_strdup (VERSION)); g_hash_table_remove (hash, "MAIL"); @@ -285,7 +285,7 @@ build_welcome_environment (GdmWelcomeSession *welcome_session, g_hash_table_insert (hash, g_strdup ("PWD"), g_strdup ("/")); g_hash_table_insert (hash, g_strdup ("SHELL"), g_strdup ("/bin/sh")); - gdm_get_pwent_for_name (welcome_session->priv->user_name, &pwent); + gdm_get_pwent_for_name (launch_environment->priv->user_name, &pwent); if (pwent != NULL) { if (pwent->pw_dir != NULL && pwent->pw_dir[0] != '\0') { g_hash_table_insert (hash, g_strdup ("HOME"), g_strdup (pwent->pw_dir)); @@ -295,10 +295,10 @@ build_welcome_environment (GdmWelcomeSession *welcome_session, g_hash_table_insert (hash, g_strdup ("SHELL"), g_strdup (pwent->pw_shell)); } - if (start_session && welcome_session->priv->x11_display_seat_id != NULL) { + if (start_session && launch_environment->priv->x11_display_seat_id != NULL) { char *seat_id; - seat_id = welcome_session->priv->x11_display_seat_id; + seat_id = launch_environment->priv->x11_display_seat_id; if (g_str_has_prefix (seat_id, "/org/freedesktop/ConsoleKit/")) { seat_id += strlen ("/org/freedesktop/ConsoleKit/"); } @@ -316,13 +316,13 @@ build_welcome_environment (GdmWelcomeSession *welcome_session, } static GPtrArray * -get_welcome_environment (GdmWelcomeSession *welcome_session, - gboolean start_session) +get_launch_environment (GdmLaunchEnvironment *launch_environment, + gboolean start_session) { GHashTable *hash; GPtrArray *env; - hash = build_welcome_environment (welcome_session, start_session); + hash = build_launch_environment (launch_environment, start_session); env = g_ptr_array_new (); g_hash_table_foreach (hash, (GHFunc)listify_hash, env); @@ -334,17 +334,17 @@ get_welcome_environment (GdmWelcomeSession *welcome_session, } static gboolean -stop_dbus_daemon (GdmWelcomeSession *welcome_session) +stop_dbus_daemon (GdmLaunchEnvironment *launch_environment) { int res; - if (welcome_session->priv->dbus_pid > 0) { - g_debug ("GdmWelcomeSession: Stopping D-Bus daemon"); - res = gdm_signal_pid (-1 * welcome_session->priv->dbus_pid, SIGTERM); + if (launch_environment->priv->dbus_pid > 0) { + g_debug ("GdmLaunchEnvironment: Stopping D-Bus daemon"); + res = gdm_signal_pid (-1 * launch_environment->priv->dbus_pid, SIGTERM); if (res < 0) { g_warning ("Unable to kill D-Bus daemon"); } else { - welcome_session->priv->dbus_pid = 0; + launch_environment->priv->dbus_pid = 0; } } return TRUE; @@ -410,15 +410,15 @@ spawn_child_setup (SpawnChildData *data) _exit (1); } - g_debug ("GdmWelcomeSession: Setting up run time dir %s", data->runtime_dir); + g_debug ("GdmLaunchEnvironment: Setting up run time dir %s", data->runtime_dir); g_mkdir (data->runtime_dir, 0755); res = chown (data->runtime_dir, pwent->pw_uid, pwent->pw_gid); if (res == -1) { - g_warning ("GdmWelcomeSession: Error setting owner of run time directory: %s", + g_warning ("GdmLaunchEnvironment: Error setting owner of run time directory: %s", g_strerror (errno)); } - g_debug ("GdmWelcomeSession: Changing (uid:gid) for child process to (%d:%d)", + g_debug ("GdmLaunchEnvironment: Changing (uid:gid) for child process to (%d:%d)", pwent->pw_uid, grent->gr_gid); @@ -454,7 +454,7 @@ spawn_child_setup (SpawnChildData *data) } if (setsid () < 0) { - g_debug ("GdmWelcomeSession: could not set pid '%u' as leader of new session and process group - %s", + g_debug ("GdmLaunchEnvironment: could not set pid '%u' as leader of new session and process group - %s", (guint) getpid (), g_strerror (errno)); _exit (2); } @@ -617,7 +617,7 @@ parse_dbus_launch_output (const char *output, } static gboolean -start_dbus_daemon (GdmWelcomeSession *welcome_session) +start_dbus_daemon (GdmLaunchEnvironment *launch_environment) { gboolean res; char *std_out; @@ -626,18 +626,18 @@ start_dbus_daemon (GdmWelcomeSession *welcome_session) GError *error; GPtrArray *env; - g_debug ("GdmWelcomeSession: Starting D-Bus daemon"); + g_debug ("GdmLaunchEnvironment: Starting D-Bus daemon"); - env = get_welcome_environment (welcome_session, FALSE); + env = get_launch_environment (launch_environment, FALSE); std_out = NULL; std_err = NULL; error = NULL; res = spawn_command_line_sync_as_user (DBUS_LAUNCH_COMMAND, - welcome_session->priv->user_name, - welcome_session->priv->group_name, - welcome_session->priv->x11_display_seat_id, - welcome_session->priv->runtime_dir, + launch_environment->priv->user_name, + launch_environment->priv->group_name, + launch_environment->priv->x11_display_seat_id, + launch_environment->priv->runtime_dir, NULL, /* log file */ (char **)env->pdata, &std_out, @@ -655,12 +655,12 @@ start_dbus_daemon (GdmWelcomeSession *welcome_session) /* pull the address and pid from the output */ res = parse_dbus_launch_output (std_out, - &welcome_session->priv->dbus_bus_address, - &welcome_session->priv->dbus_pid); + &launch_environment->priv->dbus_bus_address, + &launch_environment->priv->dbus_pid); if (! res) { g_warning ("Unable to parse D-Bus launch output"); } else { - g_debug ("GdmWelcomeSession: Started D-Bus daemon on pid %d", welcome_session->priv->dbus_pid); + g_debug ("GdmLaunchEnvironment: Started D-Bus daemon on pid %d", launch_environment->priv->dbus_pid); } out: g_free (std_out); @@ -671,99 +671,99 @@ start_dbus_daemon (GdmWelcomeSession *welcome_session) static void on_session_setup_complete (GdmSession *session, const char *service_name, - GdmWelcomeSession *welcome_session) + GdmLaunchEnvironment *launch_environment) { GHashTable *hash; GHashTableIter iter; gpointer key, value; - hash = build_welcome_environment (welcome_session, TRUE); + hash = build_launch_environment (launch_environment, TRUE); g_hash_table_iter_init (&iter, hash); while (g_hash_table_iter_next (&iter, &key, &value)) { - gdm_session_set_environment_variable (welcome_session->priv->session, key, value); + gdm_session_set_environment_variable (launch_environment->priv->session, key, value); } g_hash_table_destroy (hash); - gdm_session_select_session_type (welcome_session->priv->session, "LoginWindow"); + gdm_session_select_session_type (launch_environment->priv->session, "LoginWindow"); } static void -on_session_opened (GdmSession *session, - const char *service_name, - const char *session_id, - GdmWelcomeSession *welcome_session) +on_session_opened (GdmSession *session, + const char *service_name, + const char *session_id, + GdmLaunchEnvironment *launch_environment) { - welcome_session->priv->session_id = g_strdup (session_id); + launch_environment->priv->session_id = g_strdup (session_id); - g_signal_emit (G_OBJECT (welcome_session), signals [OPENED], 0); - gdm_session_start_session (welcome_session->priv->session, service_name); + g_signal_emit (G_OBJECT (launch_environment), signals [OPENED], 0); + gdm_session_start_session (launch_environment->priv->session, service_name); } static void -on_session_started (GdmSession *session, - const char *service_name, - int pid, - GdmWelcomeSession *welcome_session) +on_session_started (GdmSession *session, + const char *service_name, + int pid, + GdmLaunchEnvironment *launch_environment) { - welcome_session->priv->pid = pid; - g_signal_emit (G_OBJECT (welcome_session), signals [STARTED], 0); + launch_environment->priv->pid = pid; + g_signal_emit (G_OBJECT (launch_environment), signals [STARTED], 0); } static void -on_session_exited (GdmSession *session, - int exit_code, - GdmWelcomeSession *welcome_session) +on_session_exited (GdmSession *session, + int exit_code, + GdmLaunchEnvironment *launch_environment) { - gdm_session_stop_conversation (welcome_session->priv->session, "gdm-welcome"); + gdm_session_stop_conversation (launch_environment->priv->session, "gdm-launch-environment"); - g_signal_emit (G_OBJECT (welcome_session), signals [EXITED], 0, exit_code); + g_signal_emit (G_OBJECT (launch_environment), signals [EXITED], 0, exit_code); } static void -on_session_died (GdmSession *session, - int signal_number, - GdmWelcomeSession *welcome_session) +on_session_died (GdmSession *session, + int signal_number, + GdmLaunchEnvironment *launch_environment) { - gdm_session_stop_conversation (welcome_session->priv->session, "gdm-welcome"); + gdm_session_stop_conversation (launch_environment->priv->session, "gdm-launch-environment"); - g_signal_emit (G_OBJECT (welcome_session), signals [DIED], 0, signal_number); + g_signal_emit (G_OBJECT (launch_environment), signals [DIED], 0, signal_number); } static void -on_conversation_started (GdmSession *session, - const char *service_name, - GdmWelcomeSession *welcome_session) +on_conversation_started (GdmSession *session, + const char *service_name, + GdmLaunchEnvironment *launch_environment) { char *log_path; char *log_file; - log_file = g_strdup_printf ("%s-greeter.log", welcome_session->priv->x11_display_name); + log_file = g_strdup_printf ("%s-greeter.log", launch_environment->priv->x11_display_name); log_path = g_build_filename (LOGDIR, log_file, NULL); g_free (log_file); - gdm_session_setup_for_program (welcome_session->priv->session, - "gdm-welcome", - welcome_session->priv->user_name, + gdm_session_setup_for_program (launch_environment->priv->session, + "gdm-launch-environment", + launch_environment->priv->user_name, log_path); g_free (log_path); } static void -on_conversation_stopped (GdmSession *session, - const char *service_name, - GdmWelcomeSession *welcome_session) +on_conversation_stopped (GdmSession *session, + const char *service_name, + GdmLaunchEnvironment *launch_environment) { GdmSession *conversation_session; - conversation_session = welcome_session->priv->session; - welcome_session->priv->session = NULL; + conversation_session = launch_environment->priv->session; + launch_environment->priv->session = NULL; - g_debug ("GdmWelcomeSession: conversation stopped"); - stop_dbus_daemon (welcome_session); + g_debug ("GdmLaunchEnvironment: conversation stopped"); + stop_dbus_daemon (launch_environment); - if (welcome_session->priv->pid > 1) { - g_signal_emit (G_OBJECT (welcome_session), signals [STOPPED], 0); + if (launch_environment->priv->pid > 1) { + g_signal_emit (G_OBJECT (launch_environment), signals [STOPPED], 0); } if (conversation_session != NULL) { @@ -773,26 +773,26 @@ on_conversation_stopped (GdmSession *session, } /** - * gdm_welcome_session_start: + * gdm_launch_environment_start: * @disp: Pointer to a GdmDisplay structure * - * Starts a local X welcome_session. Handles retries and fatal errors properly. + * Starts a local X launch_environment. Handles retries and fatal errors properly. */ gboolean -gdm_welcome_session_start (GdmWelcomeSession *welcome_session) +gdm_launch_environment_start (GdmLaunchEnvironment *launch_environment) { gboolean res; struct passwd *passwd_entry; uid_t uid; - g_debug ("GdmWelcomeSession: Starting welcome..."); - res = start_dbus_daemon (welcome_session); + g_debug ("GdmLaunchEnvironment: Starting..."); + res = start_dbus_daemon (launch_environment); if (!res) { return FALSE; } - res = gdm_get_pwent_for_name (welcome_session->priv->user_name, + res = gdm_get_pwent_for_name (launch_environment->priv->user_name, &passwd_entry); if (!res) { @@ -800,211 +800,211 @@ gdm_welcome_session_start (GdmWelcomeSession *welcome_session) } uid = passwd_entry->pw_uid; - welcome_session->priv->session = gdm_session_new (welcome_session->priv->verification_mode, - uid, - welcome_session->priv->x11_display_name, - welcome_session->priv->x11_display_hostname, - welcome_session->priv->x11_display_device, - welcome_session->priv->x11_display_seat_id, - welcome_session->priv->x11_authority_file, - welcome_session->priv->x11_display_is_local); - - g_signal_connect (welcome_session->priv->session, + launch_environment->priv->session = gdm_session_new (launch_environment->priv->verification_mode, + uid, + launch_environment->priv->x11_display_name, + launch_environment->priv->x11_display_hostname, + launch_environment->priv->x11_display_device, + launch_environment->priv->x11_display_seat_id, + launch_environment->priv->x11_authority_file, + launch_environment->priv->x11_display_is_local); + + g_signal_connect (launch_environment->priv->session, "conversation-started", G_CALLBACK (on_conversation_started), - welcome_session); - g_signal_connect (welcome_session->priv->session, + launch_environment); + g_signal_connect (launch_environment->priv->session, "conversation-stopped", G_CALLBACK (on_conversation_stopped), - welcome_session); - g_signal_connect (welcome_session->priv->session, + launch_environment); + g_signal_connect (launch_environment->priv->session, "setup-complete", G_CALLBACK (on_session_setup_complete), - welcome_session); - g_signal_connect (welcome_session->priv->session, + launch_environment); + g_signal_connect (launch_environment->priv->session, "session-opened", G_CALLBACK (on_session_opened), - welcome_session); - g_signal_connect (welcome_session->priv->session, + launch_environment); + g_signal_connect (launch_environment->priv->session, "session-started", G_CALLBACK (on_session_started), - welcome_session); - g_signal_connect (welcome_session->priv->session, + launch_environment); + g_signal_connect (launch_environment->priv->session, "session-exited", G_CALLBACK (on_session_exited), - welcome_session); - g_signal_connect (welcome_session->priv->session, + launch_environment); + g_signal_connect (launch_environment->priv->session, "session-died", G_CALLBACK (on_session_died), - welcome_session); + launch_environment); - gdm_session_start_conversation (welcome_session->priv->session, "gdm-welcome"); - gdm_session_select_program (welcome_session->priv->session, welcome_session->priv->command); + gdm_session_start_conversation (launch_environment->priv->session, "gdm-launch-environment"); + gdm_session_select_program (launch_environment->priv->session, launch_environment->priv->command); return TRUE; } gboolean -gdm_welcome_session_stop (GdmWelcomeSession *welcome_session) +gdm_launch_environment_stop (GdmLaunchEnvironment *launch_environment) { - if (welcome_session->priv->pid > 1) { - gdm_signal_pid (welcome_session->priv->pid, SIGTERM); + if (launch_environment->priv->pid > 1) { + gdm_signal_pid (launch_environment->priv->pid, SIGTERM); } else { - if (welcome_session->priv->session != NULL) { - gdm_session_stop_conversation (welcome_session->priv->session, "gdm-welcome"); - gdm_session_close (welcome_session->priv->session); + if (launch_environment->priv->session != NULL) { + gdm_session_stop_conversation (launch_environment->priv->session, "gdm-launch-environment"); + gdm_session_close (launch_environment->priv->session); - g_clear_object (&welcome_session->priv->session); + g_clear_object (&launch_environment->priv->session); } else { - stop_dbus_daemon (welcome_session); + stop_dbus_daemon (launch_environment); } - g_signal_emit (G_OBJECT (welcome_session), signals [STOPPED], 0); + g_signal_emit (G_OBJECT (launch_environment), signals [STOPPED], 0); } return TRUE; } GdmSession * -gdm_welcome_session_get_session (GdmWelcomeSession *welcome_session) +gdm_launch_environment_get_session (GdmLaunchEnvironment *launch_environment) { - return welcome_session->priv->session; + return launch_environment->priv->session; } char * -gdm_welcome_session_get_session_id (GdmWelcomeSession *welcome_session) +gdm_launch_environment_get_session_id (GdmLaunchEnvironment *launch_environment) { - return g_strdup (welcome_session->priv->session_id); + return g_strdup (launch_environment->priv->session_id); } static void -_gdm_welcome_session_set_verification_mode (GdmWelcomeSession *welcome_session, - GdmSessionVerificationMode verification_mode) +_gdm_launch_environment_set_verification_mode (GdmLaunchEnvironment *launch_environment, + GdmSessionVerificationMode verification_mode) { - welcome_session->priv->verification_mode = verification_mode; + launch_environment->priv->verification_mode = verification_mode; } static void -_gdm_welcome_session_set_x11_display_name (GdmWelcomeSession *welcome_session, - const char *name) +_gdm_launch_environment_set_x11_display_name (GdmLaunchEnvironment *launch_environment, + const char *name) { - g_free (welcome_session->priv->x11_display_name); - welcome_session->priv->x11_display_name = g_strdup (name); + g_free (launch_environment->priv->x11_display_name); + launch_environment->priv->x11_display_name = g_strdup (name); } static void -_gdm_welcome_session_set_x11_display_seat_id (GdmWelcomeSession *welcome_session, - const char *sid) +_gdm_launch_environment_set_x11_display_seat_id (GdmLaunchEnvironment *launch_environment, + const char *sid) { - g_free (welcome_session->priv->x11_display_seat_id); - welcome_session->priv->x11_display_seat_id = g_strdup (sid); + g_free (launch_environment->priv->x11_display_seat_id); + launch_environment->priv->x11_display_seat_id = g_strdup (sid); } static void -_gdm_welcome_session_set_x11_display_hostname (GdmWelcomeSession *welcome_session, - const char *name) +_gdm_launch_environment_set_x11_display_hostname (GdmLaunchEnvironment *launch_environment, + const char *name) { - g_free (welcome_session->priv->x11_display_hostname); - welcome_session->priv->x11_display_hostname = g_strdup (name); + g_free (launch_environment->priv->x11_display_hostname); + launch_environment->priv->x11_display_hostname = g_strdup (name); } static void -_gdm_welcome_session_set_x11_display_device (GdmWelcomeSession *welcome_session, - const char *name) +_gdm_launch_environment_set_x11_display_device (GdmLaunchEnvironment *launch_environment, + const char *name) { - g_free (welcome_session->priv->x11_display_device); - welcome_session->priv->x11_display_device = g_strdup (name); + g_free (launch_environment->priv->x11_display_device); + launch_environment->priv->x11_display_device = g_strdup (name); } static void -_gdm_welcome_session_set_x11_display_is_local (GdmWelcomeSession *welcome_session, - gboolean is_local) +_gdm_launch_environment_set_x11_display_is_local (GdmLaunchEnvironment *launch_environment, + gboolean is_local) { - welcome_session->priv->x11_display_is_local = is_local; + launch_environment->priv->x11_display_is_local = is_local; } static void -_gdm_welcome_session_set_x11_authority_file (GdmWelcomeSession *welcome_session, - const char *file) +_gdm_launch_environment_set_x11_authority_file (GdmLaunchEnvironment *launch_environment, + const char *file) { - g_free (welcome_session->priv->x11_authority_file); - welcome_session->priv->x11_authority_file = g_strdup (file); + g_free (launch_environment->priv->x11_authority_file); + launch_environment->priv->x11_authority_file = g_strdup (file); } static void -_gdm_welcome_session_set_user_name (GdmWelcomeSession *welcome_session, - const char *name) +_gdm_launch_environment_set_user_name (GdmLaunchEnvironment *launch_environment, + const char *name) { - g_free (welcome_session->priv->user_name); - welcome_session->priv->user_name = g_strdup (name); + g_free (launch_environment->priv->user_name); + launch_environment->priv->user_name = g_strdup (name); } static void -_gdm_welcome_session_set_group_name (GdmWelcomeSession *welcome_session, - const char *name) +_gdm_launch_environment_set_group_name (GdmLaunchEnvironment *launch_environment, + const char *name) { - g_free (welcome_session->priv->group_name); - welcome_session->priv->group_name = g_strdup (name); + g_free (launch_environment->priv->group_name); + launch_environment->priv->group_name = g_strdup (name); } static void -_gdm_welcome_session_set_runtime_dir (GdmWelcomeSession *welcome_session, - const char *dir) +_gdm_launch_environment_set_runtime_dir (GdmLaunchEnvironment *launch_environment, + const char *dir) { - g_free (welcome_session->priv->runtime_dir); - welcome_session->priv->runtime_dir = g_strdup (dir); + g_free (launch_environment->priv->runtime_dir); + launch_environment->priv->runtime_dir = g_strdup (dir); } static void -_gdm_welcome_session_set_command (GdmWelcomeSession *welcome_session, - const char *name) +_gdm_launch_environment_set_command (GdmLaunchEnvironment *launch_environment, + const char *name) { - g_free (welcome_session->priv->command); - welcome_session->priv->command = g_strdup (name); + g_free (launch_environment->priv->command); + launch_environment->priv->command = g_strdup (name); } static void -gdm_welcome_session_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +gdm_launch_environment_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GdmWelcomeSession *self; + GdmLaunchEnvironment *self; - self = GDM_WELCOME_SESSION (object); + self = GDM_LAUNCH_ENVIRONMENT (object); switch (prop_id) { case PROP_VERIFICATION_MODE: - _gdm_welcome_session_set_verification_mode (self, g_value_get_enum (value)); + _gdm_launch_environment_set_verification_mode (self, g_value_get_enum (value)); break; case PROP_X11_DISPLAY_NAME: - _gdm_welcome_session_set_x11_display_name (self, g_value_get_string (value)); + _gdm_launch_environment_set_x11_display_name (self, g_value_get_string (value)); break; case PROP_X11_DISPLAY_SEAT_ID: - _gdm_welcome_session_set_x11_display_seat_id (self, g_value_get_string (value)); + _gdm_launch_environment_set_x11_display_seat_id (self, g_value_get_string (value)); break; case PROP_X11_DISPLAY_HOSTNAME: - _gdm_welcome_session_set_x11_display_hostname (self, g_value_get_string (value)); + _gdm_launch_environment_set_x11_display_hostname (self, g_value_get_string (value)); break; case PROP_X11_DISPLAY_DEVICE: - _gdm_welcome_session_set_x11_display_device (self, g_value_get_string (value)); + _gdm_launch_environment_set_x11_display_device (self, g_value_get_string (value)); break; case PROP_X11_DISPLAY_IS_LOCAL: - _gdm_welcome_session_set_x11_display_is_local (self, g_value_get_boolean (value)); + _gdm_launch_environment_set_x11_display_is_local (self, g_value_get_boolean (value)); break; case PROP_X11_AUTHORITY_FILE: - _gdm_welcome_session_set_x11_authority_file (self, g_value_get_string (value)); + _gdm_launch_environment_set_x11_authority_file (self, g_value_get_string (value)); break; case PROP_USER_NAME: - _gdm_welcome_session_set_user_name (self, g_value_get_string (value)); + _gdm_launch_environment_set_user_name (self, g_value_get_string (value)); break; case PROP_GROUP_NAME: - _gdm_welcome_session_set_group_name (self, g_value_get_string (value)); + _gdm_launch_environment_set_group_name (self, g_value_get_string (value)); break; case PROP_RUNTIME_DIR: - _gdm_welcome_session_set_runtime_dir (self, g_value_get_string (value)); + _gdm_launch_environment_set_runtime_dir (self, g_value_get_string (value)); break; case PROP_COMMAND: - _gdm_welcome_session_set_command (self, g_value_get_string (value)); + _gdm_launch_environment_set_command (self, g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1013,14 +1013,14 @@ gdm_welcome_session_set_property (GObject *object, } static void -gdm_welcome_session_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +gdm_launch_environment_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GdmWelcomeSession *self; + GdmLaunchEnvironment *self; - self = GDM_WELCOME_SESSION (object); + self = GDM_LAUNCH_ENVIRONMENT (object); switch (prop_id) { case PROP_VERIFICATION_MODE: @@ -1063,15 +1063,15 @@ gdm_welcome_session_get_property (GObject *object, } static void -gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) +gdm_launch_environment_class_init (GdmLaunchEnvironmentClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->get_property = gdm_welcome_session_get_property; - object_class->set_property = gdm_welcome_session_set_property; - object_class->finalize = gdm_welcome_session_finalize; + object_class->get_property = gdm_launch_environment_get_property; + object_class->set_property = gdm_launch_environment_set_property; + object_class->finalize = gdm_launch_environment_finalize; - g_type_class_add_private (klass, sizeof (GdmWelcomeSessionPrivate)); + g_type_class_add_private (klass, sizeof (GdmLaunchEnvironmentPrivate)); g_object_class_install_property (object_class, PROP_VERIFICATION_MODE, @@ -1088,7 +1088,7 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) "name", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property (object_class, + g_object_class_install_property (object_class, PROP_X11_DISPLAY_SEAT_ID, g_param_spec_string ("x11-display-seat-id", "seat id", @@ -1155,7 +1155,7 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) g_signal_new ("opened", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmWelcomeSessionClass, opened), + G_STRUCT_OFFSET (GdmLaunchEnvironmentClass, opened), NULL, NULL, g_cclosure_marshal_VOID__VOID, @@ -1165,7 +1165,7 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) g_signal_new ("started", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmWelcomeSessionClass, started), + G_STRUCT_OFFSET (GdmLaunchEnvironmentClass, started), NULL, NULL, g_cclosure_marshal_VOID__VOID, @@ -1175,7 +1175,7 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) g_signal_new ("stopped", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmWelcomeSessionClass, stopped), + G_STRUCT_OFFSET (GdmLaunchEnvironmentClass, stopped), NULL, NULL, g_cclosure_marshal_VOID__VOID, @@ -1185,7 +1185,7 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) g_signal_new ("exited", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmWelcomeSessionClass, exited), + G_STRUCT_OFFSET (GdmLaunchEnvironmentClass, exited), NULL, NULL, g_cclosure_marshal_VOID__INT, @@ -1196,7 +1196,7 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) g_signal_new ("died", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdmWelcomeSessionClass, died), + G_STRUCT_OFFSET (GdmLaunchEnvironmentClass, died), NULL, NULL, g_cclosure_marshal_VOID__INT, @@ -1206,44 +1206,44 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass) } static void -gdm_welcome_session_init (GdmWelcomeSession *welcome_session) +gdm_launch_environment_init (GdmLaunchEnvironment *launch_environment) { - welcome_session->priv = GDM_WELCOME_SESSION_GET_PRIVATE (welcome_session); + launch_environment->priv = GDM_LAUNCH_ENVIRONMENT_GET_PRIVATE (launch_environment); - welcome_session->priv->command = NULL; - welcome_session->priv->session = NULL; + launch_environment->priv->command = NULL; + launch_environment->priv->session = NULL; } static void -gdm_welcome_session_finalize (GObject *object) +gdm_launch_environment_finalize (GObject *object) { - GdmWelcomeSession *welcome_session; + GdmLaunchEnvironment *launch_environment; g_return_if_fail (object != NULL); - g_return_if_fail (GDM_IS_WELCOME_SESSION (object)); + g_return_if_fail (GDM_IS_LAUNCH_ENVIRONMENT (object)); - welcome_session = GDM_WELCOME_SESSION (object); + launch_environment = GDM_LAUNCH_ENVIRONMENT (object); - g_return_if_fail (welcome_session->priv != NULL); + g_return_if_fail (launch_environment->priv != NULL); - gdm_welcome_session_stop (welcome_session); + gdm_launch_environment_stop (launch_environment); - if (welcome_session->priv->session) { - g_object_unref (welcome_session->priv->session); + if (launch_environment->priv->session) { + g_object_unref (launch_environment->priv->session); } - g_free (welcome_session->priv->command); - g_free (welcome_session->priv->user_name); - g_free (welcome_session->priv->group_name); - g_free (welcome_session->priv->runtime_dir); - g_free (welcome_session->priv->x11_display_name); - g_free (welcome_session->priv->x11_display_seat_id); - g_free (welcome_session->priv->x11_display_device); - g_free (welcome_session->priv->x11_display_hostname); - g_free (welcome_session->priv->x11_authority_file); - g_free (welcome_session->priv->dbus_bus_address); - g_free (welcome_session->priv->session_id); - - G_OBJECT_CLASS (gdm_welcome_session_parent_class)->finalize (object); + g_free (launch_environment->priv->command); + g_free (launch_environment->priv->user_name); + g_free (launch_environment->priv->group_name); + g_free (launch_environment->priv->runtime_dir); + g_free (launch_environment->priv->x11_display_name); + g_free (launch_environment->priv->x11_display_seat_id); + g_free (launch_environment->priv->x11_display_device); + g_free (launch_environment->priv->x11_display_hostname); + g_free (launch_environment->priv->x11_authority_file); + g_free (launch_environment->priv->dbus_bus_address); + g_free (launch_environment->priv->session_id); + + G_OBJECT_CLASS (gdm_launch_environment_parent_class)->finalize (object); } diff --git a/daemon/gdm-launch-environment.h b/daemon/gdm-launch-environment.h new file mode 100644 index 00000000..be07b8bc --- /dev/null +++ b/daemon/gdm-launch-environment.h @@ -0,0 +1,73 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + + +#ifndef __GDM_LAUNCH_ENVIRONMENT_H +#define __GDM_LAUNCH_ENVIRONMENT_H + +#include <glib-object.h> +#include "gdm-session.h" + +G_BEGIN_DECLS + +#define GDM_TYPE_LAUNCH_ENVIRONMENT (gdm_launch_environment_get_type ()) +#define GDM_LAUNCH_ENVIRONMENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_LAUNCH_ENVIRONMENT, GdmLaunchEnvironment)) +#define GDM_LAUNCH_ENVIRONMENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_LAUNCH_ENVIRONMENT, GdmLaunchEnvironmentClass)) +#define GDM_IS_LAUNCH_ENVIRONMENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_LAUNCH_ENVIRONMENT)) +#define GDM_IS_LAUNCH_ENVIRONMENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_LAUNCH_ENVIRONMENT)) +#define GDM_LAUNCH_ENVIRONMENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_LAUNCH_ENVIRONMENT, GdmLaunchEnvironmentClass)) + +typedef struct GdmLaunchEnvironmentPrivate GdmLaunchEnvironmentPrivate; + +typedef struct +{ + GObject parent; + GdmLaunchEnvironmentPrivate *priv; +} GdmLaunchEnvironment; + +typedef struct +{ + GObjectClass parent_class; + + /* methods */ + gboolean (*start) (GdmLaunchEnvironment *launch_environment); + gboolean (*stop) (GdmLaunchEnvironment *launch_environment); + + + /* signals */ + void (* opened) (GdmLaunchEnvironment *launch_environment); + void (* started) (GdmLaunchEnvironment *launch_environment); + void (* stopped) (GdmLaunchEnvironment *launch_environment); + void (* exited) (GdmLaunchEnvironment *launch_environment, + int exit_code); + void (* died) (GdmLaunchEnvironment *launch_environment, + int signal_number); +} GdmLaunchEnvironmentClass; + +GType gdm_launch_environment_get_type (void); + +gboolean gdm_launch_environment_start (GdmLaunchEnvironment *launch_environment); +gboolean gdm_launch_environment_stop (GdmLaunchEnvironment *launch_environment); +GdmSession * gdm_launch_environment_get_session (GdmLaunchEnvironment *launch_environment); +char * gdm_launch_environment_get_session_id (GdmLaunchEnvironment *launch_environment); + +G_END_DECLS + +#endif /* __GDM_LAUNCH_ENVIRONMENT_H */ diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c index dc17a5b2..c00fd80e 100644 --- a/daemon/gdm-simple-slave.c +++ b/daemon/gdm-simple-slave.c @@ -50,7 +50,7 @@ #include "gdm-server.h" #include "gdm-session.h" #include "gdm-session-glue.h" -#include "gdm-welcome-session.h" +#include "gdm-launch-environment.h" #include "gdm-settings-direct.h" #include "gdm-settings-keys.h" @@ -76,8 +76,12 @@ struct GdmSimpleSlavePrivate guint connection_attempts; GdmServer *server; + + /* we control the user session */ GdmSession *session; - GdmWelcomeSession *greeter; + + /* this spawns and controls the greeter session */ + GdmLaunchEnvironment *greeter_environment; GHashTable *open_reauthentication_requests; @@ -324,7 +328,7 @@ stop_greeter (GdmSimpleSlave *slave) g_debug ("GdmSimpleSlave: Stopping greeter"); - if (slave->priv->greeter == NULL) { + if (slave->priv->greeter_environment == NULL) { g_debug ("GdmSimpleSlave: No greeter running"); return; } @@ -340,7 +344,7 @@ stop_greeter (GdmSimpleSlave *slave) } g_free (username); - gdm_welcome_session_stop (GDM_WELCOME_SESSION (slave->priv->greeter)); + gdm_launch_environment_stop (GDM_LAUNCH_ENVIRONMENT (slave->priv->greeter_environment)); } static void @@ -388,11 +392,11 @@ start_session_timeout (GdmSimpleSlave *slave) g_free (slave->priv->start_session_service_name); slave->priv->start_session_service_name = NULL; } else { - if (slave->priv->greeter == NULL) { + if (slave->priv->greeter_environment == NULL) { /* auto login */ start_session (slave); } else { - /* Session actually gets started from on_greeter_session_stop */ + /* Session actually gets started from on_greeter_environment_session_stop */ stop_greeter (slave); } } @@ -705,8 +709,8 @@ create_new_session (GdmSimpleSlave *slave) g_debug ("GdmSimpleSlave: Creating new session"); - if (slave->priv->greeter != NULL) { - greeter_session = gdm_welcome_session_get_session (GDM_WELCOME_SESSION (slave->priv->greeter)); + if (slave->priv->greeter_environment != NULL) { + greeter_session = gdm_launch_environment_get_session (GDM_LAUNCH_ENVIRONMENT (slave->priv->greeter_environment)); greeter_uid = gdm_session_get_allowed_user (greeter_session); } else { greeter_uid = 0; @@ -793,28 +797,28 @@ create_new_session (GdmSimpleSlave *slave) } static void -on_greeter_session_opened (GdmWelcomeSession *greeter, - GdmSimpleSlave *slave) +on_greeter_environment_session_opened (GdmLaunchEnvironment *greeter_environment, + GdmSimpleSlave *slave) { char *session_id; g_debug ("GdmSimpleSlave: Greeter session opened"); - session_id = gdm_welcome_session_get_session_id (GDM_WELCOME_SESSION (greeter)); + session_id = gdm_launch_environment_get_session_id (GDM_LAUNCH_ENVIRONMENT (greeter_environment)); g_object_set (GDM_SLAVE (slave), "session-id", session_id, NULL); g_free (session_id); } static void -on_greeter_session_started (GdmWelcomeSession *greeter, - GdmSimpleSlave *slave) +on_greeter_environment_session_started (GdmLaunchEnvironment *greeter_environment, + GdmSimpleSlave *slave) { g_debug ("GdmSimpleSlave: Greeter started"); } static void -on_greeter_session_stopped (GdmWelcomeSession *greeter, - GdmSimpleSlave *slave) +on_greeter_environment_session_stopped (GdmLaunchEnvironment *greeter_environment, + GdmSimpleSlave *slave) { g_debug ("GdmSimpleSlave: Greeter stopped"); if (slave->priv->start_session_service_name == NULL) { @@ -823,15 +827,14 @@ on_greeter_session_stopped (GdmWelcomeSession *greeter, start_session (slave); } - g_object_unref (slave->priv->greeter); - slave->priv->greeter = NULL; - + g_object_unref (slave->priv->greeter_environment); + slave->priv->greeter_environment = NULL; } static void -on_greeter_session_exited (GdmWelcomeSession *greeter, - int code, - GdmSimpleSlave *slave) +on_greeter_environment_session_exited (GdmLaunchEnvironment *greeter_environment, + int code, + GdmSimpleSlave *slave) { g_debug ("GdmSimpleSlave: Greeter exited: %d", code); if (slave->priv->start_session_service_name == NULL) { @@ -840,9 +843,9 @@ on_greeter_session_exited (GdmWelcomeSession *greeter, } static void -on_greeter_session_died (GdmWelcomeSession *greeter, - int signal, - GdmSimpleSlave *slave) +on_greeter_environment_session_died (GdmLaunchEnvironment *greeter_environment, + int signal, + GdmSimpleSlave *slave) { g_debug ("GdmSimpleSlave: Greeter died: %d", signal); if (slave->priv->start_session_service_name == NULL) { @@ -945,12 +948,12 @@ setup_server (GdmSimpleSlave *slave) #endif } -static GdmWelcomeSession * -create_greeter_session (const char *display_name, - const char *seat_id, - const char *display_device, - const char *display_hostname, - gboolean display_is_local) +static GdmLaunchEnvironment * +create_greeter_environment (const char *display_name, + const char *seat_id, + const char *display_device, + const char *display_hostname, + gboolean display_is_local) { gboolean debug = FALSE; char *command = BINDIR "/gnome-session -f"; @@ -961,7 +964,7 @@ create_greeter_session (const char *display_name, command = BINDIR "/gnome-session -f --debug"; } - return g_object_new (GDM_TYPE_WELCOME_SESSION, + return g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT, "command", command, "x11-display-name", display_name, "x11-display-seat-id", seat_id, @@ -1024,36 +1027,36 @@ start_greeter (GdmSimpleSlave *slave) gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/Init", GDM_USERNAME); g_debug ("GdmSimpleSlave: Creating greeter on %s %s %s", display_name, display_device, display_hostname); - slave->priv->greeter = create_greeter_session (display_name, - seat_id, - display_device, - display_hostname, - display_is_local); - g_signal_connect (slave->priv->greeter, + slave->priv->greeter_environment = create_greeter_environment (display_name, + seat_id, + display_device, + display_hostname, + display_is_local); + g_signal_connect (slave->priv->greeter_environment, "opened", - G_CALLBACK (on_greeter_session_opened), + G_CALLBACK (on_greeter_environment_session_opened), slave); - g_signal_connect (slave->priv->greeter, + g_signal_connect (slave->priv->greeter_environment, "started", - G_CALLBACK (on_greeter_session_started), + G_CALLBACK (on_greeter_environment_session_started), slave); - g_signal_connect (slave->priv->greeter, + g_signal_connect (slave->priv->greeter_environment, "stopped", - G_CALLBACK (on_greeter_session_stopped), + G_CALLBACK (on_greeter_environment_session_stopped), slave); - g_signal_connect (slave->priv->greeter, + g_signal_connect (slave->priv->greeter_environment, "exited", - G_CALLBACK (on_greeter_session_exited), + G_CALLBACK (on_greeter_environment_session_exited), slave); - g_signal_connect (slave->priv->greeter, + g_signal_connect (slave->priv->greeter_environment, "died", - G_CALLBACK (on_greeter_session_died), + G_CALLBACK (on_greeter_environment_session_died), slave); - g_object_set (slave->priv->greeter, + g_object_set (slave->priv->greeter_environment, "x11-authority-file", auth_file, NULL); - gdm_welcome_session_start (GDM_WELCOME_SESSION (slave->priv->greeter)); + gdm_launch_environment_start (GDM_LAUNCH_ENVIRONMENT (slave->priv->greeter_environment)); g_free (display_id); g_free (display_name); @@ -1337,7 +1340,7 @@ gdm_simple_slave_stop (GdmSlave *slave) GDM_SLAVE_CLASS (gdm_simple_slave_parent_class)->stop (slave); - if (self->priv->greeter != NULL) { + if (self->priv->greeter_environment != NULL) { stop_greeter (self); } diff --git a/daemon/gdm-welcome-session.h b/daemon/gdm-welcome-session.h deleted file mode 100644 index 6e35d1d9..00000000 --- a/daemon/gdm-welcome-session.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ - - -#ifndef __GDM_WELCOME_SESSION_H -#define __GDM_WELCOME_SESSION_H - -#include <glib-object.h> -#include "gdm-session.h" - -G_BEGIN_DECLS - -#define GDM_TYPE_WELCOME_SESSION (gdm_welcome_session_get_type ()) -#define GDM_WELCOME_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_WELCOME_SESSION, GdmWelcomeSession)) -#define GDM_WELCOME_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_WELCOME_SESSION, GdmWelcomeSessionClass)) -#define GDM_IS_WELCOME_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_WELCOME_SESSION)) -#define GDM_IS_WELCOME_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_WELCOME_SESSION)) -#define GDM_WELCOME_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_WELCOME_SESSION, GdmWelcomeSessionClass)) - -typedef struct GdmWelcomeSessionPrivate GdmWelcomeSessionPrivate; - -typedef struct -{ - GObject parent; - GdmWelcomeSessionPrivate *priv; -} GdmWelcomeSession; - -typedef struct -{ - GObjectClass parent_class; - - /* methods */ - gboolean (*start) (GdmWelcomeSession *welcome_session); - gboolean (*stop) (GdmWelcomeSession *welcome_session); - - - /* signals */ - void (* opened) (GdmWelcomeSession *welcome_session); - void (* started) (GdmWelcomeSession *welcome_session); - void (* stopped) (GdmWelcomeSession *welcome_session); - void (* exited) (GdmWelcomeSession *welcome_session, - int exit_code); - void (* died) (GdmWelcomeSession *welcome_session, - int signal_number); -} GdmWelcomeSessionClass; - -GType gdm_welcome_session_get_type (void); - -gboolean gdm_welcome_session_start (GdmWelcomeSession *welcome_session); -gboolean gdm_welcome_session_stop (GdmWelcomeSession *welcome_session); -GdmSession * gdm_welcome_session_get_session (GdmWelcomeSession *welcome_session); -char * gdm_welcome_session_get_session_id (GdmWelcomeSession *welcome_session); - -G_END_DECLS - -#endif /* __GDM_WELCOME_SESSION_H */ diff --git a/daemon/gdm-xdmcp-chooser-slave.c b/daemon/gdm-xdmcp-chooser-slave.c index b4c6bff6..fef0ff80 100644 --- a/daemon/gdm-xdmcp-chooser-slave.c +++ b/daemon/gdm-xdmcp-chooser-slave.c @@ -42,7 +42,7 @@ #include "gdm-xdmcp-chooser-slave-glue.h" #include "gdm-server.h" -#include "gdm-welcome-session.h" +#include "gdm-launch-environment.h" #include "gdm-settings-direct.h" #include "gdm-settings-keys.h" #include "gdm-session.h" @@ -64,7 +64,7 @@ struct GdmXdmcpChooserSlavePrivate guint connection_attempts; - GdmWelcomeSession *chooser; + GdmLaunchEnvironment *chooser_environment; GdmDBusXdmcpChooserSlave *skeleton; }; @@ -77,38 +77,38 @@ G_DEFINE_TYPE (GdmXdmcpChooserSlave, gdm_xdmcp_chooser_slave, GDM_TYPE_SLAVE) static void -on_chooser_session_opened (GdmWelcomeSession *chooser, +on_chooser_session_opened (GdmLaunchEnvironment *chooser, GdmXdmcpChooserSlave *slave) { char *session_id; g_debug ("GdmSimpleSlave: Chooser session opened"); - session_id = gdm_welcome_session_get_session_id (GDM_WELCOME_SESSION (chooser)); + session_id = gdm_launch_environment_get_session_id (GDM_LAUNCH_ENVIRONMENT (chooser)); g_object_set (GDM_SLAVE (slave), "session-id", session_id, NULL); g_free (session_id); } static void -on_chooser_session_start (GdmWelcomeSession *chooser, +on_chooser_session_start (GdmLaunchEnvironment *chooser, GdmXdmcpChooserSlave *slave) { g_debug ("GdmXdmcpChooserSlave: Chooser started"); } static void -on_chooser_session_stop (GdmWelcomeSession *chooser, +on_chooser_session_stop (GdmLaunchEnvironment *chooser, GdmXdmcpChooserSlave *slave) { g_debug ("GdmXdmcpChooserSlave: Chooser stopped"); gdm_slave_stopped (GDM_SLAVE (slave)); - g_object_unref (GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser); - GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser = NULL; + g_object_unref (GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser_environment); + GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser_environment = NULL; } static void -on_chooser_session_exited (GdmWelcomeSession *chooser, +on_chooser_session_exited (GdmLaunchEnvironment *chooser, int code, GdmXdmcpChooserSlave *slave) { @@ -120,7 +120,7 @@ on_chooser_session_exited (GdmWelcomeSession *chooser, } static void -on_chooser_session_died (GdmWelcomeSession *chooser, +on_chooser_session_died (GdmLaunchEnvironment *chooser, int signal, GdmXdmcpChooserSlave *slave) { @@ -169,12 +169,12 @@ setup_server (GdmXdmcpChooserSlave *slave) gdm_slave_set_busy_cursor (GDM_SLAVE (slave)); } -static GdmWelcomeSession * +static GdmLaunchEnvironment * create_chooser_session (const char *display_name, const char *display_device, const char *display_hostname) { - return g_object_new (GDM_TYPE_WELCOME_SESSION, + return g_object_new (GDM_TYPE_LAUNCH_ENVIRONMENT, "command", LIBEXECDIR "/gdm-simple-chooser", "verification-mode", GDM_SESSION_VERIFICATION_MODE_CHOOSER, "x11-display-name", display_name, @@ -226,36 +226,36 @@ run_chooser (GdmXdmcpChooserSlave *slave) gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/Init", GDM_USERNAME); g_debug ("GdmXdmcpChooserSlave: Creating chooser on %s %s %s", display_name, display_device, display_hostname); - slave->priv->chooser = create_chooser_session (display_name, + slave->priv->chooser_environment = create_chooser_session (display_name, display_device, display_hostname); - g_signal_connect (slave->priv->chooser, + g_signal_connect (slave->priv->chooser_environment, "opened", G_CALLBACK (on_chooser_session_opened), slave); - g_signal_connect (slave->priv->chooser, + g_signal_connect (slave->priv->chooser_environment, "started", G_CALLBACK (on_chooser_session_start), slave); - g_signal_connect (slave->priv->chooser, + g_signal_connect (slave->priv->chooser_environment, "stopped", G_CALLBACK (on_chooser_session_stop), slave); - g_signal_connect (slave->priv->chooser, + g_signal_connect (slave->priv->chooser_environment, "exited", G_CALLBACK (on_chooser_session_exited), slave); - g_signal_connect (slave->priv->chooser, + g_signal_connect (slave->priv->chooser_environment, "died", G_CALLBACK (on_chooser_session_died), slave); - g_object_set (slave->priv->chooser, + g_object_set (slave->priv->chooser_environment, "x11-authority-file", auth_file, NULL); - gdm_welcome_session_start (GDM_WELCOME_SESSION (slave->priv->chooser)); + gdm_launch_environment_start (GDM_LAUNCH_ENVIRONMENT (slave->priv->chooser_environment)); - session = gdm_welcome_session_get_session (GDM_WELCOME_SESSION (slave->priv->chooser)); + session = gdm_launch_environment_get_session (GDM_LAUNCH_ENVIRONMENT (slave->priv->chooser_environment)); g_signal_connect (session, "hostname-selected", @@ -340,8 +340,8 @@ gdm_xdmcp_chooser_slave_stop (GdmSlave *slave) GDM_SLAVE_CLASS (gdm_xdmcp_chooser_slave_parent_class)->stop (slave); - if (GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser != NULL) { - gdm_welcome_session_stop (GDM_WELCOME_SESSION (GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser)); + if (GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser_environment != NULL) { + gdm_launch_environment_stop (GDM_LAUNCH_ENVIRONMENT (GDM_XDMCP_CHOOSER_SLAVE (slave)->priv->chooser_environment)); } return TRUE; @@ -357,7 +357,7 @@ gdm_xdmcp_chooser_slave_open_session (GdmSlave *slave, GdmXdmcpChooserSlave *self = GDM_XDMCP_CHOOSER_SLAVE (slave); GdmSession *session; - session = gdm_welcome_session_get_session (GDM_WELCOME_SESSION (self->priv->chooser)); + session = gdm_launch_environment_get_session (GDM_LAUNCH_ENVIRONMENT (self->priv->chooser_environment)); if (gdm_session_client_is_connected (session)) { g_set_error (error, diff --git a/data/Makefile.am b/data/Makefile.am index e3f86422..ffbc7684 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -91,7 +91,7 @@ session_DATA = gdm-fallback.session gdm-shell.session pam_redhat_files = pam-redhat/gdm.pam \ pam-redhat/gdm-autologin.pam \ - pam-redhat/gdm-welcome.pam \ + pam-redhat/gdm-launch-environment.pam \ pam-redhat/gdm-fingerprint.pam \ pam-redhat/gdm-smartcard.pam \ pam-redhat/gdm-password.pam \ @@ -100,7 +100,7 @@ EXTRA_DIST += $(pam_redhat_files) pam_openembedded_files = pam-openembedded/gdm.pam \ pam-openembedded/gdm-autologin.pam \ - pam-openembedded/gdm-welcome.pam \ + pam-openembedded/gdm-launch-environment.pam \ $(NULL) EXTRA_DIST += $(pam_openembedded_files) diff --git a/data/pam-openembedded/gdm-welcome.pam b/data/pam-openembedded/gdm-launch-environment.pam index 602217b1..602217b1 100644 --- a/data/pam-openembedded/gdm-welcome.pam +++ b/data/pam-openembedded/gdm-launch-environment.pam diff --git a/data/pam-redhat/gdm-welcome.pam b/data/pam-redhat/gdm-launch-environment.pam index 17f323e1..17f323e1 100644 --- a/data/pam-redhat/gdm-welcome.pam +++ b/data/pam-redhat/gdm-launch-environment.pam |