chage -l

Peter Vrabec <[email protected]> Tue, 9 Aug 2005 12:45:24 +0000 (UTC)
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
Hi Tomasz,

could you consider applying of attached patch.

# chage -M 0 foo
# chage -l foo
Last password change                                    : Aug 09, 2005
Password expires                                        : never
Password inactive                                       : never
Account expires                                         : never
Minimum number of days between password change          : 0
Maximum number of days between password change          : 0
Number of days of warning before password expires       : 7

I don't agree with Password expires: never. It should be Aug 09, 2005.
# date
Wed Aug 10 14:30:06 UTC 2005
$ su foo
Password:
You are required to change your password immediately (password aged)
Changing password for foo
(current) UNIX password:

and there is similar problem with:
# chage -I 0 foo
# chage -E 0 foo

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109499
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=137498
shadow-chageList.patch (text/x-patch, 1.4 KB)
--- shadow/man/chage.1.xml.list	2005-09-11 13:52:53.000000000 +0000
+++ shadow/man/chage.1.xml	2005-09-11 13:54:30.000000000 +0000
@@ -76,7 +76,7 @@
             Set the number of days of inactivity after a password has
             expired before the account is locked. The <emphasis
             remap='I'>INACTIVE</emphasis> option is the number of days of
-            inactivity. A value of 0 disables this feature. A user whose
+            inactivity. A value of -1 disables this feature. A user whose
             account is locked must contact the system administrator before
             being able to use the system again.
           </para>
--- shadow/src/chage.c.list	2005-09-11 13:54:50.000000000 +0000
+++ shadow/src/chage.c	2005-09-11 14:02:10.000000000 +0000
@@ -251,7 +251,7 @@
 
 	printf (_("Password expires\t\t\t\t\t: "));
 	if (lastday <= 0 || maxdays >= 10000 * (DAY / SCALE)
-	    || maxdays <= 0) {
+	    || maxdays < 0) {
 		printf (_("never\n"));
 	} else {
 		expires = changed + maxdays * SCALE;
@@ -266,7 +266,7 @@
 	 */
 
 	printf (_("Password inactive\t\t\t\t\t: "));
-	if (lastday <= 0 || inactdays <= 0 ||
+	if (lastday <= 0 || inactdays < 0 ||
 	    maxdays >= 10000 * (DAY / SCALE) || maxdays <= 0) {
 		printf (_("never\n"));
 	} else {
@@ -280,7 +280,7 @@
 	 */
 
 	printf (_("Account expires\t\t\t\t\t\t: "));
-	if (expdays <= 0) {
+	if (expdays < 0) {
 		printf (_("never\n"));
 	} else {
 		expires = expdays * SCALE;