unix: do not close stdin in grub_passwd_get
This makes it impossible to read from stdin without controlling tty: 10:/mnt # echo -e passwd\\npasswd | setsid ./grub-mkpasswd-pbkdf2 Enter password: Reenter password: ./grub-mkpasswd-pbkdf2: error: failure to read password. 10:/mnt
This commit is contained in:
parent
50d6f38feb
commit
6a46cbcc5c
1 changed files with 4 additions and 2 deletions
|
@ -54,6 +54,7 @@ grub_password_get (char buf[], unsigned buf_size)
|
|||
grub_memset (buf, 0, buf_size);
|
||||
if (!fgets (buf, buf_size, stdin))
|
||||
{
|
||||
if (in != stdin)
|
||||
fclose (in);
|
||||
return 0;
|
||||
}
|
||||
|
@ -67,6 +68,7 @@ grub_password_get (char buf[], unsigned buf_size)
|
|||
grub_xputs ("\n");
|
||||
grub_refresh ();
|
||||
|
||||
if (in != stdin)
|
||||
fclose (in);
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue