[Pkg-shadow-commits] r2184 - in upstream/trunk: . libmisc

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sun Jun 15 00:01:52 UTC 2008


Author: nekral-guest
Date: 2008-06-15 00:01:46 +0000 (Sun, 15 Jun 2008)
New Revision: 2184

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/failure.c
Log:
	* libmisc/failure.c: Ignore the return value of strftime() and
	printf().
	* libmisc/failure.c: Fix syslog call. The UID is not available.
	User the username specified in the utmp/utmpx entry.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-06-14 23:41:38 UTC (rev 2183)
+++ upstream/trunk/ChangeLog	2008-06-15 00:01:46 UTC (rev 2184)
@@ -1,5 +1,12 @@
 2008-06-15  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/failure.c: Ignore the return value of strftime() and
+	printf().
+	* libmisc/failure.c: Fix syslog call. The UID is not available.
+	User the username specified in the utmp/utmpx entry.
+
+2008-06-15  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* lib/defines.h: Avoid implicit conversion of pointers to
 	booleans.
 	* lib/defines.h: Ignore return values of setlocale() except the

Modified: upstream/trunk/libmisc/failure.c
===================================================================
--- upstream/trunk/libmisc/failure.c	2008-06-14 23:41:38 UTC (rev 2183)
+++ upstream/trunk/libmisc/failure.c	2008-06-15 00:01:46 UTC (rev 2184)
@@ -250,7 +250,7 @@
 	/*
 	 * Print all information we have.
 	 */
-	strftime (lasttimeb, sizeof lasttimeb, "%c", tp);
+	(void) strftime (lasttimeb, sizeof lasttimeb, "%c", tp);
 #else
 
 	/*
@@ -271,12 +271,12 @@
 		lasttime++;
 	}
 #endif
-	printf (ngettext ("%d failure since last login.\n"
-	                  "Last was %s on %s.\n",
-	                  "%d failures since last login.\n"
-	                  "Last was %s on %s.\n",
-	                  (unsigned long) fail->fail_cnt),
-	        fail->fail_cnt, lasttime, fail->fail_line);
+	(void) printf (ngettext ("%d failure since last login.\n"
+	                         "Last was %s on %s.\n",
+	                         "%d failures since last login.\n"
+	                         "Last was %s on %s.\n",
+	                         (unsigned long) fail->fail_cnt),
+	               fail->fail_cnt, lasttime, fail->fail_line);
 }
 
 /*
@@ -318,9 +318,13 @@
 
 	fd = open (ftmp, O_WRONLY | O_APPEND);
 	if (-1 == fd) {
+		char ut_user[sizeof failent->ut_user];
+		(void) strncpy (&ut_user[0], failent->ut_user, sizeof ut_user);
+		ut_user[sizeof ut_user - 1] = '\0';
+
 		SYSLOG ((LOG_WARN,
-		         "Can't append failure of UID %lu to %s.",
-		         (unsigned long) uid, ftmp));
+		         "Can't append failure of user %s to %s.",
+		         ut_user, ftmp));
 		return;
 	}
 
@@ -330,9 +334,13 @@
 
 	if (   (write (fd, (const void *) failent, sizeof *failent) != (ssize_t) sizeof *failent)
 	    || (close (fd) != 0)) {
+		char ut_user[sizeof failent->ut_user];
+		(void) strncpy (&ut_user[0], failent->ut_user, sizeof ut_user);
+		ut_user[sizeof ut_user - 1] = '\0';
+
 		SYSLOG ((LOG_WARN,
-		         "Can't append failure of UID %lu to %s.",
-		         (unsigned long) uid, ftmp));
+		         "Can't append failure of user %s to %s.",
+		         ut_user, ftmp));
 	}
 }
 




More information about the Pkg-shadow-commits mailing list