]> granicus.if.org Git - shadow/commitdiff
* libmisc/utmp.c: Always call endutent or endutxent when setutent
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 19 Apr 2009 15:28:38 +0000 (15:28 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 19 Apr 2009 15:28:38 +0000 (15:28 +0000)
or setutxent were used.

ChangeLog
libmisc/utmp.c

index f99b651fae11b6f5d530b79ac5e0ca935bf8231d..02f6236df44c7fea47068adf49c4929162018227 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-19  Paul Szabo  <psz@maths.usyd.edu.au>
+
+       * libmisc/utmp.c: Always call endutent or endutxent when setutent
+       or setutxent were used.
+
 2009-04-19  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/login.c: Added comment to make sure PAM_RHOST or PAM_TTY do
index 409a16d60b6401bb47d96d2649147508bac187bf..0c7a5d143251fa9ba8982bf4565d5e2e5c66a096 100644 (file)
@@ -148,6 +148,8 @@ void checkutmp (bool picky)
 
        /* Sanitize / set the ut_line field */
        strncpy (utent.ut_line, line, sizeof utent.ut_line);
+
+       endutent ();
 }
 
 #elif defined(LOGIN_PROCESS)
@@ -269,6 +271,11 @@ void checkutmp (bool picky)
                utent.ut_time = utxent.ut_tv.tv_sec;
 #endif
        }
+
+#if HAVE_UTMPX_H
+       endutxent ();
+#endif
+       endutent ();
 }
 
 #endif
@@ -442,6 +449,9 @@ int setutmp (const char *name, const char *line, const char *host)
        utxent = utxline;
        utent = utline;
 
+       endutxent ();
+       endutent ();
+
        return err;
 }