diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ssh-agent.c | 19 |
2 files changed, 16 insertions, 8 deletions
@@ -12,6 +12,9 @@ | |||
12 | - stevesk@cvs.openbsd.org 2001/07/15 16:58:29 | 12 | - stevesk@cvs.openbsd.org 2001/07/15 16:58:29 |
13 | [ssh-agent.c] | 13 | [ssh-agent.c] |
14 | typo in usage; ok markus@ | 14 | typo in usage; ok markus@ |
15 | - markus@cvs.openbsd.org 2001/07/17 20:48:42 | ||
16 | [ssh-agent.c] | ||
17 | update maxfd if maxfd is closed; report from jmcelroy@dtgnet.com | ||
15 | 18 | ||
16 | 20010715 | 19 | 20010715 |
17 | - (bal) Set "BROKEN_GETADDRINFO" for darwin platform. Reported by | 20 | - (bal) Set "BROKEN_GETADDRINFO" for darwin platform. Reported by |
@@ -6051,4 +6054,4 @@ | |||
6051 | - Wrote replacements for strlcpy and mkdtemp | 6054 | - Wrote replacements for strlcpy and mkdtemp |
6052 | - Released 1.0pre1 | 6055 | - Released 1.0pre1 |
6053 | 6056 | ||
6054 | $Id: ChangeLog,v 1.1407 2001/07/18 15:53:39 mouring Exp $ | 6057 | $Id: ChangeLog,v 1.1408 2001/07/18 15:58:08 mouring Exp $ |
diff --git a/ssh-agent.c b/ssh-agent.c index 4ddad9473..ad4cbf06d 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.65 2001/07/15 16:58:29 stevesk Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.66 2001/07/17 20:48:42 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "includes.h" | 38 | #include "includes.h" |
39 | RCSID("$OpenBSD: ssh-agent.c,v 1.65 2001/07/15 16:58:29 stevesk Exp $"); | 39 | RCSID("$OpenBSD: ssh-agent.c,v 1.66 2001/07/17 20:48:42 markus Exp $"); |
40 | 40 | ||
41 | #include <openssl/evp.h> | 41 | #include <openssl/evp.h> |
42 | #include <openssl/md5.h> | 42 | #include <openssl/md5.h> |
@@ -656,7 +656,7 @@ new_socket(int type, int fd) | |||
656 | } | 656 | } |
657 | 657 | ||
658 | static int | 658 | static int |
659 | prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl) | 659 | prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, int *nallocp) |
660 | { | 660 | { |
661 | u_int i, sz; | 661 | u_int i, sz; |
662 | int n = 0; | 662 | int n = 0; |
@@ -676,15 +676,18 @@ prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl) | |||
676 | } | 676 | } |
677 | 677 | ||
678 | sz = howmany(n+1, NFDBITS) * sizeof(fd_mask); | 678 | sz = howmany(n+1, NFDBITS) * sizeof(fd_mask); |
679 | if (*fdrp == NULL || n > *fdl) { | 679 | if (*fdrp == NULL || sz > *nallocp) { |
680 | if (*fdrp) | 680 | if (*fdrp) |
681 | xfree(*fdrp); | 681 | xfree(*fdrp); |
682 | if (*fdwp) | 682 | if (*fdwp) |
683 | xfree(*fdwp); | 683 | xfree(*fdwp); |
684 | *fdrp = xmalloc(sz); | 684 | *fdrp = xmalloc(sz); |
685 | *fdwp = xmalloc(sz); | 685 | *fdwp = xmalloc(sz); |
686 | *fdl = n; | 686 | *nallocp = sz; |
687 | } | 687 | } |
688 | if (n < *fdl) | ||
689 | debug("XXX shrink: %d < %d", n, *fdl); | ||
690 | *fdl = n; | ||
688 | memset(*fdrp, 0, sz); | 691 | memset(*fdrp, 0, sz); |
689 | memset(*fdwp, 0, sz); | 692 | memset(*fdwp, 0, sz); |
690 | 693 | ||
@@ -824,7 +827,7 @@ usage(void) | |||
824 | int | 827 | int |
825 | main(int ac, char **av) | 828 | main(int ac, char **av) |
826 | { | 829 | { |
827 | int sock, c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0, ch; | 830 | int sock, c_flag = 0, d_flag = 0, k_flag = 0, s_flag = 0, ch, nalloc; |
828 | struct sockaddr_un sunaddr; | 831 | struct sockaddr_un sunaddr; |
829 | #ifdef HAVE_SETRLIMIT | 832 | #ifdef HAVE_SETRLIMIT |
830 | struct rlimit rlim; | 833 | struct rlimit rlim; |
@@ -1017,8 +1020,10 @@ skip: | |||
1017 | signal(SIGPIPE, SIG_IGN); | 1020 | signal(SIGPIPE, SIG_IGN); |
1018 | signal(SIGHUP, cleanup_handler); | 1021 | signal(SIGHUP, cleanup_handler); |
1019 | signal(SIGTERM, cleanup_handler); | 1022 | signal(SIGTERM, cleanup_handler); |
1023 | nalloc = 0; | ||
1024 | |||
1020 | while (1) { | 1025 | while (1) { |
1021 | prepare_select(&readsetp, &writesetp, &max_fd); | 1026 | prepare_select(&readsetp, &writesetp, &max_fd, &nalloc); |
1022 | if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) { | 1027 | if (select(max_fd + 1, readsetp, writesetp, NULL, NULL) < 0) { |
1023 | if (errno == EINTR) | 1028 | if (errno == EINTR) |
1024 | continue; | 1029 | continue; |