17797N/Acommit c7a1ad4850e394260cb61582aeefae8f95c3cae8
17595N/AAuthor: Halton Huo <halton.huo@sun.com>
17797N/ADate: Fri Nov 27 22:01:20 2009 +0800
20788N/A #define GDM_CUSTOM_SESSION "custom"
17797N/A@@ -646,6 +646,13 @@ gdm_server_spawn (GdmServer *server,
17797N/A+ /* Remove old communication pipe, if present */
17797N/A+ old_pipe = g_strdup_printf ("%s/%d", GDM_SDTLOGIN_DIR, display_num);
17089N/A env = get_server_environment (server);
17089N/A #define GDM_SESSION_WORKER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SESSION_WORKER, GdmSessionWorkerPrivate))
20839N/A@@ -151,12 +159,115 @@ static void gdm_session_worker_final
17089N/A static void queue_state_change (GdmSessionWorker *worker);
17089N/A typedef int (* GdmSessionWorkerPamNewMessagesFunc) (int,
17089N/A+ GDM_PAM_QUAL struct pam_message **,
17089N/A G_DEFINE_TYPE (GdmSessionWorker, gdm_session_worker, G_TYPE_OBJECT)
17089N/A+solaris_xserver_cred (char * username, struct passwd *passwd_entry, const char *x11_display_name)
17089N/A+ char *home, *disp, *tmp, *p, pipe[MAXPATHLEN], info[MAXPATHLEN];
17089N/A+ if (g_access (passwd_entry->pw_dir, F_OK) != 0) {
17089N/A+ g_debug ("solaris_xserver_cred: no HOME dir access\n");
17089N/A+ * Handshake with server. Make sure it created a pipe.
17089N/A+ if ((tmp = strstr (x11_display_name, ":")) != NULL) {
17089N/A+ display_number = g_ascii_strtod (tmp, &p);
17089N/A+ g_debug ("solaris_xserver_cred: problem getting display number\n");
17089N/A+ sprintf (pipe, "%s/%d", GDM_SDTLOGIN_DIR, display_number);
17089N/A+ if (g_stat (GDM_SDTLOGIN_DIR, &statbuf) == 0) {
17089N/A+ g_debug ("solaris_xserver_cred: %s is not a directory\n",
17089N/A+ g_debug ("solaris_xserver_cred: %s does not exist\n", GDM_SDTLOGIN_DIR);
17089N/A+ g_debug ("solaris_xserver_cred: could not open %s\n", pipe);
17089N/A+ if (fstat (fd, &statbuf) == 0 ) {
17089N/A+ g_debug ("solaris_xserver_cred: %s is not a pipe\n", pipe);
17089N/A+ g_debug ("solaris_xserver_cred: %s does not exist\n", pipe);
17089N/A+ sprintf (info, "GID=\"%d\"; ", passwd_entry->pw_gid);
17089N/A+ nb = write (fd, info, strlen (info));
17089N/A+ g_debug ("solaris_xserver_cred: %s\n", info);
17089N/A+ if (initgroups (username, passwd_entry->pw_gid) == -1) {
17089N/A+ ngroups = getgroups (NGROUPS_UMAX, groups);
17089N/A+ sprintf (info, "G_LIST_ID=\"%u\" ", groups[i]);
17089N/A+ nb = write (fd, info, strlen (info));
17089N/A+ g_debug ("solaris_xserver_cred: %s\n", info);
17089N/A+ write (fd, info, strlen (info));
17089N/A+ sprintf (info, " HOME=\"%s\" ", passwd_entry->pw_dir);
17089N/A+ nb = write (fd, info, strlen (info));
17089N/A+ g_debug ("solaris_xserver_cred: %s\n", info);
17089N/A+ sprintf (info, " UID=\"%d\" EOF=\"\";", passwd_entry->pw_uid);
17089N/A+ nb = write (fd, info, strlen (info));
17089N/A+ g_debug ("solaris_xserver_cred: %s\n", info);
17089N/A+ * Handshake with server. Make sure it read the pipe.
17089N/A gdm_session_worker_error_quark (void)
20839N/A@@ -591,7 +702,11 @@ static gboolean
17089N/A gdm_session_worker_get_username (GdmSessionWorker *worker,
17089N/A g_assert (worker->priv->pam_handle != NULL);
20839N/A@@ -870,7 +985,7 @@ gdm_session_worker_process_pam_message (
17089N/A gdm_session_worker_pam_new_messages_handler (int number_of_messages,
17089N/A- const struct pam_message **messages,
17089N/A+ GDM_PAM_QUAL struct pam_message **messages,
17089N/A struct pam_response **responses,
20839N/A@@ -1732,6 +1847,12 @@ gdm_session_worker_start_user_session (G
20839N/A g_debug ("GdmSessionWorker: opening user session with program '%s'",
17089N/A+ solaris_xserver_cred (worker->priv->username,
17089N/A+ worker->priv->x11_display_name);
17595N/A@@ -525,6 +525,21 @@ main (int argc,
17089N/A+ r = stat (GDM_DT_DIR, &statbuf);
17089N/A+ g_mkdir (GDM_SDTLOGIN_DIR, 0700);
17089N/A bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);