[Pkg-shadow-devel] Bug#349560: lastlog: check arguments

Nicolas François nicolas.francois at centraliens.net
Sat Feb 4 19:05:06 UTC 2006


tags 349560 upstream patch
forwarded 349560 Tomasz Kłoczko <kloczek at zie.pg.gda.pl>
thanks

On Mon, Jan 23, 2006 at 10:57:05PM +0800, jidanni at jidanni.org wrote:
> 
> Perhaps die with error instead of ignoring (any=illegal) arguments:
> $ lastlog|sum
> 26395     3
> $ lastlog dfa adfadf|sum
> 26395     3

Tomasz,
The attached patch fixes this bug.

Do you think it should be applied?

I think other shadow utilities should be fixed. Do you think we should fix
them?

Best Regards,
-- 
Nekral
-------------- next part --------------
Goal: print the usage and exit if an additional argument is profided to lastlog

Fixes: #349560

Status wrt upstream: Not forwarded yet

Note: some other utils may suffer from the same issue.

Index: shadow-4.0.14/src/lastlog.c
===================================================================
--- shadow-4.0.14.orig/src/lastlog.c	2005-12-06 22:25:00.000000000 +0100
+++ shadow-4.0.14/src/lastlog.c	2006-01-24 00:52:38.000000000 +0100
@@ -213,6 +213,12 @@
 				break;
 			}
 		}
+		if (argc > optind) {
+			fprintf (stderr,
+			         _("lastlog: Unexpected argument: %s\n"),
+			         argv[optind]);
+			usage();
+		}
 	}
 
 	if ((lastlogfile = fopen (LASTLOG_FILE, "r")) == (FILE *) 0) {


More information about the Pkg-shadow-devel mailing list