firstboot: add missing check
If we check length of 'a', we must do the same for 'b'.
This commit is contained in:
parent
1294661381
commit
39e96f844a
|
@ -550,10 +550,9 @@ static int prompt_root_password(void) {
|
||||||
r = ask_password_tty(-1, msg1, NULL, 0, 0, NULL, &a);
|
r = ask_password_tty(-1, msg1, NULL, 0, 0, NULL, &a);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to query root password: %m");
|
return log_error_errno(r, "Failed to query root password: %m");
|
||||||
if (strv_length(a) != 1) {
|
if (strv_length(a) != 1)
|
||||||
log_warning("Received multiple passwords, where we expected one.");
|
return log_error_errno(SYNTHETIC_ERRNO(EIO),
|
||||||
return -EINVAL;
|
"Received multiple passwords, where we expected one.");
|
||||||
}
|
|
||||||
|
|
||||||
if (isempty(*a)) {
|
if (isempty(*a)) {
|
||||||
log_warning("No password entered, skipping.");
|
log_warning("No password entered, skipping.");
|
||||||
|
@ -563,6 +562,9 @@ static int prompt_root_password(void) {
|
||||||
r = ask_password_tty(-1, msg2, NULL, 0, 0, NULL, &b);
|
r = ask_password_tty(-1, msg2, NULL, 0, 0, NULL, &b);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to query root password: %m");
|
return log_error_errno(r, "Failed to query root password: %m");
|
||||||
|
if (strv_length(b) != 1)
|
||||||
|
return log_error_errno(SYNTHETIC_ERRNO(EIO),
|
||||||
|
"Received multiple passwords, where we expected one.");
|
||||||
|
|
||||||
if (!streq(*a, *b)) {
|
if (!streq(*a, *b)) {
|
||||||
log_error("Entered passwords did not match, please try again.");
|
log_error("Entered passwords did not match, please try again.");
|
||||||
|
|
Loading…
Reference in a new issue