version 1.59.2.2, 2006/11/08 00:17:14 |
version 1.60, 2006/03/07 09:07:40 |
|
|
/* $OpenBSD$ */ |
|
/* |
/* |
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. |
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. |
* |
* |
|
|
* OpenBSD project by leaving this copyright notice intact. |
* OpenBSD project by leaving this copyright notice intact. |
*/ |
*/ |
|
|
#include <sys/types.h> |
#include "includes.h" |
#include <sys/socket.h> |
RCSID("$OpenBSD$"); |
|
|
#include <sys/queue.h> |
#include <sys/queue.h> |
#include <sys/time.h> |
|
#include <sys/resource.h> |
#include <sys/resource.h> |
|
|
#include <openssl/bn.h> |
|
|
|
#include <errno.h> |
#include <errno.h> |
#include <netdb.h> |
|
#include <setjmp.h> |
#include <setjmp.h> |
#include <stdarg.h> |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <signal.h> |
|
#include <string.h> |
|
#include <unistd.h> |
|
|
|
|
#include <openssl/bn.h> |
|
|
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "ssh.h" |
#include "ssh.h" |
#include "ssh1.h" |
#include "ssh1.h" |
#include "buffer.h" |
|
#include "key.h" |
#include "key.h" |
#include "cipher.h" |
|
#include "kex.h" |
#include "kex.h" |
#include "compat.h" |
#include "compat.h" |
#include "myproposal.h" |
#include "myproposal.h" |
#include "packet.h" |
#include "packet.h" |
#include "dispatch.h" |
#include "dispatch.h" |
|
#include "buffer.h" |
|
#include "bufaux.h" |
#include "log.h" |
#include "log.h" |
#include "atomicio.h" |
#include "atomicio.h" |
#include "misc.h" |
#include "misc.h" |
|
|
|
|
extern char *__progname; |
extern char *__progname; |
fd_set *read_wait; |
fd_set *read_wait; |
size_t read_wait_nfdset; |
size_t read_wait_size; |
int ncon; |
int ncon; |
int nonfatal_fatal = 0; |
int nonfatal_fatal = 0; |
jmp_buf kexjmp; |
jmp_buf kexjmp; |
|
|
lb->stream = stdin; |
lb->stream = stdin; |
} |
} |
|
|
if (!(lb->buf = malloc((lb->size = LINEBUF_SIZE)))) { |
if (!(lb->buf = malloc(lb->size = LINEBUF_SIZE))) { |
if (errfun) |
if (errfun) |
(*errfun) ("linebuf (%s): malloc failed\n", lb->filename); |
(*errfun) ("linebuf (%s): malloc failed\n", lb->filename); |
xfree(lb); |
xfree(lb); |
|
|
keyprint(c, keygrab_ssh1(c)); |
keyprint(c, keygrab_ssh1(c)); |
confree(s); |
confree(s); |
return; |
return; |
|
break; |
default: |
default: |
fatal("conread: invalid status %d", c->c_status); |
fatal("conread: invalid status %d", c->c_status); |
break; |
break; |
|
|
} else |
} else |
seltime.tv_sec = seltime.tv_usec = 0; |
seltime.tv_sec = seltime.tv_usec = 0; |
|
|
r = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
r = xmalloc(read_wait_size); |
e = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
memcpy(r, read_wait, read_wait_size); |
memcpy(r, read_wait, read_wait_nfdset * sizeof(fd_mask)); |
e = xmalloc(read_wait_size); |
memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask)); |
memcpy(e, read_wait, read_wait_size); |
|
|
while (select(maxfd, r, NULL, e, &seltime) == -1 && |
while (select(maxfd, r, NULL, e, &seltime) == -1 && |
(errno == EAGAIN || errno == EINTR)) |
(errno == EAGAIN || errno == EINTR)) |
|
|
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); |
fdcon = xcalloc(maxfd, sizeof(con)); |
fdcon = xmalloc(maxfd * sizeof(con)); |
|
memset(fdcon, 0, maxfd * sizeof(con)); |
|
|
read_wait_nfdset = howmany(maxfd, NFDBITS); |
read_wait_size = howmany(maxfd, NFDBITS) * sizeof(fd_mask); |
read_wait = xcalloc(read_wait_nfdset, sizeof(fd_mask)); |
read_wait = xmalloc(read_wait_size); |
|
memset(read_wait, 0, read_wait_size); |
|
|
if (fopt_count) { |
if (fopt_count) { |
Linebuf *lb; |
Linebuf *lb; |