Bug 216635 - chage does not show the Account Expires if its shadow field is 0.
chage does not show the Account Expires if its shadow field is 0.
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: shadow-utils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
David Lawrence
Depends On:
Blocks: 212183
  Show dependency treegraph
Reported: 2006-11-21 04:45 EST by Jose Plans
Modified: 2010-10-22 03:02 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHSA-2007-0431
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-06-11 13:51:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
chage_account_expire (341 bytes, patch)
2006-11-21 04:45 EST, Jose Plans
no flags Details | Diff

  None (edit)
Description Jose Plans 2006-11-21 04:45:32 EST
Description of problem:
Setting up in /etc/shadow :

Will make chage not show the Account Expires field, as follows :
Account Expires:        Never 

My understanding is that Linux' based tools use -1 as the undefined value,
however on other UNIX platforms, 0 was used.
Checking on the source code there is still a bad condition that got fixed
upstream and is also fixed on RHEL4.

if (expdays <= 0) {

Which should be < to allow just -1. The fact 0 is included on the test makes
that date not shown, even if being that date a wrong setup, as by logic you
would expect the system administrator to have date + Days setup.
Otherwise the account gets blocked.

However, if there is a legacy application ported from another UNIX, that uses
shadow somehow and sets 0, then the account reset will be refused to access.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Add a test user.
2. Edit manually /etc/shadow adding 0 in the sp_expire field.
3. chage the user. chage -l foo. 
Actual results:
Account Expires: Never.

Expected results:
Account Expires: Jan 01, 1970.

Additional info:
Patch attached.
Comment 1 Jose Plans 2006-11-21 04:45:33 EST
Created attachment 141745 [details]
Comment 9 Red Hat Bugzilla 2007-06-11 13:51:55 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.