[Bug 1542] Send echo on/off flag to SSH_ASKPASS

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Sun Jun 9 07:58:54 AEST 2019


https://bugzilla.mindrot.org/show_bug.cgi?id=1542

beer <wittayahom5 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1874|                            |ok+
              Flags|                            |

--- Comment #24 from beer <wittayahom5 at gmail.com> ---
Comment on attachment 1874
  --> https://bugzilla.mindrot.org/attachment.cgi?id=1874
/home/djm/askpass-env-echo.diff

>Index: readpass.c
>===================================================================
>RCS file: /cvs/src/usr.bin/ssh/readpass.c,v
>retrieving revision 1.47
>diff -u -p -r1.47 readpass.c
>--- readpass.c	3 Aug 2006 03:34:42 -0000	1.47
>+++ readpass.c	18 Jun 2010 05:06:21 -0000
>@@ -44,7 +44,7 @@
> #include "uidswap.h"
> 
> static char *
>-ssh_askpass(char *askpass, const char *msg)
>+ssh_askpass(char *askpass, const char *msg, int echo_on)
> {
> 	pid_t pid;
> 	size_t len;
>@@ -69,6 +69,10 @@ ssh_askpass(char *askpass, const char *m
> 		close(p[0]);
> 		if (dup2(p[1], STDOUT_FILENO) < 0)
> 			fatal("ssh_askpass: dup2: %s", strerror(errno));
>+		if (echo_on)
>+			setenv("SSH_ASKPASS_ECHO", "1", 1);
>+		else
>+			unsetenv("SSH_ASKPASS_ECHO");
> 		execlp(askpass, askpass, msg, (char *) 0);
> 		fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno));
> 	}
>@@ -141,7 +145,8 @@ read_passphrase(const char *prompt, int 
> 			askpass = getenv(SSH_ASKPASS_ENV);
> 		else
> 			askpass = _PATH_SSH_ASKPASS_DEFAULT;
>-		if ((ret = ssh_askpass(askpass, prompt)) == NULL)
>+		if ((ret = ssh_askpass(askpass, prompt,
>+		    flags & RP_ECHO)) == NULL)
> 			if (!(flags & RP_ALLOW_EOF))
> 				return xstrdup("");
> 		return ret;

-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list