mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-27 15:54:22 +02:00
- millert@cvs.openbsd.org 2001/03/03 21:19:41
[ssh-keyscan.c] Dynamically allocate read_wait and its copies. Since maxfd is based on resource limits it is often (usually?) larger than FD_SETSIZE.
This commit is contained in:
parent
d20b855bc6
commit
c1e0421cb4
@ -124,6 +124,10 @@
|
|||||||
- deraadt@cvs.openbsd.org 2001/03/03 06:53:12
|
- deraadt@cvs.openbsd.org 2001/03/03 06:53:12
|
||||||
[ssh-keyscan.c]
|
[ssh-keyscan.c]
|
||||||
standard theo sweep
|
standard theo sweep
|
||||||
|
- millert@cvs.openbsd.org 2001/03/03 21:19:41
|
||||||
|
[ssh-keyscan.c]
|
||||||
|
Dynamically allocate read_wait and its copies. Since maxfd is
|
||||||
|
based on resource limits it is often (usually?) larger than FD_SETSIZE.
|
||||||
|
|
||||||
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.
|
||||||
@ -4316,4 +4320,4 @@
|
|||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.889 2001/03/05 07:01:18 mouring Exp $
|
$Id: ChangeLog,v 1.890 2001/03/05 07:04:38 mouring Exp $
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: ssh-keyscan.c,v 1.18 2001/03/03 06:53:12 deraadt Exp $");
|
RCSID("$OpenBSD: ssh-keyscan.c,v 1.19 2001/03/03 21:19:41 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>
|
||||||
@ -45,7 +45,8 @@ extern char *__progname;
|
|||||||
#else
|
#else
|
||||||
char *__progname;
|
char *__progname;
|
||||||
#endif
|
#endif
|
||||||
fd_set read_wait;
|
fd_set *read_wait;
|
||||||
|
size_t read_wait_size;
|
||||||
int ncon;
|
int ncon;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -361,7 +362,7 @@ conalloc(char *iname, char *oname)
|
|||||||
gettimeofday(&fdcon[s].c_tv, NULL);
|
gettimeofday(&fdcon[s].c_tv, NULL);
|
||||||
fdcon[s].c_tv.tv_sec += timeout;
|
fdcon[s].c_tv.tv_sec += timeout;
|
||||||
TAILQ_INSERT_TAIL(&tq, &fdcon[s], c_link);
|
TAILQ_INSERT_TAIL(&tq, &fdcon[s], c_link);
|
||||||
FD_SET(s, &read_wait);
|
FD_SET(s, read_wait);
|
||||||
ncon++;
|
ncon++;
|
||||||
return (s);
|
return (s);
|
||||||
}
|
}
|
||||||
@ -378,7 +379,7 @@ confree(int s)
|
|||||||
xfree(fdcon[s].c_data);
|
xfree(fdcon[s].c_data);
|
||||||
fdcon[s].c_status = CS_UNUSED;
|
fdcon[s].c_status = CS_UNUSED;
|
||||||
TAILQ_REMOVE(&tq, &fdcon[s], c_link);
|
TAILQ_REMOVE(&tq, &fdcon[s], c_link);
|
||||||
FD_CLR(s, &read_wait);
|
FD_CLR(s, read_wait);
|
||||||
ncon--;
|
ncon--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +482,7 @@ conread(int s)
|
|||||||
void
|
void
|
||||||
conloop(void)
|
conloop(void)
|
||||||
{
|
{
|
||||||
fd_set r, e;
|
fd_set *r, *e;
|
||||||
struct timeval seltime, now;
|
struct timeval seltime, now;
|
||||||
int i;
|
int i;
|
||||||
con *c;
|
con *c;
|
||||||
@ -501,18 +502,24 @@ conloop(void)
|
|||||||
} else
|
} else
|
||||||
seltime.tv_sec = seltime.tv_usec = 0;
|
seltime.tv_sec = seltime.tv_usec = 0;
|
||||||
|
|
||||||
r = e = read_wait;
|
r = xmalloc(read_wait_size);
|
||||||
while (select(maxfd, &r, NULL, &e, &seltime) == -1 &&
|
memcpy(r, read_wait, read_wait_size);
|
||||||
|
e = xmalloc(read_wait_size);
|
||||||
|
memcpy(e, read_wait, read_wait_size);
|
||||||
|
|
||||||
|
while (select(maxfd, r, NULL, e, &seltime) == -1 &&
|
||||||
(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);
|
||||||
}
|
}
|
||||||
|
xfree(r);
|
||||||
|
xfree(e);
|
||||||
|
|
||||||
c = tq.tqh_first;
|
c = tq.tqh_first;
|
||||||
while (c && (c->c_tv.tv_sec < now.tv_sec ||
|
while (c && (c->c_tv.tv_sec < now.tv_sec ||
|
||||||
@ -612,6 +619,10 @@ main(int argc, char **argv)
|
|||||||
fdcon = xmalloc(maxfd * sizeof(con));
|
fdcon = xmalloc(maxfd * sizeof(con));
|
||||||
memset(fdcon, 0, maxfd * sizeof(con));
|
memset(fdcon, 0, maxfd * sizeof(con));
|
||||||
|
|
||||||
|
read_wait_size = howmany(maxfd, NFDBITS) * sizeof(fd_mask);
|
||||||
|
read_wait = xmalloc(read_wait_size);
|
||||||
|
memset(read_wait, 0, read_wait_size);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while (ncon < MAXCON) {
|
while (ncon < MAXCON) {
|
||||||
char *name;
|
char *name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user