Blame SOURCES/passwd-0.80-S-output.patch

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