diff -Nru gdm-3.6.0/debian/changelog gdm-3.6.0/debian/changelog --- gdm-3.6.0/debian/changelog 2012-09-29 07:07:39.000000000 +1000 +++ gdm-3.6.0/debian/changelog 2012-10-05 12:24:28.000000000 +1000 @@ -1,3 +1,11 @@ +gdm (3.6.0-0ubuntu4) UNRELEASED; urgency=low + + * debian/patches + - add ubuntu_autologin_logout.patch: Fix logout not working + when autologin is enabled (upstream) (LP: 1061993) + + -- Tim Lunn Fri, 05 Oct 2012 12:23:21 +1000 + gdm (3.6.0-0ubuntu3) quantal; urgency=low * debian/patches diff -Nru gdm-3.6.0/debian/control gdm-3.6.0/debian/control --- gdm-3.6.0/debian/control 2012-09-29 07:07:42.000000000 +1000 +++ gdm-3.6.0/debian/control 2012-10-05 12:32:32.000000000 +1000 @@ -7,7 +7,7 @@ Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian GNOME Maintainers -Uploaders: Debian GNOME Maintainers , Jeremy Bicha , Josselin Mouette , Michael Biebl +Uploaders: Debian GNOME Maintainers , Jeremy Bicha , Josselin Mouette Build-Depends: gnome-pkg-tools (>= 0.16.3), debhelper (>= 8.1.0), cdbs, diff -Nru gdm-3.6.0/debian/patches/series gdm-3.6.0/debian/patches/series --- gdm-3.6.0/debian/patches/series 2012-09-29 07:07:39.000000000 +1000 +++ gdm-3.6.0/debian/patches/series 2012-10-05 12:15:21.000000000 +1000 @@ -19,3 +19,4 @@ ubuntu_xresources_is_a_dir.patch ubuntu_no_LANG_setting_in_Xsession.patch ubuntu_user_switching.patch +ubuntu_autologin_logout.patch diff -Nru gdm-3.6.0/debian/patches/ubuntu_autologin_logout.patch gdm-3.6.0/debian/patches/ubuntu_autologin_logout.patch --- gdm-3.6.0/debian/patches/ubuntu_autologin_logout.patch 1970-01-01 10:00:00.000000000 +1000 +++ gdm-3.6.0/debian/patches/ubuntu_autologin_logout.patch 2012-10-05 12:19:55.000000000 +1000 @@ -0,0 +1,388 @@ +Index: fix-lp1061993/configure.ac +=================================================================== +--- fix-lp1061993.orig/configure.ac 2012-10-05 12:13:08.098793000 +1000 ++++ fix-lp1061993/configure.ac 2012-10-05 12:17:36.820892519 +1000 +@@ -1338,6 +1338,26 @@ + AC_DEFINE_UNQUOTED(GDM_PID_FILE, "$GDM_PID_FILE", [pid file]) + + dnl --------------------------------------------------------------------------- ++dnl - ran once marker ++dnl --------------------------------------------------------------------------- ++ ++AC_ARG_WITH(ran-once-marker-directory, ++ AS_HELP_STRING([--with-ran-once-marker-directory=], ++ [ran once marker directory])) ++ ++if ! test -z "$with_ran_once_marker_directory"; then ++ GDM_RAN_ONCE_MARKER_DIR=$with_ran_once_marker_directory ++else ++ GDM_RAN_ONCE_MARKER_DIR=${localstatedir}/run/gdm ++fi ++AC_SUBST(GDM_RAN_ONCE_MARKER_DIR) ++AC_DEFINE_UNQUOTED(GDM_RAN_ONCE_MARKER_DIR, "$GDM_RAN_ONCE_MARKER_DIR", [ran once marker dir]) ++ ++GDM_RAN_ONCE_MARKER_FILE="$GDM_RAN_ONCE_MARKER_DIR/ran-once-marker" ++AC_SUBST(GDM_RAN_ONCE_MARKER_FILE) ++AC_DEFINE_UNQUOTED(GDM_RAN_ONCE_MARKER_FILE, "$GDM_RAN_ONCE_MARKER_FILE", [ran once marker file]) ++ ++dnl --------------------------------------------------------------------------- + dnl - GREETER WORKING DIRECTORY + dnl --------------------------------------------------------------------------- + +Index: fix-lp1061993/daemon/gdm-simple-slave.c +=================================================================== +--- fix-lp1061993.orig/daemon/gdm-simple-slave.c 2012-10-05 12:13:08.098793000 +1000 ++++ fix-lp1061993/daemon/gdm-simple-slave.c 2012-10-05 12:17:36.820892519 +1000 +@@ -467,8 +467,12 @@ + char *username; + int delay; + ++ g_debug ("GdmSimpleSlave: session conversation started for service %s", service_name); ++ ++ if (g_strcmp0 (service_name, "gdm-autologin") != 0) { ++ return; ++ } + +- g_debug ("GdmSimpleSlave: session conversation started"); + enabled = FALSE; + gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &enabled, &username, &delay); + if (! enabled) { +@@ -499,6 +503,10 @@ + { + gboolean enabled; + ++ if (g_file_test (GDM_RAN_ONCE_MARKER_FILE, G_FILE_TEST_EXISTS)) { ++ return; ++ } ++ + gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &enabled, NULL, NULL); + + if (!enabled) { +@@ -712,6 +720,23 @@ + } + + static void ++touch_marker_file (GdmSimpleSlave *slave) ++{ ++ int fd; ++ ++ fd = g_creat (GDM_RAN_ONCE_MARKER_FILE, 0644); ++ ++ if (fd < 0 && errno != EEXIST) { ++ g_warning ("could not create %s to mark run, this may cause auto login " ++ "to repeat: %m", GDM_RAN_ONCE_MARKER_FILE); ++ return; ++ } ++ ++ fsync (fd); ++ close (fd); ++} ++ ++static void + create_new_session (GdmSimpleSlave *slave) + { + gboolean display_is_local; +@@ -812,6 +837,8 @@ + slave); + + start_autologin_conversation_if_necessary (slave); ++ ++ touch_marker_file (slave); + } + + static void +@@ -1218,6 +1245,10 @@ + int delay = 0; + /* FIXME: handle wait-for-go */ + ++ if (g_file_test (GDM_RAN_ONCE_MARKER_FILE, G_FILE_TEST_EXISTS)) { ++ return FALSE; ++ } ++ + gdm_slave_get_timed_login_details (GDM_SLAVE (slave), &enabled, NULL, &delay); + return enabled && delay == 0; + } +Index: fix-lp1061993/daemon/gdm-static-display.c +=================================================================== +--- fix-lp1061993.orig/daemon/gdm-static-display.c 2012-10-05 12:13:08.098793000 +1000 ++++ fix-lp1061993/daemon/gdm-static-display.c 2012-10-05 12:18:25.860892172 +1000 +@@ -46,7 +46,6 @@ + struct GdmStaticDisplayPrivate + { + GdmDBusStaticDisplay *skeleton; +- gboolean first_login; + }; + + static void gdm_static_display_class_init (GdmStaticDisplayClass *klass); +@@ -117,30 +116,11 @@ + { + g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE); + +- GDM_STATIC_DISPLAY (display)->priv->first_login = FALSE; +- + GDM_DISPLAY_CLASS (gdm_static_display_parent_class)->unmanage (display); + + return TRUE; + } + +-static void +-gdm_static_display_get_timed_login_details (GdmDisplay *display, +- gboolean *enabledp, +- char **usernamep, +- int *delayp) +-{ +- GDM_DISPLAY_CLASS (gdm_static_display_parent_class)->get_timed_login_details (display, enabledp, usernamep, delayp); +- +- if (!GDM_STATIC_DISPLAY (display)->priv->first_login) { +- /* if this is autologin but not timed login, then disable +- * autologin after the first one */ +- if (*enabledp && *delayp == 0) { +- *enabledp = FALSE; +- } +- } +-} +- + static GObject * + gdm_static_display_constructor (GType type, + guint n_construct_properties, +@@ -185,7 +165,6 @@ + display_class->manage = gdm_static_display_manage; + display_class->finish = gdm_static_display_finish; + display_class->unmanage = gdm_static_display_unmanage; +- display_class->get_timed_login_details = gdm_static_display_get_timed_login_details; + + g_type_class_add_private (klass, sizeof (GdmStaticDisplayPrivate)); + } +@@ -195,8 +174,6 @@ + { + + static_display->priv = GDM_STATIC_DISPLAY_GET_PRIVATE (static_display); +- +- static_display->priv->first_login = TRUE; + } + + GdmDisplay * +Index: fix-lp1061993/daemon/main.c +=================================================================== +--- fix-lp1061993.orig/daemon/main.c 2012-10-05 12:13:08.098793000 +1000 ++++ fix-lp1061993/daemon/main.c 2012-10-05 12:19:12.352891847 +1000 +@@ -146,127 +146,65 @@ + } + + static void +-check_logdir (void) ++delete_first_run_marker (void) + { +- struct stat statbuf; +- int r; +- const char *log_path; +- +- log_path = LOGDIR; +- +- r = g_stat (log_path, &statbuf); +- if (r < 0 || ! S_ISDIR (statbuf.st_mode)) { +- if (g_mkdir (log_path, 0755) < 0) { +- gdm_fail (_("Logdir %s does not exist or isn't a directory."), +- log_path); +- } +- g_chmod (log_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); +- } ++ g_unlink (GDM_RAN_ONCE_MARKER_FILE); + } + +-static void +-check_servauthdir (const char *auth_path, +- struct stat *statbuf) ++static gboolean ++ensure_dir_with_perms (const char *path, ++ uid_t uid, ++ gid_t gid, ++ mode_t mode, ++ GError **error) + { +- int r; ++ gboolean ret = FALSE; + +- /* Enter paranoia mode */ +- r = g_stat (auth_path, statbuf); +- if (r < 0) { +- gdm_fail (_("Authdir %s does not exist. Aborting."), auth_path); ++ if (g_mkdir_with_parents (path, 0755) == -1) { ++ g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno), g_strerror (errno)); ++ goto out; + } +- +- if (! S_ISDIR (statbuf->st_mode)) { +- gdm_fail (_("Authdir %s is not a directory. Aborting."), auth_path); ++ if (g_chmod (path, mode) == -1) { ++ g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno), g_strerror (errno)); ++ goto out; + } +-} +- +-static void +-set_effective_user (uid_t uid) +-{ +- int res; +- +- res = 0; +- +- if (geteuid () != uid) { +- res = seteuid (uid); ++ if (chown (path, uid, gid) == -1) { ++ g_set_error_literal (error, G_IO_ERROR, g_io_error_from_errno (errno), g_strerror (errno)); ++ goto out; + } + +- if (res != 0) { +- g_error ("Cannot set uid to %d: %s", +- (int)uid, +- g_strerror (errno)); +- } ++ ret = TRUE; ++ out: ++ return ret; + } + + static void +-set_effective_group (gid_t gid) ++gdm_daemon_ensure_dirs (uid_t uid, ++ gid_t gid) + { +- int res; ++ GError *error = NULL; + +- res = 0; +- if (getegid () != gid) { +- res = setegid (gid); ++ /* Set up /var/run/gdm */ ++ if (!ensure_dir_with_perms (GDM_RAN_ONCE_MARKER_DIR, 0, gid, (S_IRWXU | S_IRWXG), &error)) { ++ gdm_fail (_("Failed to create ran once marker dir %s: %s"), ++ GDM_RAN_ONCE_MARKER_DIR, error->message); + } + +- if (res != 0) { +- g_error ("Cannot set gid to %d: %s", +- (int)gid, +- g_strerror (errno)); ++ /* Set up /var/gdm */ ++ if (!ensure_dir_with_perms (AUTHDIR, uid, gid, (S_IRWXU | S_IRWXG | S_ISVTX), &error)) { ++ gdm_fail (_("Failed to create AuthDir %s: %s"), ++ AUTHDIR, error->message); + } +-} + +-static void +-set_effective_user_group (uid_t uid, +- gid_t gid) +-{ +- set_effective_user (0); +- set_effective_group (gid); +- if (uid != 0) { +- set_effective_user (0); ++ /* Set up /var/log/gdm */ ++ if (!ensure_dir_with_perms (LOGDIR, 0, gid, (S_IRWXU | S_IRWXG | S_ISVTX), &error)) { ++ gdm_fail (_("Failed to create LogDir %s: %s"), ++ LOGDIR, error->message); + } + } + + static void +-gdm_daemon_check_permissions (uid_t uid, +- gid_t gid) +-{ +- struct stat statbuf; +- const char *auth_path; +- +- auth_path = LOGDIR; +- +- /* Enter paranoia mode */ +- check_servauthdir (auth_path, &statbuf); +- +- set_effective_user_group (0, 0); +- +- /* Now set things up for us as */ +- chown (auth_path, 0, gid); +- g_chmod (auth_path, (S_IRWXU|S_IRWXG|S_ISVTX)); +- +- set_effective_user_group (uid, gid); +- +- /* Again paranoid */ +- check_servauthdir (auth_path, &statbuf); +- +- if G_UNLIKELY (statbuf.st_uid != 0 || statbuf.st_gid != gid) { +- gdm_fail (_("Authdir %s is not owned by user %d, group %d. Aborting."), +- auth_path, +- (int)uid, +- (int)gid); +- } +- +- if G_UNLIKELY (statbuf.st_mode != (S_IFDIR|S_IRWXU|S_IRWXG|S_ISVTX)) { +- gdm_fail (_("Authdir %s has wrong permissions %o. Should be %o. Aborting."), +- auth_path, +- statbuf.st_mode, +- (S_IRWXU|S_IRWXG|S_ISVTX)); +- } +-} +- +-static void +-gdm_daemon_change_user (uid_t *uidp, ++gdm_daemon_lookup_user (uid_t *uidp, + gid_t *gidp) + { + char *username; +@@ -316,9 +254,6 @@ + gdm_fail (_("The GDM group should not be root. Aborting!")); + } + +- /* gid remains 'gdm' */ +- set_effective_user_group (uid, gid); +- + if (uidp != NULL) { + *uidp = uid; + } +@@ -416,7 +351,7 @@ + { + GMainLoop *main_loop; + GOptionContext *context; +- GError *error; ++ GError *error = NULL; + int ret; + gboolean res; + GdmSignalHandler *signal_handler; +@@ -480,11 +415,9 @@ + + gdm_log_set_debug (is_debug_set ()); + +- gdm_daemon_change_user (&gdm_uid, &gdm_gid); +- gdm_daemon_check_permissions (gdm_uid, gdm_gid); ++ gdm_daemon_lookup_user (&gdm_uid, &gdm_gid); + +- set_effective_user_group (0, 0); +- check_logdir (); ++ gdm_daemon_ensure_dirs (gdm_uid, gdm_gid); + + /* XDM compliant error message */ + if (getuid () != 0) { +@@ -500,6 +433,9 @@ + delete_pid (); + write_pid (); + ++ /* clean up any stale ran once marker file that may be lingering */ ++ delete_first_run_marker (); ++ + g_chdir (AUTHDIR); + + main_loop = g_main_loop_new (NULL, FALSE); +@@ -535,7 +471,10 @@ + ret = 0; + + out: +- ++ if (error) { ++ g_printerr ("%s\n", error->message); ++ g_clear_error (&error); ++ } + return ret; + } +