|
|
06dbad |
diff --git a/libuser.c b/libuser.c
|
|
|
06dbad |
index 7a36520..06c6200 100644
|
|
|
06dbad |
--- a/libuser.c
|
|
|
06dbad |
+++ b/libuser.c
|
|
|
06dbad |
@@ -245,6 +245,7 @@ pwdb_display_status(const char *username)
|
|
|
06dbad |
struct lu_ent *ent;
|
|
|
06dbad |
struct lu_error *error = NULL;
|
|
|
06dbad |
char *current;
|
|
|
06dbad |
+ char *current_user;
|
|
|
06dbad |
char *realname;
|
|
|
06dbad |
const char *msg;
|
|
|
06dbad |
int shadow = 1;
|
|
|
06dbad |
@@ -268,9 +269,10 @@ pwdb_display_status(const char *username)
|
|
|
06dbad |
goto bail;
|
|
|
06dbad |
}
|
|
|
06dbad |
current = lu_ent_get_first_value_strdup(ent, LU_SHADOWPASSWORD);
|
|
|
06dbad |
+ current_user = lu_ent_get_first_value_strdup(ent, LU_USERPASSWORD);
|
|
|
06dbad |
if (current == NULL) {
|
|
|
06dbad |
shadow = 0;
|
|
|
06dbad |
- current = lu_ent_get_first_value_strdup(ent, LU_USERPASSWORD);
|
|
|
06dbad |
+ current = current_user;
|
|
|
06dbad |
} else {
|
|
|
06dbad |
sp_lstchg = (time_t) ent_value_int64(ent, LU_SHADOWLASTCHANGE);
|
|
|
06dbad |
sp_min = ent_value_int64(ent, LU_SHADOWMIN);
|
|
|
06dbad |
@@ -310,6 +312,13 @@ pwdb_display_status(const char *username)
|
|
|
06dbad |
msg = _("Password set, DES crypt.");
|
|
|
06dbad |
}
|
|
|
06dbad |
if (shadow) {
|
|
|
06dbad |
+ if (status[0] != 'N' && current_user && strlen(current_user) == 0) {
|
|
|
06dbad |
+ fprintf(stderr, "%s: %s\n", progname,
|
|
|
06dbad |
+ _("There is a password information set in /etc/shadow,"
|
|
|
06dbad |
+ " but the password field in /etc/passwd is empty."));
|
|
|
06dbad |
+ msg = _("Empty password.");
|
|
|
06dbad |
+ status = "NP";
|
|
|
06dbad |
+ }
|
|
|
06dbad |
sp_lstchg = sp_lstchg * 24L * 3600L;
|
|
|
06dbad |
localtime_r(&sp_lstchg, &tm;;
|
|
|
06dbad |
strftime(date, sizeof(date), "%Y-%m-%d", &tm;;
|
|
|
06dbad |
@@ -319,6 +328,9 @@ pwdb_display_status(const char *username)
|
|
|
06dbad |
printf("%s %s (%s)\n", realname, status, msg);
|
|
|
06dbad |
}
|
|
|
06dbad |
g_free(current);
|
|
|
06dbad |
+ if (shadow && current_user) {
|
|
|
06dbad |
+ g_free(current_user);
|
|
|
06dbad |
+ }
|
|
|
06dbad |
} else {
|
|
|
06dbad |
printf(_("No password set.\n"));
|
|
|
06dbad |
}
|