From 73ca041dfcdee40aae69e5de3412a1148126ec4e Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Mon, 12 Aug 1996 14:45:26 +0000 Subject: Add new option to chpass: -e "expire" ; change the account expire time from a script as if it was done in the interactive editor. When reassembling the gecos string, trim any excess trailing commas, they look ugly in the passwd file. :-) Have a simple Makefile tweak to prevent mortal users from changing their fullname. As ISP's we have seem some real bizzare stuff here.. When decoding the change/expire string, allow the month number as a synonym for the name of the month.. (ie: 1 as well as Jan or January) Note that using numbers means there's a chance that you can get bitten if you're not used to the American DD-MM-YY order. --- chpass/util.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'chpass/util.c') diff --git a/chpass/util.c b/chpass/util.c index fe89d79..605a484 100644 --- a/chpass/util.c +++ b/chpass/util.c @@ -91,12 +91,16 @@ atot(p, store) } if (!(t = strtok(p, " \t"))) goto bad; - for (mp = months;; ++mp) { - if (!*mp) - goto bad; - if (!strncasecmp(*mp, t, 3)) { - month = mp - months + 1; - break; + if (isdigit(*t)) { + month = atoi(t); + } else { + for (mp = months;; ++mp) { + if (!*mp) + goto bad; + if (!strncasecmp(*mp, t, 3)) { + month = mp - months + 1; + break; + } } } if (!(t = strtok((char *)NULL, " \t,")) || !isdigit(*t)) -- cgit v1.2.3-56-ge451