From 5af0050d0a9e24d057cc81353dad14648308a6bc Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Wed, 19 Mar 2008 19:30:30 +0000 Subject: [PATCH] 412_lastlog_-u_numerical_range was applied upstream. --- debian/changelog | 1 + debian/patches/412_lastlog_-u_numerical_range | 153 ------------------ debian/patches/series | 1 - 3 files changed, 1 insertion(+), 154 deletions(-) delete mode 100644 debian/patches/412_lastlog_-u_numerical_range diff --git a/debian/changelog b/debian/changelog index b43d05b3..4de2b4ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,7 @@ shadow (1:4.1.1~rc1-1) UNRELEASED; urgency=low + debian/patches/480_getopt_args_reorder + debian/patches/496_login_init_session + debian/patches/408_passwd_check_arguments + + debian/patches/412_lastlog_-u_numerical_range * debian/watch: Add a watch file for shadow. -- Nicolas FRANCOIS (Nekral) Sun, 24 Feb 2008 18:33:31 +0100 diff --git a/debian/patches/412_lastlog_-u_numerical_range b/debian/patches/412_lastlog_-u_numerical_range deleted file mode 100644 index 76ebcd82..00000000 --- a/debian/patches/412_lastlog_-u_numerical_range +++ /dev/null @@ -1,153 +0,0 @@ -Goal: Support numerical UID and ranges in lastlog -u -Fixes: #259494 - -Status wrt upstream: not reported yet. - -Note: It also allows to mix -u and -t - -Index: shadow-4.1.0/man/lastlog.8.xml -=================================================================== ---- shadow-4.1.0.orig/man/lastlog.8.xml -+++ shadow-4.1.0/man/lastlog.8.xml -@@ -71,22 +71,20 @@ - - - , -- LOGIN -+ LOGIN|RANGE - - - Print the lastlog record for user with specified - LOGIN only. - -- -- -- -- -- -- -- The flag overrides the use of . -- -- -- -+ Instead of a login name, lastlog also -+ accepts a numerical user ID or a RANGE of -+ users. This RANGE of users can be -+ specified with a min and max values -+ (UID_MIN-UID_MAX), a max value -+ (-UID_MAX) or a min value -+ (UID_MIN-). -+ - - - -Index: shadow-4.1.0/src/lastlog.c -=================================================================== ---- shadow-4.1.0.orig/src/lastlog.c -+++ shadow-4.1.0/src/lastlog.c -@@ -51,6 +51,8 @@ - */ - static FILE *lastlogfile; /* lastlog file stream */ - static off_t user; /* one single user, specified on command line */ -+static long umin; /* one single user, specified on command line */ -+static long umax; /* one single user, specified on command line */ - static int days; /* number of days to consider for print command */ - static time_t seconds; /* that number of days in seconds */ - static int inverse_days; /* number of days to consider for print command */ -@@ -58,6 +60,7 @@ - - - static int uflg = 0; /* set if user is a valid user id */ -+static int urange = 0; /* set if user is a valid user id range */ - static int tflg = 0; /* print is restricted to most recent days */ - static int bflg = 0; /* print excludes most recent days */ - static struct lastlog lastlog; /* scratch structure to play with ... */ -@@ -127,26 +130,16 @@ - { - off_t offset; - -- if (uflg) { -- offset = user * sizeof lastlog; -- -- if (fstat (fileno (lastlogfile), &statbuf)) { -- perror (LASTLOG_FILE); -- return; -- } -- if (offset >= statbuf.st_size) -- return; -- -- fseeko (lastlogfile, offset, SEEK_SET); -- if (fread ((char *) &lastlog, sizeof lastlog, 1, -- lastlogfile) == 1) -- print_one (pwent); -- else -- perror (LASTLOG_FILE); -- } else { -+ { - setpwent (); - while ((pwent = getpwent ())) { -+ if (uflg && user != pwent->pw_uid) -+ continue; - user = pwent->pw_uid; -+ if (urange && -+ ((umin != -1 && user < umin) || -+ (umax != -1 && user > umax))) -+ continue; - offset = user * sizeof lastlog; - - fseeko (lastlogfile, offset, SEEK_SET); -@@ -199,15 +192,47 @@ - bflg++; - break; - case 'u': -+ /* -+ * The user can be: -+ * - a login name -+ * - numerical -+ * - a numerical login ID -+ * - a range (-x, x-, x-y) -+ */ - pwent = xgetpwnam (optarg); -- if (!pwent) { -- fprintf (stderr, -- _("Unknown User: %s\n"), -- optarg); -- exit (1); -+ if (pwent) { -+ uflg = 1; -+ user = pwent->pw_uid; -+ } else { -+ char *endptr = NULL; -+ user = strtol(optarg, &endptr, 10); -+ if (*optarg != '\0' && *endptr == '\0') { -+ if (user < 0) { -+ /* - */ -+ urange = 1; -+ umin = -1; -+ umax = -user; -+ } else { -+ /* */ -+ uflg = 1; -+ } -+ } else if (endptr[0] == '-' && endptr[1] == '\0') { -+ /* - */ -+ urange = 1; -+ umin = user; -+ umax = -1; -+ } else if (*endptr == '-') { -+ /* - */ -+ urange = 1; -+ umin = user; -+ umax = atol(endptr+1); -+ } else { -+ fprintf (stderr, -+ _("Unknown user or range: %s\n"), -+ optarg); -+ exit (1); -+ } - } -- uflg++; -- user = pwent->pw_uid; - break; - default: - usage (); diff --git a/debian/patches/series b/debian/patches/series index af3049dc..1f20d281 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -27,6 +27,5 @@ 505_useradd_recommend_adduser 406_vipw_resume_properly 407_adduser_disable_PUG_with-n -412_lastlog_-u_numerical_range 414_remove-unwise-advices 415_login_put-echoctl-back