--- gdm-2.32.0/data/gdm.schemas.in.in-orig	2010-09-28 15:44:14.832286965 -0500
+++ gdm-2.32.0/data/gdm.schemas.in.in	2010-09-28 15:46:08.634572870 -0500
@@ -47,6 +47,11 @@
       <signature>i</signature>
       <default>30</default>
     </schema>
+    <schema>
+      <key>daemon/PamService</key>
+      <signature>s</signature>
+      <default>gdm</default>
+    </schema>
 
     <schema>
       <key>debug/Enable</key>
--- gdm-2.32.0/common/gdm-settings-keys.h-orig	2010-09-28 15:44:04.818052668 -0500
+++ gdm-2.32.0/common/gdm-settings-keys.h	2010-09-28 15:45:50.765986480 -0500
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
 #define GDM_KEY_GROUP "daemon/Group"
 #define GDM_KEY_AUTO_LOGIN_ENABLE "daemon/AutomaticLoginEnable"
 #define GDM_KEY_AUTO_LOGIN_USER "daemon/AutomaticLogin"
+#define GDM_KEY_PAM_SERVICE "daemon/PamService"
 #define GDM_KEY_TIMED_LOGIN_ENABLE "daemon/TimedLoginEnable"
 #define GDM_KEY_TIMED_LOGIN_USER "daemon/TimedLogin"
 #define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay"
--- gdm-2.32.0/daemon/gdm-slave.c-orig	2010-09-28 15:43:54.339306817 -0500
+++ gdm-2.32.0/daemon/gdm-slave.c	2010-09-28 15:45:05.910009548 -0500
@@ -48,6 +48,8 @@
 #include <X11/Xatom.h>
 
 #include "gdm-common.h"
+#include "gdm-settings-direct.h"
+#include "gdm-settings-keys.h"
 #include "gdm-xerrors.h"
 
 #include "gdm-slave.h"
@@ -943,37 +945,35 @@ gdm_slave_add_user_authorization (GdmSla
 }
 
 static char *
