SHA256
1
0
forked from pool/gdm
gdm/gdm-2.8.0.7-halt-needs-root.patch

569 lines
20 KiB
Diff
Raw Normal View History

diff -upr gdm-2.19.7-pre/daemon/gdm-daemon-config-entries.h gdm-2.19.7-post/daemon/gdm-daemon-config-entries.h
--- gdm-2.19.7-pre/daemon/gdm-daemon-config-entries.h 2007-09-14 00:07:36.000000000 -0500
+++ gdm-2.19.7-post/daemon/gdm-daemon-config-entries.h 2007-09-14 00:07:32.000000000 -0500
@@ -110,6 +110,7 @@ typedef enum {
GDM_ID_ALLOW_ROOT,
GDM_ID_ALLOW_REMOTE_ROOT,
GDM_ID_ALLOW_REMOTE_AUTOLOGIN,
+ GDM_ID_SECURE_SHUTDOWN,
GDM_ID_USER_MAX_FILE,
GDM_ID_RELAX_PERM,
GDM_ID_CHECK_DIR_OWNER,
@@ -360,6 +361,7 @@ static const GdmConfigEntry gdm_daemon_c
{ GDM_CONFIG_GROUP_SECURITY, "AllowRoot", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_ALLOW_ROOT },
{ GDM_CONFIG_GROUP_SECURITY, "AllowRemoteRoot", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_ALLOW_REMOTE_ROOT },
{ GDM_CONFIG_GROUP_SECURITY, "AllowRemoteAutoLogin", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_ALLOW_REMOTE_AUTOLOGIN },
+ { GDM_CONFIG_GROUP_SECURITY, "SecureShutdown", GDM_CONFIG_VALUE_BOOL, "false", GDM_ID_SECURE_SHUTDOWN },
{ GDM_CONFIG_GROUP_SECURITY, "UserMaxFile", GDM_CONFIG_VALUE_INT, "65536", GDM_ID_USER_MAX_FILE },
{ GDM_CONFIG_GROUP_SECURITY, "RelaxPermissions", GDM_CONFIG_VALUE_INT, "0", GDM_ID_RELAX_PERM },
{ GDM_CONFIG_GROUP_SECURITY, "CheckDirOwner", GDM_CONFIG_VALUE_BOOL, "true", GDM_ID_CHECK_DIR_OWNER },
diff -upr gdm-2.19.7-pre/daemon/gdm-daemon-config-keys.h gdm-2.19.7-post/daemon/gdm-daemon-config-keys.h
--- gdm-2.19.7-pre/daemon/gdm-daemon-config-keys.h 2007-09-14 00:07:36.000000000 -0500
+++ gdm-2.19.7-post/daemon/gdm-daemon-config-keys.h 2007-09-14 00:07:32.000000000 -0500
@@ -98,6 +98,7 @@ G_BEGIN_DECLS
#define GDM_KEY_ALLOW_ROOT "security/AllowRoot=true"
#define GDM_KEY_ALLOW_REMOTE_ROOT "security/AllowRemoteRoot=false"
#define GDM_KEY_ALLOW_REMOTE_AUTOLOGIN "security/AllowRemoteAutoLogin=false"
+#define GDM_KEY_SECURE_SHUTDOWN "security/SecureShutdown=false"
#define GDM_KEY_USER_MAX_FILE "security/UserMaxFile=65536"
#define GDM_KEY_RELAX_PERM "security/RelaxPermissions=0"
#define GDM_KEY_CHECK_DIR_OWNER "security/CheckDirOwner=true"
@@ -208,6 +209,7 @@ G_BEGIN_DECLS
#define GDM_NOTIFY_ALLOW_REMOTE_ROOT "AllowRemoteRoot" /* <true/false as int> */
#define GDM_NOTIFY_ALLOW_ROOT "AllowRoot" /* <true/false as int> */
#define GDM_NOTIFY_ALLOW_REMOTE_AUTOLOGIN "AllowRemoteAutoLogin" /* <true/false as int> */
+#define GDM_NOTIFY_SECURE_SHUTDOWN "SecureShutdown" /* <true/false as int> */
#define GDM_NOTIFY_SYSTEM_MENU "SystemMenu" /* <true/false as int> */
#define GDM_NOTIFY_CONFIG_AVAILABLE "ConfigAvailable" /* <true/false as int> */
#define GDM_NOTIFY_CHOOSER_BUTTON "ChooserButton" /* <true/false as int> */
diff -upr gdm-2.19.7-pre/daemon/gdm-socket-protocol.h gdm-2.19.7-post/daemon/gdm-socket-protocol.h
--- gdm-2.19.7-pre/daemon/gdm-socket-protocol.h 2007-08-27 11:08:20.000000000 -0500
+++ gdm-2.19.7-post/daemon/gdm-socket-protocol.h 2007-09-14 00:07:32.000000000 -0500
@@ -68,6 +68,8 @@
/* Different login interruptions */
#define GDM_INTERRUPT_TIMED_LOGIN 'T'
#define GDM_INTERRUPT_CONFIGURE 'C'
+#define GDM_INTERRUPT_HALT 'K'
+#define GDM_INTERRUPT_REBOOT 'B'
#define GDM_INTERRUPT_SUSPEND 'S'
#define GDM_INTERRUPT_SELECT_USER 'U'
#define GDM_INTERRUPT_LOGIN_SOUND 'L'
diff -upr gdm-2.19.7-pre/daemon/slave.c gdm-2.19.7-post/daemon/slave.c
--- gdm-2.19.7-pre/daemon/slave.c 2007-09-14 00:07:36.000000000 -0500
+++ gdm-2.19.7-post/daemon/slave.c 2007-09-14 00:08:08.000000000 -0500
@@ -140,6 +140,8 @@ static gboolean do_timed_login =
static gboolean do_configurator = FALSE; /* If this is true, login as
* root and start the
* configurator */
+static gboolean do_system_halt = FALSE;
+static gboolean do_system_reboot = FALSE;
static gboolean do_cancel = FALSE; /* If this is true, go back to
username entry & unselect
face browser (if present) */
@@ -2067,6 +2069,96 @@ play_login_sound (const char *sound_file
return TRUE;
}
+static gboolean
+get_root_auth (const gchar *message, struct passwd **pwent)
+{
+ gboolean oldAllowRoot;
+
+ /* clear any error */
+ gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, "");
+ gdm_slave_greeter_ctl_no_ret (GDM_MSG, message);
+
+ /* we always allow root for this */
+ oldAllowRoot = gdm_daemon_config_get_value_bool (GDM_KEY_ALLOW_ROOT);
+ gdm_daemon_config_set_value_bool (GDM_KEY_ALLOW_ROOT, TRUE);
+
+ *pwent = getpwuid (0);
+ if G_UNLIKELY (*pwent == NULL) {
+ /* what? no "root" ?? */
+ gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
+ gdm_daemon_config_set_value_bool (GDM_KEY_ALLOW_ROOT, oldAllowRoot);
+ return FALSE; /* continue */
+ }
+
+ gdm_slave_greeter_ctl_no_ret (GDM_SETLOGIN, (*pwent)->pw_name);
+ login_user = gdm_verify_user (d,
+ (*pwent)->pw_name,
+ FALSE);
+ gdm_daemon_config_set_value_bool (GDM_KEY_ALLOW_ROOT, oldAllowRoot);
+
+ /* Clear message */
+ gdm_slave_greeter_ctl_no_ret (GDM_MSG, "");
+
+ if G_UNLIKELY (do_restart_greeter) {
+ g_free (login_user);
+ login_user = NULL;
+ do_restart_greeter = FALSE;
+ restart_the_greeter ();
+ return FALSE; /* continue */
+ }
+
+ check_notifies_now ();
+
+ /* The wanker can't remember his password */
+ if (login_user == NULL) {
+ gdm_debug ("gdm_slave_wait_for_login: No login/Bad login");
+ gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
+ return FALSE; /* continue */
+ }
+
+ /* Wipe the login */
+ g_free (login_user);
+ login_user = NULL;
+
+ /* Note that this can still fall through to
+ * the timed login if the user doesn't type in the
+ * password fast enough and there is timed login
+ * enabled */
+ if (do_timed_login) {
+ return FALSE; /* break; */
+ }
+
+ /* The user is a wanker */
+ if G_UNLIKELY (do_configurator || do_system_halt || do_system_reboot) {
+ do_configurator = FALSE;
+ do_system_halt = FALSE;
+ do_system_reboot = FALSE;
+ gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
+ return FALSE; /* continue */
+ }
+
+ /* Now running as root */
+
+ /* Get the root pwent */
+ *pwent = getpwuid (0);
+
+ if G_UNLIKELY (*pwent == NULL) {
+ /* What? No "root" ?? This is not possible
+ * since we logged in, but I'm paranoid */
+ gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
+ return FALSE; /* continue */
+ }
+
+ d->logged_in = TRUE;
+ logged_in_uid = 0;
+ logged_in_gid = 0;
+ gdm_slave_send_num (GDM_SOP_LOGGED_IN, TRUE);
+ /* Note: nobody really logged in */
+ gdm_slave_send_string (GDM_SOP_LOGIN, "");
+
+ return TRUE;
+}
+
static void
gdm_slave_wait_for_login (void)
{
@@ -2127,86 +2219,14 @@ gdm_slave_wait_for_login (void)
do_configurator = FALSE;
g_free (login_user);
login_user = NULL;
- /* clear any error */
- gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, "");
- gdm_slave_greeter_ctl_no_ret
- (GDM_MSG,
- _("You must authenticate as root to run configuration."));
-
- /* we always allow root for this */
- oldAllowRoot = gdm_daemon_config_get_value_bool (GDM_KEY_ALLOW_ROOT);
- gdm_daemon_config_set_value_bool (GDM_KEY_ALLOW_ROOT, TRUE);
-
- pwent = getpwuid (0);
- if G_UNLIKELY (pwent == NULL) {
- /* what? no "root" ?? */
- gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
- continue;
- }
-
- gdm_slave_greeter_ctl_no_ret (GDM_SETLOGIN, pwent->pw_name);
- login_user = gdm_verify_user (d,
- pwent->pw_name,
- FALSE);
- gdm_daemon_config_set_value_bool (GDM_KEY_ALLOW_ROOT, oldAllowRoot);
-
- /* Clear message */
- gdm_slave_greeter_ctl_no_ret (GDM_MSG, "");
-
- if G_UNLIKELY (do_restart_greeter) {
- g_free (login_user);
- login_user = NULL;
- do_restart_greeter = FALSE;
- restart_the_greeter ();
- continue;
- }
-
- check_notifies_now ();
-
- /* The user can't remember his password */
- if (login_user == NULL) {
- gdm_debug ("gdm_slave_wait_for_login: No login/Bad login");
- gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
- continue;
- }
-
- /* Wipe the login */
- g_free (login_user);
- login_user = NULL;
- /* Note that this can still fall through to
- * the timed login if the user doesn't type in the
- * password fast enough and there is timed login
- * enabled */
- if (do_timed_login) {
- break;
- }
+ if (!get_root_auth (_("You must authenticate as root to run configuration."), &pwent)) {
+ if (do_timed_login)
+ break;
- if G_UNLIKELY (do_configurator) {
- do_configurator = FALSE;
- gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
continue;
}
- /* Now running as root */
-
- /* Get the root pwent */
- pwent = getpwuid (0);
-
- if G_UNLIKELY (pwent == NULL) {
- /* What? No "root" ?? This is not possible
- * since we logged in, but I'm paranoid */
- gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
- continue;
- }
-
- d->logged_in = TRUE;
- logged_in_uid = 0;
- logged_in_gid = 0;
- gdm_slave_send_num (GDM_SOP_LOGGED_IN, TRUE);
- /* Note: nobody really logged in */
- gdm_slave_send_string (GDM_SOP_LOGIN, "");
-
/* Disable the login screen, we don't want people to
* log in in the meantime */
gdm_slave_greeter_ctl_no_ret (GDM_DISABLE, "");
@@ -2245,6 +2265,43 @@ gdm_slave_wait_for_login (void)
continue;
}
+ if (do_system_halt) {
+ struct passwd *pwent;
+
+ do_system_halt = FALSE;
+ g_free (login_user);
+ login_user = NULL;
+
+ if (!gdm_daemon_config_get_value_bool (GDM_KEY_SECURE_SHUTDOWN) ||
+ get_root_auth (_("You must authenticate as root to shut down."), &pwent)) {
+ exit_code_to_use = DISPLAY_HALT;
+ term_quit ();
+ } else if (do_timed_login) {
+ break;
+ }
+
+ continue;
+ }
+
+ if (do_system_reboot) {
+ struct passwd *pwent;
+
+ do_system_reboot = FALSE;
+ g_free (login_user);
+ login_user = NULL;
+
+ if (!gdm_daemon_config_get_value_bool (GDM_KEY_SECURE_SHUTDOWN) ||
+ get_root_auth (_("You must authenticate as root to restart the computer."), &pwent)) {
+ exit_code_to_use = DISPLAY_REBOOT;
+ term_quit ();
+ } else if (do_timed_login) {
+ break;
+ }
+
+ continue;
+ }
+
+
/* The user timed out into a timed login during the
* conversation */
if (do_timed_login) {
@@ -5519,6 +5576,14 @@ check_for_interruption (const char *msg)
/* Not interrupted, continue reading input,
* just proxy this to the master server */
return TRUE;
+ case GDM_INTERRUPT_HALT:
+ if (d->attached)
+ do_system_halt = TRUE;
+ break;
+ case GDM_INTERRUPT_REBOOT:
+ if (d->attached)
+ do_system_reboot = TRUE;
+ break;
case GDM_INTERRUPT_LOGIN_SOUND:
if (d->attached &&
! play_login_sound (gdm_daemon_config_get_value_string (GDM_KEY_SOUND_ON_LOGIN_FILE))) {
@@ -5975,6 +6040,8 @@ gdm_slave_action_pending (void)
{
if (do_timed_login ||
do_configurator ||
+ do_system_halt ||
+ do_system_reboot ||
do_restart_greeter ||
do_cancel)
return FALSE;
@@ -6258,6 +6325,8 @@ gdm_slave_handle_notify (const char *msg
remanage_asap = TRUE;
}
}
+ } else if (sscanf (msg, GDM_NOTIFY_SECURE_SHUTDOWN " %d", &val) == 1) {
+ gdm_daemon_config_set_value_bool (GDM_KEY_SECURE_SHUTDOWN, val);
}
}
diff -upr gdm-2.19.7-pre/gui/gdmlogin.c gdm-2.19.7-post/gui/gdmlogin.c
--- gdm-2.19.7-pre/gui/gdmlogin.c 2007-09-14 00:07:36.000000000 -0500
+++ gdm-2.19.7-post/gui/gdmlogin.c 2007-09-14 00:07:32.000000000 -0500
@@ -692,12 +692,15 @@ gdm_run_gdmconfig (GtkWidget *w, gpointe
static void
gdm_login_restart_handler (void)
{
- if (gdm_wm_warn_dialog (
- _("Are you sure you want to restart the computer?"), "",
- _("_Restart"), NULL, TRUE) == GTK_RESPONSE_YES) {
-
- gdm_kill_thingies ();
- _exit (DISPLAY_REBOOT);
+ if (!gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN)) {
+ if (gdm_wm_warn_dialog (_("Are you sure you want to restart the computer?"), "",
+ _("_Restart"), NULL, TRUE) == GTK_RESPONSE_YES) {
+ gdm_kill_thingies ();
+ _exit (DISPLAY_REBOOT);
+ }
+ } else {
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_REBOOT);
+ fflush (stdout);
}
}
@@ -721,12 +724,15 @@ gdm_custom_cmd_handler (GtkWidget *widge
static void
gdm_login_halt_handler (void)
{
- if (gdm_wm_warn_dialog (
- _("Are you sure you want to Shut Down the computer?"), "",
- _("Shut _Down"), NULL, TRUE) == GTK_RESPONSE_YES) {
-
- gdm_kill_thingies ();
- _exit (DISPLAY_HALT);
+ if (!gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN)) {
+ if (gdm_wm_warn_dialog (_("Are you sure you want to Shut Down the computer?"), "",
+ _("Shut _Down"), NULL, TRUE) == GTK_RESPONSE_YES) {
+ gdm_kill_thingies ();
+ _exit (DISPLAY_HALT);
+ }
+ } else {
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_HALT);
+ fflush (stdout);
}
}
@@ -740,11 +746,14 @@ gdm_login_use_chooser_handler (void)
static void
gdm_login_suspend_handler (void)
{
- if (gdm_wm_warn_dialog (
- _("Are you sure you want to suspend the computer?"), "",
- _("_Suspend"), NULL, TRUE) == GTK_RESPONSE_YES) {
-
- /* suspend interruption */
+ if (!gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN)) {
+ if (gdm_wm_warn_dialog (_("Are you sure you want to suspend the computer?"), "",
+ _("_Suspend"), NULL, TRUE) == GTK_RESPONSE_YES) {
+ /* suspend interruption */
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_SUSPEND);
+ fflush (stdout);
+ }
+ } else {
printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_SUSPEND);
fflush (stdout);
}
@@ -2913,6 +2922,7 @@ gdm_read_config (void)
gdm_config_get_bool (GDM_KEY_TITLE_BAR);
gdm_config_get_bool (GDM_KEY_ADD_GTK_MODULES);
gdm_config_get_bool (GDM_KEY_SHOW_DOMAIN);
+ gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN);
/* Keys not to include in reread_config */
gdm_config_get_bool (GDM_KEY_LOCK_POSITION);
@@ -2996,6 +3006,7 @@ gdm_reread_config (int sig, gpointer dat
gdm_config_reload_bool (GDM_KEY_TIMED_LOGIN_ENABLE) ||
gdm_config_reload_bool (GDM_KEY_TITLE_BAR) ||
gdm_config_reload_bool (GDM_KEY_SHOW_DOMAIN) ||
+ gdm_config_reload_bool (GDM_KEY_SECURE_SHUTDOWN) ||
gdm_config_reload_bool (GDM_KEY_ADD_GTK_MODULES)) {
/* Set busy cursor */
diff -upr gdm-2.19.7-pre/gui/greeter/greeter.c gdm-2.19.7-post/gui/greeter/greeter.c
--- gdm-2.19.7-pre/gui/greeter/greeter.c 2007-09-14 00:07:36.000000000 -0500
+++ gdm-2.19.7-post/gui/greeter/greeter.c 2007-09-14 00:07:32.000000000 -0500
@@ -982,6 +982,7 @@ gdm_read_config (void)
gdm_config_get_bool (GDM_KEY_SHOW_DOMAIN);
gdm_config_get_bool (GDM_KEY_ADD_GTK_MODULES);
gdm_config_get_bool (GDM_KEY_BROWSER);
+ gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN);
/* Keys for custom commands */
for (i = 0; i < GDM_CUSTOM_COMMAND_MAX; i++) {
@@ -1071,6 +1072,7 @@ greeter_reread_config (int sig, gpointer
gdm_config_reload_bool (GDM_KEY_ALLOW_REMOTE_ROOT) ||
gdm_config_reload_bool (GDM_KEY_SHOW_DOMAIN) ||
gdm_config_reload_bool (GDM_KEY_ADD_GTK_MODULES) ||
+ gdm_config_reload_bool (GDM_KEY_SECURE_SHUTDOWN) ||
gdm_config_reload_bool (GDM_KEY_BROWSER)) {
/* Set busy cursor */
diff -upr gdm-2.19.7-pre/gui/greeter/greeter_item.c gdm-2.19.7-post/gui/greeter/greeter_item.c
--- gdm-2.19.7-pre/gui/greeter/greeter_item.c 2007-09-14 00:07:36.000000000 -0500
+++ gdm-2.19.7-post/gui/greeter/greeter_item.c 2007-09-14 00:07:32.000000000 -0500
@@ -214,15 +214,15 @@ greeter_item_is_visible (GreeterItemInfo
strcmp (info->show_type, "system") == 0)
return FALSE;
- if (( ! sysmenu || ! GdmHaltFound) &&
+ if (( ! sysmenu || ! GdmHaltFound || !gdm_common_is_action_available ("HALT")) &&
(info->show_type != NULL &&
strcmp (info->show_type, "halt") == 0))
return FALSE;
- if (( ! sysmenu || ! GdmRebootFound) &&
+ if (( ! sysmenu || ! GdmRebootFound || !gdm_common_is_action_available ("REBOOT")) &&
(info->show_type != NULL &&
strcmp (info->show_type, "reboot") == 0))
return FALSE;
- if (( ! sysmenu || ! GdmSuspendFound) &&
+ if (( ! sysmenu || ! GdmSuspendFound || !gdm_common_is_action_available ("SUSPEND")) &&
(info->show_type != NULL &&
strcmp (info->show_type, "suspend") == 0))
return FALSE;
diff -upr gdm-2.19.7-pre/gui/greeter/greeter_system.c gdm-2.19.7-post/gui/greeter/greeter_system.c
--- gdm-2.19.7-pre/gui/greeter/greeter_system.c 2007-08-27 11:07:52.000000000 -0500
+++ gdm-2.19.7-post/gui/greeter/greeter_system.c 2007-09-14 00:07:32.000000000 -0500
@@ -77,10 +77,15 @@ bin_exists (const char *command)
static void
query_greeter_restart_handler (void)
{
- if (gdm_wm_warn_dialog (_("Are you sure you want to restart the computer?"), "",
- _("_Restart"), NULL, TRUE) == GTK_RESPONSE_YES) {
- _exit (DISPLAY_REBOOT);
- }
+ if (!gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN)) {
+ if (gdm_wm_warn_dialog (_("Are you sure you want to restart the computer?"), "",
+ _("_Restart"), NULL, TRUE) == GTK_RESPONSE_YES) {
+ _exit (DISPLAY_REBOOT);
+ }
+ } else {
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_REBOOT);
+ fflush (stdout);
+ }
}
static void
@@ -101,27 +106,42 @@ query_greeter_custom_cmd_handler (GtkWid
static void
query_greeter_halt_handler (void)
{
- if (gdm_wm_warn_dialog (_("Are you sure you want to Shut Down the computer?"), "",
- _("Shut _Down"), NULL, TRUE) == GTK_RESPONSE_YES) {
- _exit (DISPLAY_HALT);
- }
+ if (!gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN)) {
+ if (gdm_wm_warn_dialog (_("Are you sure you want to Shut Down the computer?"), "",
+ _("Shut _Down"), NULL, TRUE) == GTK_RESPONSE_YES) {
+ _exit (DISPLAY_HALT);
+ }
+ } else {
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_HALT);
+ fflush (stdout);
+ }
}
static void
query_greeter_suspend_handler (void)
{
- if (gdm_wm_warn_dialog (_("Are you sure you want to suspend the computer?"), "",
- _("_Suspend"), NULL, TRUE) == GTK_RESPONSE_YES) {
- /* suspend interruption */
- printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_SUSPEND);
- fflush (stdout);
- }
+ if (!gdm_config_get_bool (GDM_KEY_SECURE_SHUTDOWN)) {
+ if (gdm_wm_warn_dialog (_("Are you sure you want to suspend the computer?"), "",
+ _("_Suspend"), NULL, TRUE) == GTK_RESPONSE_YES) {
+ /* suspend interruption */
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_SUSPEND);
+ fflush (stdout);
+ }
+ } else {
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_SUSPEND);
+ fflush (stdout);
+ }
}
static void
greeter_restart_handler (void)
{
- _exit (DISPLAY_REBOOT);
+ if (GDM_KEY_SECURE_SHUTDOWN) {
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_REBOOT);
+ fflush (stdout);
+ } else {
+ _exit (DISPLAY_REBOOT);
+ }
}
static void
@@ -134,7 +154,12 @@ greeter_custom_cmd_handler (gint cmd_id)
static void
greeter_halt_handler (void)
{
- _exit (DISPLAY_HALT);
+ if (GDM_KEY_SECURE_SHUTDOWN) {
+ printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_HALT);
+ fflush (stdout);
+ } else {
+ _exit (DISPLAY_HALT);
+ }
}
static void
@@ -342,7 +367,7 @@ greeter_system_handler (GreeterItemInfo
vbox,
TRUE, TRUE, 0);
- if (GdmHaltFound) {
+ if (GdmHaltFound && gdm_common_is_action_available ("HALT")) {
if (group_radio != NULL)
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (group_radio));
halt_radio = gtk_radio_button_new_with_mnemonic (radio_group,
@@ -360,7 +385,7 @@ greeter_system_handler (GreeterItemInfo
gtk_widget_show (halt_radio);
}
- if (GdmRebootFound) {
+ if (GdmRebootFound && gdm_common_is_action_available ("REBOOT")) {
if (group_radio != NULL)
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (group_radio));
restart_radio = gtk_radio_button_new_with_mnemonic (radio_group,
@@ -404,7 +429,7 @@ greeter_system_handler (GreeterItemInfo
}
}
- if (GdmSuspendFound) {
+ if (GdmSuspendFound && gdm_common_is_action_available ("SUSPEND")) {
if (group_radio != NULL)
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (group_radio));
suspend_radio = gtk_radio_button_new_with_mnemonic (radio_group,