--- a/daemon/gdm-simple-slave.c
+++ b/daemon/gdm-simple-slave.c
@@ -429,6 +429,7 @@
 stop_greeter (GdmSimpleSlave *slave)
 {
         char *username;
+        gboolean postlogin_script_exit_code;
 
         g_debug ("GdmSimpleSlave: Stopping greeter");
 
@@ -443,11 +444,26 @@
                 username = gdm_session_direct_get_username (slave->priv->session);
         }
 
+        postlogin_script_exit_code = 0;
         if (username != NULL) {
-                gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PostLogin", username);
+                postlogin_script_exit_code = gdm_slave_run_script (GDM_SLAVE (slave),
+                                                                   GDMCONFDIR "/PostLogin",
+                                                                   username);
         }
         g_free (username);
 
+        if (postlogin_script_exit_code == 1) {
+                g_debug ("GdmSimpleSlave: PostLogin script unsuccessful");
+                if (slave->priv->greeter_server != NULL) {
+                        gdm_greeter_server_problem (slave->priv->greeter_server,
+                                                    slave->priv->start_session_service_name,
+                                                    _("PostLogin script unsuccessful"));
+                }
+                slave->priv->start_session_id = 0;
+                queue_greeter_reset (slave);
+                return;
+        }
+
         gdm_welcome_session_stop (GDM_WELCOME_SESSION (slave->priv->greeter));
 }
 
