Bug 347 - passwd does not update 'last modified time' field in /etc/shadow when updating password
Summary: passwd does not update 'last modified time' field in /etc/shadow when updatin...
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.13.x
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-23 01:16 UTC by Ben Friedberg
Modified: 2018-01-28 03:50 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
fix (2.73 KB, patch)
2009-07-12 23:13 UTC, Denys Vlasenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Friedberg 2009-05-23 01:16:40 UTC
libbb/update_passwd.c does not seem to contain a mechanism to update the lastchanged field (field 3) for a user in /etc/shadow when using shadow passwds.  

This field is, however, created and set to 'days since the epoch' when the user entry is CREATED.

When a user's password expires as a combination of field 3 (last modified) and field 5 (max days password is valid from modification) the user is prompted to change the password.  The update_passwd correctly sets the new password but fails to set the last modified time.  This makes the updated password nice and all, but it is still expired relative to field 3 and field 5.

I am using bb 1.13.2. but I looked all the way up to the tip revision of update_passwd and it doesn't seem to set that value anywhere...  I believe that this is relative to line 219 of libbb/update_passwd.c

line 130 of loginutils/adduser.c (for 1.14.0) includes the initial setting of that value:
p = xasprintf("!:%u:0:99999:7:::", (unsigned)(time(NULL) / 86400)); 

I can probably add the feature and patch it up myself, but I wanted to call attention to it.
Comment 1 Denys Vlasenko 2009-07-12 23:13:11 UTC
Created attachment 455 [details]
fix

Should be fixed now. Please test current git or attached patch.