Bug#66740: ssh-askpass-gnome: The first password is always bad (was: OpenSSH 3.0)
Damien Miller
djm at mindrot.org
Tue Dec 11 16:53:14 EST 2001
On 8 Dec 2001, Charles C. Fu wrote:
> Background: Many Debian users have reported a problem to Debian
> with ssh-askpass-gnome always rejecting the first passphrase.
> <URL:http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=66740&repeatmerged=yes>
> shows the thread for one of these reports.
Please report future portable OpenSSH bugs at http://bugzilla.mindrot.org/ -
it makes them easier to track.
Could you try this patch?
Index: readpass.c
===================================================================
RCS file: /var/cvs/openssh/readpass.c,v
retrieving revision 1.21
diff -u -r1.21 readpass.c
--- readpass.c 2001/11/12 00:05:21 1.21
+++ readpass.c 2001/12/11 05:47:26
@@ -46,7 +46,7 @@
pid_t pid;
size_t len;
char *pass;
- int p[2], status;
+ int p[2], status, ret;
char buf[1024];
if (fflush(stdout) != 0)
@@ -71,14 +71,23 @@
fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno));
}
close(p[1]);
- len = read(p[0], buf, sizeof buf -1);
+
+ len = ret = 0;
+ do {
+ ret = read(p[0], buf + len, sizeof(buf) - 1 - len);
+ if (ret == -1 && errno == EINTR)
+ continue;
+ if (ret <= 0)
+ break;
+ len += ret;
+ } while (sizeof(buf) - 1 - len > 0);
+ buf[len] = '\0';
+
close(p[0]);
while (waitpid(pid, &status, 0) < 0)
if (errno != EINTR)
break;
- if (len <= 1)
- return xstrdup("");
- buf[len] = '\0';
+
buf[strcspn(buf, "\r\n")] = '\0';
pass = xstrdup(buf);
memset(buf, 0, sizeof(buf));
--
| By convention there is color, \\ Damien Miller <djm at mindrot.org>
| By convention sweetness, By convention bitterness, \\ www.mindrot.org
| But in reality there are atoms and space - Democritus (c. 400 BCE)
More information about the openssh-unix-dev
mailing list