summaryrefslogtreecommitdiff
path: root/mate-session/gsm-manager.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-07 12:31:25 +0100
committerinfirit <[email protected]>2014-11-07 14:31:51 +0100
commitf3df23785148cb606557e860cf13c93a16a17758 (patch)
treec721a8acb5426419acfb2ae92c6d6bd4fbfe4513 /mate-session/gsm-manager.c
parentb1d7d27360d4e718bad6a0455f796e7b2b7ed0d4 (diff)
downloadmate-session-manager-f3df23785148cb606557e860cf13c93a16a17758.tar.bz2
mate-session-manager-f3df23785148cb606557e860cf13c93a16a17758.tar.xz
gsm: Enforce disable-user-switching lockdown setting
Based on gnome-session commit: 899fe6b1628cd2d86931632f72512bca04d2aeaf From: Vincent Untz <[email protected]>
Diffstat (limited to 'mate-session/gsm-manager.c')
-rw-r--r--mate-session/gsm-manager.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c
index f2b5fd0..e814323 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -176,7 +176,8 @@ static void gsm_manager_class_init (GsmManagerClass *klass);
static void gsm_manager_init (GsmManager *manager);
static void gsm_manager_finalize (GObject *object);
-static gboolean _log_out_is_locked_down (GsmManager *manager);
+static gboolean _log_out_is_locked_down (GsmManager *manager);
+static gboolean _switch_user_is_locked_down (GsmManager *manager);
static void _handle_client_end_session_response (GsmManager *manager,
GsmClient *client,
@@ -1054,6 +1055,14 @@ manager_switch_user (GsmManager *manager)
gboolean res;
char *command;
+ /* We have to do this here and in request_switch_user() because this
+ * function can be called at a later time, not just directly after
+ * request_switch_user(). */
+ if (_switch_user_is_locked_down (manager)) {
+ g_warning ("Unable to switch user: User switching has been locked down");
+ return;
+ }
+
if (is_program_in_path (MDM_FLEXISERVER_COMMAND)) {
/* MDM */
command = g_strdup_printf ("%s %s",
@@ -3113,6 +3122,13 @@ request_switch_user (GsmManager *manager)
{
g_debug ("GsmManager: requesting user switch");
+ /* See comment in manager_switch_user() to understand why we do this in
+ * both functions. */
+ if (_switch_user_is_locked_down (manager)) {
+ g_warning ("Unable to switch user: User switching has been locked down");
+ return;
+ }
+
if (! gsm_manager_is_switch_user_inhibited (manager)) {
manager_switch_user (manager);
return;
@@ -3323,6 +3339,13 @@ _log_out_is_locked_down (GsmManager *manager)
KEY_LOG_OUT_DISABLE);
}
+static gboolean
+_switch_user_is_locked_down (GsmManager *manager)
+{
+ return g_settings_get_boolean (manager->priv->settings_lockdown,
+ KEY_USER_SWITCH_DISABLE);
+}
+
gboolean
gsm_manager_shutdown (GsmManager *manager,
GError **error)