mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
- millert@cvs.openbsd.org 2001/03/06 01:06:03
[ssh-keyscan.c] Don't assume we wil get the version string all in one read(). deraadt@ OK'd
This commit is contained in:
parent
b3144e58e7
commit
884a4aca88
@ -33,6 +33,10 @@
|
|||||||
- deraadt@cvs.openbsd.org 2001/03/06 00:33:04
|
- deraadt@cvs.openbsd.org 2001/03/06 00:33:04
|
||||||
[authfd.c cli.c ssh-agent.c]
|
[authfd.c cli.c ssh-agent.c]
|
||||||
EINTR/EAGAIN handling is required in more cases
|
EINTR/EAGAIN handling is required in more cases
|
||||||
|
- millert@cvs.openbsd.org 2001/03/06 01:06:03
|
||||||
|
[ssh-keyscan.c]
|
||||||
|
Don't assume we wil get the version string all in one read().
|
||||||
|
deraadt@ OK'd
|
||||||
|
|
||||||
20010305
|
20010305
|
||||||
- (bal) CVS ID touch up on sshpty.[ch] and sshlogin.[ch]
|
- (bal) CVS ID touch up on sshpty.[ch] and sshlogin.[ch]
|
||||||
@ -4404,4 +4408,4 @@
|
|||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.916 2001/03/06 03:31:34 mouring Exp $
|
$Id: ChangeLog,v 1.917 2001/03/06 03:33:04 mouring Exp $
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-keyscan.c,v 1.20 2001/03/05 15:37:27 deraadt Exp $");
|
RCSID("$OpenBSD: ssh-keyscan.c,v 1.21 2001/03/06 01:06:03 millert Exp $");
|
||||||
|
|
||||||
#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
|
#if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H)
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
@ -411,23 +411,27 @@ conrecycle(int s)
|
|||||||
void
|
void
|
||||||
congreet(int s)
|
congreet(int s)
|
||||||
{
|
{
|
||||||
char buf[80];
|
char buf[80], *cp;
|
||||||
|
size_t bufsiz;
|
||||||
int n;
|
int n;
|
||||||
con *c = &fdcon[s];
|
con *c = &fdcon[s];
|
||||||
|
|
||||||
n = read(s, buf, sizeof(buf));
|
bufsiz = sizeof(buf);
|
||||||
|
cp = buf;
|
||||||
|
while (bufsiz-- && (n = read(s, cp, 1)) == 1 && *cp != '\n' && *cp != '\r')
|
||||||
|
cp++;
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
if (errno != ECONNREFUSED)
|
if (errno != ECONNREFUSED)
|
||||||
error("read (%s): %s", c->c_name, strerror(errno));
|
error("read (%s): %s", c->c_name, strerror(errno));
|
||||||
conrecycle(s);
|
conrecycle(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (buf[n - 1] != '\n') {
|
if (*cp != '\n' && *cp != '\r') {
|
||||||
error("%s: bad greeting", c->c_name);
|
error("%s: bad greeting", c->c_name);
|
||||||
confree(s);
|
confree(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf[n - 1] = '\0';
|
*cp = '\0';
|
||||||
fprintf(stderr, "# %s %s\n", c->c_name, buf);
|
fprintf(stderr, "# %s %s\n", c->c_name, buf);
|
||||||
n = snprintf(buf, sizeof buf, "SSH-1.5-OpenSSH-keyscan\r\n");
|
n = snprintf(buf, sizeof buf, "SSH-1.5-OpenSSH-keyscan\r\n");
|
||||||
if (atomicio(write, s, buf, n) != n) {
|
if (atomicio(write, s, buf, n) != n) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user