diff -Nru gdm3-3.28.2/debian/changelog gdm3-3.28.2/debian/changelog --- gdm3-3.28.2/debian/changelog 2018-06-05 10:58:41.000000000 +0000 +++ gdm3-3.28.2/debian/changelog 2018-06-13 12:04:30.000000000 +0000 @@ -1,3 +1,10 @@ +gdm3 (3.28.2-0ubuntu1.3) bionic; urgency=medium + + * debian/patches/daemon-gdm-session-record.c-open-close-the-utmp-database.patch: + - Keep the number of logged-in consistent with reality (LP: #1776487) + + -- Marco Trevisan (TreviƱo) Wed, 13 Jun 2018 13:04:30 +0100 + gdm3 (3.28.2-0ubuntu1.2) bionic; urgency=medium * debian/patches/libgdm-drop-support-for-serializing-multiple-opens.patch, diff -Nru gdm3-3.28.2/debian/patches/daemon-gdm-session-record.c-open-close-the-utmp-database.patch gdm3-3.28.2/debian/patches/daemon-gdm-session-record.c-open-close-the-utmp-database.patch --- gdm3-3.28.2/debian/patches/daemon-gdm-session-record.c-open-close-the-utmp-database.patch 1970-01-01 00:00:00.000000000 +0000 +++ gdm3-3.28.2/debian/patches/daemon-gdm-session-record.c-open-close-the-utmp-database.patch 2018-06-13 12:04:30.000000000 +0000 @@ -0,0 +1,43 @@ +From: Jason Pleau +Date: Wed, 30 May 2018 21:48:22 -0400 +Subject: daemon/gdm-session-record.c: open/close the utmp database + +pututxline() was used without first opening the utxmp database and +without closing it, preventing the logout entry from being fully +committed. + +This caused the number of logged-in users to increment after each login, +as logging out did not correctly remove the user login record from utmp. + +This commit wraps pututxline() between setutxent() and endutxent(), +making sure that the login/logout operation are fully flushed. + +Fixes #381 +--- + daemon/gdm-session-record.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c +index 487f100..d2df588 100644 +--- a/daemon/gdm-session-record.c ++++ b/daemon/gdm-session-record.c +@@ -213,7 +213,9 @@ gdm_session_record_login (GPid session_pid, + /* Handle utmp */ + #if defined(HAVE_GETUTXENT) + g_debug ("Adding or updating utmp record for login"); ++ setutxent(); + pututxline (&session_record); ++ endutxent(); + #elif defined(HAVE_LOGIN) + login (&session_record); + #endif +@@ -256,7 +258,9 @@ gdm_session_record_logout (GPid session_pid, + /* Handle utmp */ + #if defined(HAVE_GETUTXENT) + g_debug ("Adding or updating utmp record for logout"); ++ setutxent(); + pututxline (&session_record); ++ endutxent(); + #elif defined(HAVE_LOGOUT) + logout (session_record.ut_line); + #endif diff -Nru gdm3-3.28.2/debian/patches/series gdm3-3.28.2/debian/patches/series --- gdm3-3.28.2/debian/patches/series 2018-06-05 10:58:41.000000000 +0000 +++ gdm3-3.28.2/debian/patches/series 2018-06-13 12:04:30.000000000 +0000 @@ -11,6 +11,7 @@ libgdb-Try-to-reuse-connections-from-the-available-proxie.patch libgdm-Don-t-save-manager-address.patch libgdm-Return-NULL-on-invalid-client-instances.patch +daemon-gdm-session-record.c-open-close-the-utmp-database.patch 16_xserver_path.patch 90_config_comments.patch 91_dconf_database_path.patch