Index: gdm-2.24.0/daemon/gdm-session-worker.c
===================================================================
--- gdm-2.24.0.orig/daemon/gdm-session-worker.c
+++ gdm-2.24.0/daemon/gdm-session-worker.c
@@ -59,6 +59,8 @@
 #endif
 
 #include "gdm-session-settings.h"
+#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
 
 #define GDM_SESSION_WORKER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SESSION_WORKER, GdmSessionWorkerPrivate))
 
@@ -1277,9 +1279,32 @@ gdm_session_worker_authorize_user (GdmSe
 {
         int error_code;
         int authentication_flags;
+        gboolean allow_root;
 
         g_debug ("GdmSessionWorker: determining if authenticated user is authorized to session");
 
+       gdm_settings_direct_get_boolean (GDM_KEY_ALLOW_ROOT, &allow_root);
+
+       if (!allow_root) {
+               char *username;
+               struct passwd *pwent;
+
+               gdm_session_worker_get_username (worker, &username);
+               if (username) {
+                       pwent = getpwnam (username);
+                       g_free (username);
+
+                       if (pwent && (pwent->pw_uid == GDM_SESSION_ROOT_UID)) {
+                               g_set_error (error,
+                                            GDM_SESSION_WORKER_ERROR,
+                                            GDM_SESSION_WORKER_ERROR_AUTHORIZING,
+                                           "%s", _("System administator is not allowed to login."));
+                               gdm_session_worker_uninitialize_pam (worker, PAM_PERM_DENIED);
+                               return FALSE;
+                       }
+               }
+       }
+
         authentication_flags = 0;
 
         if (password_is_required) {
Index: gdm-2.24.0/common/gdm-settings-keys.h
===================================================================
--- gdm-2.24.0.orig/common/gdm-settings-keys.h
+++ gdm-2.24.0/common/gdm-settings-keys.h
@@ -35,6 +35,7 @@ G_BEGIN_DECLS
 #define GDM_KEY_LOCAL_XSERVER_ENABLE "daemon/LocalXserverEnable"
 #define GDM_KEY_LOCAL_XSERVER_COMMAND "daemon/LocalXserverCommand"
 #define GDM_KEY_DISALLOW_TCP "security/DisallowTCP"
+#define GDM_KEY_ALLOW_ROOT "security/AllowRoot"
 
 #define GDM_KEY_XDMCP_ENABLE "xdmcp/Enable"
 #define GDM_KEY_MAX_PENDING "xdmcp/MaxPending"
Index: gdm-2.24.0/daemon/session-worker-main.c
===================================================================
--- gdm-2.24.0.orig/daemon/session-worker-main.c
+++ gdm-2.24.0/daemon/session-worker-main.c
@@ -43,6 +43,7 @@
 #include "gdm-common.h"
 #include "gdm-log.h"
 #include "gdm-session-worker.h"
+#include "gdm-settings.h"
 
 #define SERVER_DBUS_PATH      "/org/gnome/DisplayManager/SessionServer"
 #define SERVER_DBUS_INTERFACE "org.gnome.DisplayManager.SessionServer"
@@ -131,6 +132,7 @@ main (int    argc,
         GOptionContext   *context;
         GdmSessionWorker *worker;
         GdmSignalHandler *signal_handler;
+	GdmSettings     *settings      = NULL;
         const char       *address;
         static gboolean   debug      = FALSE;
         static GOptionEntry entries []   = {
@@ -155,6 +157,18 @@ main (int    argc,
         gdm_log_init ();
         gdm_log_set_debug (is_debug_set (debug));
 
+        settings = gdm_settings_new ();
+        if (settings == NULL) {
+                g_warning ("Unable to initialize settings");
+                goto out;
+        }
+
+        if (! gdm_settings_direct_init (settings, GDMCONFDIR "/gdm.schemas", "/")) {
+                g_warning ("Unable to initialize settings");
+                goto out;
+        }
+
+
         address = g_getenv ("GDM_SESSION_DBUS_ADDRESS");
         if (address == NULL) {
                 g_warning ("GDM_SESSION_DBUS_ADDRESS not set");
@@ -185,14 +199,21 @@ main (int    argc,
                 g_object_unref (worker);
         }
 
+        if (settings != NULL) {
+                g_object_unref (settings);
+        }
+
         if (signal_handler != NULL) {
                 g_object_unref (signal_handler);
         }
 
+        gdm_settings_direct_shutdown ();
+        gdm_log_shutdown ();
+
         g_main_loop_unref (main_loop);
 
 
         g_debug ("Worker finished");
-
+out:
         return 0;
 }
Index: gdm-2.24.0/data/gdm.schemas.in
===================================================================
--- gdm-2.24.0.orig/data/gdm.schemas.in
+++ gdm-2.24.0/data/gdm.schemas.in
@@ -43,6 +43,12 @@
     </schema>
 
     <schema>
+      <key>security/AllowRoot</key>
+      <signature>b</signature>
+      <default>true</default>
+    </schema>
+
+    <schema>
       <key>security/DisallowTCP</key>
       <signature>b</signature>
       <default>true</default>
Index: gdm-2.24.0/data/gdm.schemas.in.in
===================================================================
--- gdm-2.24.0.orig/data/gdm.schemas.in.in
+++ gdm-2.24.0/data/gdm.schemas.in.in
@@ -54,6 +54,12 @@
     </schema>
 
     <schema>
+      <key>security/AllowRoot</key>
+      <signature>b</signature>
+      <default>true</default>
+    </schema>
+
+    <schema>
       <key>xdmcp/Enable</key>
       <signature>b</signature>
       <default>false</default>
