aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-13 01:15:30 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-13 01:15:30 +0200
commit189f74d0f2760d3da1a05cba75653dade4c8a9c3 (patch)
treef192b88fd0a919d8d71d930272f25de1002a3e70 /loginutils
parent044b18083b4380f158002ed7c00c52d362c9632c (diff)
downloadbusybox-189f74d0f2760d3da1a05cba75653dade4c8a9c3.tar.gz
passwd + /etc/shadow: chage "change time" field too
function old new delta update_passwd 1171 1270 +99 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/adduser.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 00232375b..136dcdff8 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -169,7 +169,18 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
free(p);
#if ENABLE_FEATURE_SHADOWPASSWDS
- p = xasprintf("!:%u:0:99999:7:::", (unsigned)(time(NULL) / 86400)); /* sp->sp_lstchg */
+ /* /etc/shadow fields:
+ * 1. username
+ * 2. encrypted password
+ * 3. last password change (unix date (unix time/24*60*60))
+ * 4. minimum days required between password changes
+ * 5. maximum days password is valid
+ * 6. days before password is to expire that user is warned
+ * 7. days after password expires that account is disabled
+ * 8. unix date when login expires (may no longer be used)
+ */
+ /* fields: 2 3 4 5 6 78 */
+ p = xasprintf("!:%u:0:99999:7:::", (unsigned)(time(NULL)) / (24*60*60));
/* ignore errors: if file is missing we suppose admin doesn't want it */
update_passwd(bb_path_shadow_file, pw.pw_name, p, NULL);
if (ENABLE_FEATURE_CLEAN_UP)