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/edit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'chpass/edit.c') diff --git a/chpass/edit.c b/chpass/edit.c index bca6ace..cf87fdf 100644 --- a/chpass/edit.c +++ b/chpass/edit.c @@ -233,6 +233,9 @@ bad: (void)fclose(fp); (void)sprintf(pw->pw_gecos = p, "%s,%s,%s,%s", list[E_NAME].save, list[E_LOCATE].save, list[E_BPHONE].save, list[E_HPHONE].save); + while ((len = strlen(pw->pw_gecos)) && pw->pw_gecos[len - 1] == ',') + pw->pw_gecos[len - 1] = '\0'; + if (snprintf(buf, sizeof(buf), "%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s", pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class, -- cgit v1.2.3-56-ge451