Replace the deprecated getpass(3) by our agetpass()

getpass(3) is broken in all implementations; in some, more than
others, but somewhat broken in all of them.  Check the immediate
previous commit, which added the functions, for more details.
Check also the Linux man-pages commit that marked it as
deprecated, for more details:
7ca189099d73bde954eed2d7fc21732bcc8ddc6b.

Link: <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit?id=7ca189099d73bde954eed2d7fc21732bcc8ddc6b>
Reported-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2022-09-27 21:21:35 +02:00
committed by Iker Pedrosa
parent 155c9421b9
commit 554f86bafa
4 changed files with 21 additions and 18 deletions

View File

@@ -158,7 +158,7 @@ static void check_perms (const struct group *grp,
* get the password from her, and set the salt for
* the decryption from the group file.
*/
cp = getpass (_("Password: "));
cp = agetpass (_("Password: "));
if (NULL == cp) {
goto failure;
}
@@ -169,7 +169,7 @@ static void check_perms (const struct group *grp,
* must match the previously encrypted value in the file.
*/
cpasswd = pw_encrypt (cp, grp->gr_passwd);
strzero (cp);
erase_pass (cp);
if (NULL == cpasswd) {
fprintf (stderr,