-gdm_slave_parse_enriched_login (GdmSlave   *slave,
-                                const char *username,
-                                const char *display_name)
+gdm_slave_parse_enriched_value (GdmSlave   *slave,
+                                const char *value)
 {
         char     **argv;
-        int        username_len;
+        int        value_len;
         GPtrArray *env;
         GError    *error;
         gboolean   res;
-        char      *parsed_username;
+        char      *parsed_value;
         char      *command;
         char      *std_output;
         char      *std_error;
 
-        parsed_username = NULL;
+        parsed_value = NULL;
 
-        if (username == NULL || username[0] == '\0') {
+        if (value == NULL || value[0] == '\0') {
                 return NULL;
         }
 
-        /* A script may be used to generate the automatic/timed login name
-           based on the display/host by ending the name with the pipe symbol
-           '|'. */
-
-        username_len = strlen (username);
-        if (username[username_len - 1] != '|') {
-                return g_strdup (username);
+        /* Some keys that end with '|' can cause a script to be run to get
+         * the value based on display/host/etc. */
+
+        value_len = strlen (value);
+        if (value[value_len - 1] != '|') {
+                return g_strdup (value);
         }
 
         /* Remove the pipe symbol */
-        command = g_strndup (username, username_len - 1);
+        command = g_strndup (value, value_len - 1);
 
         argv = NULL;
         error = NULL;
@@ -985,7 +985,7 @@ gdm_slave_parse_enriched_login (GdmSlave
                 goto out;
         }
 
-        g_debug ("GdmSlave: running '%s' to acquire auto/timed username", command);
+        g_debug ("GdmSlave: running '%s' to acquire value", command);
         g_free (command);
 
         env = get_script_environment (slave, NULL);
@@ -1009,7 +1009,7 @@ gdm_slave_parse_enriched_login (GdmSlave
         g_strfreev (argv);
 
         if (! res) {
-                g_warning ("GdmSlave: Unable to launch auto/timed login script '%s': %s", username, error->message);
+                g_warning ("GdmSlave: Unable to launch script '%s': %s", value, error->message);
                 g_error_free (error);
 
                 g_free (std_output);
@@ -1020,13 +1020,55 @@ gdm_slave_parse_enriched_login (GdmSlave
         if (std_output != NULL) {
                 g_strchomp (std_output);
                 if (std_output[0] != '\0') {
-                        parsed_username = g_strdup (std_output);
+                        parsed_value = g_strdup (std_output);
                 }
         }
 
  out:
 
-        return parsed_username;
+        return parsed_value;
+}
+
+char *
+gdm_slave_get_pam_service (GdmSlave *slave,
+                           gboolean is_autologin)
+{
+        char *pam_service;
+        char *temp;
+
+        pam_service = NULL;
+        temp = NULL;
+
+        gdm_settings_direct_get_string (GDM_KEY_PAM_SERVICE,
+                                        &temp);
+
+        if (temp != NULL) {
+                g_debug ("GdmSlave: PAM service name configuration value: %s",
+                         temp);
+                pam_service = gdm_slave_parse_enriched_value (slave, temp);
+        }
+        g_free (temp);
+
+        if (pam_service == NULL) {
+                /* Default values */
+                if (is_autologin) {
+                        pam_service = g_strdup ("gdm-autologin");
+                } else {
+                        pam_service = g_strdup ("gdm");
+                }
+        } else {
+                /* append "-autologin" to PAM service name if using autologin */
+                if (is_autologin) {
+                        char *temp;
+
+                        temp = g_strdup_printf ("%s-autologin", pam_service);
+                        g_free (pam_service);
+                        pam_service = temp;
+                }
+        }
+
+        g_debug ("Using PAM service name %s", pam_service);
+        return pam_service;
 }
 
 gboolean
@@ -1070,9 +1112,8 @@ gdm_slave_get_timed_login_details (GdmSl
         }
 
         if (usernamep != NULL) {
-                *usernamep = gdm_slave_parse_enriched_login (slave,
-                                                             username,
-                                                             slave->priv->display_name);
+                *usernamep = gdm_slave_parse_enriched_value (slave,
+                                                             username);
         } else {
                 g_free (username);
 
--- gdm-2.32.0/daemon/gdm-simple-slave.c-orig	2010-09-28 15:43:27.226261134 -0500
+++ gdm-2.32.0/daemon/gdm-simple-slave.c	2010-09-28 15:45:05.909777279 -0500
@@ -593,10 +593,14 @@ on_session_conversation_started (GdmSess
         if (slave->priv->greeter_server != NULL) {
                 gdm_greeter_server_request_timed_login (slave->priv->greeter_server, username, delay);
         } else {
+                char *pam_service;
+
                 g_debug ("GdmSimpleSlave: begin auto login for user '%s'", username);
+
+                pam_service = gdm_slave_get_pam_service (GDM_SLAVE (slave), TRUE);
                 gdm_session_setup_for_user (GDM_SESSION (slave->priv->session),
-                                            "gdm-autologin",
-                                            username);
+                                            pam_service, username);
+                g_free (pam_service);
         }
 
         g_free (username);
@@ -889,9 +893,13 @@ static void
 on_greeter_begin_verification (GdmGreeterServer *greeter_server,
                                GdmSimpleSlave   *slave)
 {
+        char *pam_service;
+
         g_debug ("GdmSimpleSlave: begin verification");
-        gdm_session_setup (GDM_SESSION (slave->priv->session),
-                           "gdm");
+
+        pam_service = gdm_slave_get_pam_service (GDM_SLAVE (slave), FALSE);
+        gdm_session_setup (GDM_SESSION (slave->priv->session), pam_service);
+        g_free (pam_service);
 }
 
 static void
@@ -899,10 +907,14 @@ on_greeter_begin_auto_login (GdmGreeterS
                              const char       *username,
                              GdmSimpleSlave   *slave)
 {
+        char *pam_service;
+
         g_debug ("GdmSimpleSlave: begin auto login for user '%s'", username);
+
+        pam_service = gdm_slave_get_pam_service (GDM_SLAVE (slave), TRUE);
         gdm_session_setup_for_user (GDM_SESSION (slave->priv->session),
-                                    "gdm-autologin",
-                                    username);
+                                    pam_service, username);
+        g_free (pam_service);
 }
 
 static void
@@ -910,10 +922,14 @@ on_greeter_begin_verification_for_user (
                                         const char       *username,
                                         GdmSimpleSlave   *slave)
 {
+        char *pam_service;
+
         g_debug ("GdmSimpleSlave: begin verification");
+
+        pam_service = gdm_slave_get_pam_service (GDM_SLAVE (slave), FALSE);
         gdm_session_setup_for_user (GDM_SESSION (slave->priv->session),
-                                    "gdm",
-                                    username);
+                                    pam_service, username);
+        g_free (pam_service);
 }
 
 static void
--- gdm-2.32.0/daemon/gdm-factory-slave.c-orig	2010-09-28 15:43:46.654247696 -0500
+++ gdm-2.32.0/daemon/gdm-factory-slave.c	2010-09-28 15:45:05.909572158 -0500
@@ -396,9 +396,14 @@ static void
 on_greeter_begin_verification (GdmGreeterServer *greeter_server,
                                GdmFactorySlave  *slave)
 {
+        char *pam_service;
+
         g_debug ("GdmFactorySlave: begin verification");
+
+        pam_service = gdm_slave_get_pam_service (GDM_SLAVE (slave), FALSE);
         gdm_session_setup (GDM_SESSION (slave->priv->session),
-                           "gdm");
+                           pam_service);
+        g_free (pam_service);
 }
 
 static void
@@ -406,10 +411,14 @@ on_greeter_begin_verification_for_user (
                                         const char       *username,
                                         GdmFactorySlave  *slave)
 {
+        char *pam_service;
+
         g_debug ("GdmFactorySlave: begin verification for user");
+
+        pam_service = gdm_slave_get_pam_service (GDM_SLAVE (slave), FALSE);
         gdm_session_setup_for_user (GDM_SESSION (slave->priv->session),
-                                    "gdm",
-                                    username);
+                                    pam_service, username);
+        g_free (pam_service);
 }
 
 static void
--- gdm-2.32.0/daemon/gdm-slave.h-orig	2010-09-28 15:43:36.891148076 -0500
+++ gdm-2.32.0/daemon/gdm-slave.h	2010-09-28 15:45:08.292835757 -0500
@@ -80,6 +80,8 @@ void                gdm_slave_set_busy_c
 gboolean            gdm_slave_run_script             (GdmSlave   *slave,
                                                       const char *dir,
                                                       const char *username);
+char *              gdm_slave_get_pam_service        (GdmSlave   *slave,
+                                                      gboolean    is_autologin);
 void                gdm_slave_stopped                (GdmSlave   *slave);
 void                gdm_slave_set_console_session_id (GdmSlave   *slave,
                                                       const char *session_id);
