Merge pull request #398 from Dzejrou/master

passwd: handle NULL pw_passwd when printing password status
This commit is contained in:
Serge Hallyn 2021-08-04 10:38:30 -05:00 committed by GitHub
commit adb83f7796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -490,9 +490,12 @@ static void print_status (const struct passwd *pw)
((long long)sp->sp_max * SCALE) / DAY,
((long long)sp->sp_warn * SCALE) / DAY,
((long long)sp->sp_inact * SCALE) / DAY);
} else {
} else if (NULL != pw->pw_passwd) {
(void) printf ("%s %s\n",
pw->pw_name, pw_status (pw->pw_passwd));
} else {
(void) fprintf(stderr, _("%s: malformed password data obtained for user %s\n"),
Prog, pw->pw_name);
}
}