mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 00:04:30 +02:00
- deraadt@cvs.openbsd.org 2001/03/03 06:53:12
[ssh-keyscan.c] standard theo sweep
This commit is contained in:
parent
92a2e38f8e
commit
d20b855bc6
@ -121,6 +121,9 @@
|
|||||||
scp.c serverloop.c session.c sftp-server.8 sftp.1 ssh-add.1 ssh-add.c
|
scp.c serverloop.c session.c sftp-server.8 sftp.1 ssh-add.1 ssh-add.c
|
||||||
ssh-agent.1 ssh-agent.c ssh-keygen.1 ssh.1 sshd.8]
|
ssh-agent.1 ssh-agent.c ssh-keygen.1 ssh.1 sshd.8]
|
||||||
make copyright lines the same format
|
make copyright lines the same format
|
||||||
|
- deraadt@cvs.openbsd.org 2001/03/03 06:53:12
|
||||||
|
[ssh-keyscan.c]
|
||||||
|
standard theo sweep
|
||||||
|
|
||||||
20010304
|
20010304
|
||||||
- (bal) Remove make-ssh-known-hosts.1 since it's no longer valid.
|
- (bal) Remove make-ssh-known-hosts.1 since it's no longer valid.
|
||||||
@ -4313,4 +4316,4 @@
|
|||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.888 2001/03/05 06:59:27 mouring Exp $
|
$Id: ChangeLog,v 1.889 2001/03/05 07:01:18 mouring Exp $
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-keyscan.c,v 1.17 2001/02/21 07:37:04 deraadt Exp $");
|
RCSID("$OpenBSD: ssh-keyscan.c,v 1.18 2001/03/03 06:53:12 deraadt 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>
|
||||||
@ -26,6 +26,7 @@ RCSID("$OpenBSD: ssh-keyscan.c,v 1.17 2001/02/21 07:37:04 deraadt Exp $");
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "bufaux.h"
|
#include "bufaux.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "atomicio.h"
|
||||||
|
|
||||||
static int argno = 1; /* Number of argument currently being parsed */
|
static int argno = 1; /* Number of argument currently being parsed */
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ int family = AF_UNSPEC; /* IPv4, IPv6 or both */
|
|||||||
int timeout = 5;
|
int timeout = 5;
|
||||||
|
|
||||||
int maxfd;
|
int maxfd;
|
||||||
#define maxcon (maxfd - 10)
|
#define MAXCON (maxfd - 10)
|
||||||
|
|
||||||
#ifdef HAVE___PROGNAME
|
#ifdef HAVE___PROGNAME
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
@ -368,9 +369,9 @@ conalloc(char *iname, char *oname)
|
|||||||
void
|
void
|
||||||
confree(int s)
|
confree(int s)
|
||||||
{
|
{
|
||||||
close(s);
|
|
||||||
if (s >= maxfd || fdcon[s].c_status == CS_UNUSED)
|
if (s >= maxfd || fdcon[s].c_status == CS_UNUSED)
|
||||||
fatal("confree: attempt to free bad fdno %d", s);
|
fatal("confree: attempt to free bad fdno %d", s);
|
||||||
|
close(s);
|
||||||
xfree(fdcon[s].c_namebase);
|
xfree(fdcon[s].c_namebase);
|
||||||
xfree(fdcon[s].c_output_name);
|
xfree(fdcon[s].c_output_name);
|
||||||
if (fdcon[s].c_status == CS_KEYS)
|
if (fdcon[s].c_status == CS_KEYS)
|
||||||
@ -428,7 +429,7 @@ congreet(int s)
|
|||||||
buf[n - 1] = '\0';
|
buf[n - 1] = '\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 (write(s, buf, n) != n) {
|
if (atomicio(write, s, buf, n) != n) {
|
||||||
error("write (%s): %s", c->c_name, strerror(errno));
|
error("write (%s): %s", c->c_name, strerror(errno));
|
||||||
confree(s);
|
confree(s);
|
||||||
return;
|
return;
|
||||||
@ -488,9 +489,8 @@ conloop(void)
|
|||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
c = tq.tqh_first;
|
c = tq.tqh_first;
|
||||||
|
|
||||||
if (c &&
|
if (c && (c->c_tv.tv_sec > now.tv_sec ||
|
||||||
(c->c_tv.tv_sec > now.tv_sec ||
|
(c->c_tv.tv_sec == now.tv_sec && c->c_tv.tv_usec > now.tv_usec))) {
|
||||||
(c->c_tv.tv_sec == now.tv_sec && c->c_tv.tv_usec > now.tv_usec))) {
|
|
||||||
seltime = c->c_tv;
|
seltime = c->c_tv;
|
||||||
seltime.tv_sec -= now.tv_sec;
|
seltime.tv_sec -= now.tv_sec;
|
||||||
seltime.tv_usec -= now.tv_usec;
|
seltime.tv_usec -= now.tv_usec;
|
||||||
@ -506,18 +506,19 @@ conloop(void)
|
|||||||
(errno == EAGAIN || errno == EINTR))
|
(errno == EAGAIN || errno == EINTR))
|
||||||
;
|
;
|
||||||
|
|
||||||
for (i = 0; i < maxfd; i++)
|
for (i = 0; i < maxfd; i++) {
|
||||||
if (FD_ISSET(i, &e)) {
|
if (FD_ISSET(i, &e)) {
|
||||||
error("%s: exception!", fdcon[i].c_name);
|
error("%s: exception!", fdcon[i].c_name);
|
||||||
confree(i);
|
confree(i);
|
||||||
} else if (FD_ISSET(i, &r))
|
} else if (FD_ISSET(i, &r))
|
||||||
conread(i);
|
conread(i);
|
||||||
|
}
|
||||||
|
|
||||||
c = tq.tqh_first;
|
c = tq.tqh_first;
|
||||||
while (c &&
|
while (c && (c->c_tv.tv_sec < now.tv_sec ||
|
||||||
(c->c_tv.tv_sec < now.tv_sec ||
|
(c->c_tv.tv_sec == now.tv_sec && c->c_tv.tv_usec < now.tv_usec))) {
|
||||||
(c->c_tv.tv_sec == now.tv_sec && c->c_tv.tv_usec < now.tv_usec))) {
|
|
||||||
int s = c->c_fd;
|
int s = c->c_fd;
|
||||||
|
|
||||||
c = c->c_link.tqe_next;
|
c = c->c_link.tqe_next;
|
||||||
conrecycle(s);
|
conrecycle(s);
|
||||||
}
|
}
|
||||||
@ -540,6 +541,7 @@ nexthost(int argc, char **argv)
|
|||||||
return (argv[argno++]);
|
return (argv[argno++]);
|
||||||
} else if (!strncmp(argv[argno], "-f", 2)) {
|
} else if (!strncmp(argv[argno], "-f", 2)) {
|
||||||
char *fname;
|
char *fname;
|
||||||
|
|
||||||
if (argv[argno][2])
|
if (argv[argno][2])
|
||||||
fname = &argv[argno++][2];
|
fname = &argv[argno++][2];
|
||||||
else if (++argno >= argc) {
|
else if (++argno >= argc) {
|
||||||
@ -551,9 +553,11 @@ nexthost(int argc, char **argv)
|
|||||||
fname = NULL;
|
fname = NULL;
|
||||||
lb = Linebuf_alloc(fname, error);
|
lb = Linebuf_alloc(fname, error);
|
||||||
} else
|
} else
|
||||||
error("ignoring invalid/misplaced option `%s'", argv[argno++]);
|
error("ignoring invalid/misplaced option `%s'",
|
||||||
|
argv[argno++]);
|
||||||
} else {
|
} else {
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
line = Linebuf_getline(lb);
|
line = Linebuf_getline(lb);
|
||||||
if (line)
|
if (line)
|
||||||
return (line);
|
return (line);
|
||||||
@ -601,7 +605,7 @@ main(int argc, char **argv)
|
|||||||
fatal("%s: fdlim_get: bad value", __progname);
|
fatal("%s: fdlim_get: bad value", __progname);
|
||||||
if (maxfd > MAXMAXFD)
|
if (maxfd > MAXMAXFD)
|
||||||
maxfd = MAXMAXFD;
|
maxfd = MAXMAXFD;
|
||||||
if (maxcon <= 0)
|
if (MAXCON <= 0)
|
||||||
fatal("%s: not enough file descriptors", __progname);
|
fatal("%s: not enough file descriptors", __progname);
|
||||||
if (maxfd > fdlim_get(0))
|
if (maxfd > fdlim_get(0))
|
||||||
fdlim_set(maxfd);
|
fdlim_set(maxfd);
|
||||||
@ -609,7 +613,7 @@ main(int argc, char **argv)
|
|||||||
memset(fdcon, 0, maxfd * sizeof(con));
|
memset(fdcon, 0, maxfd * sizeof(con));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while (ncon < maxcon) {
|
while (ncon < MAXCON) {
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
host = nexthost(argc, argv);
|
host = nexthost(argc, argv);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user