summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2007-06-12 16:16:35 +0000
committerColin Watson <cjwatson@debian.org>2007-06-12 16:16:35 +0000
commitb7e40fa9da0b5491534a429dadb321eab5a77558 (patch)
treebed1da11e9f829925797aa093e379fc0b5868ecd /ssh-keyscan.c
parent4f84beedf1005e44ff33c854abd6b711ffc0adb7 (diff)
parent086ea76990b1e6287c24b6db74adffd4605eb3b0 (diff)
* New upstream release (closes: #395507, #397961, #420035). Important
changes not previously backported to 4.3p2: - 4.4/4.4p1 (http://www.openssh.org/txt/release-4.4): + On portable OpenSSH, fix a GSSAPI authentication abort that could be used to determine the validity of usernames on some platforms. + Implemented conditional configuration in sshd_config(5) using the "Match" directive. This allows some configuration options to be selectively overridden if specific criteria (based on user, group, hostname and/or address) are met. So far a useful subset of post-authentication options are supported and more are expected to be added in future releases. + Add support for Diffie-Hellman group exchange key agreement with a final hash of SHA256. + Added a "ForceCommand" directive to sshd_config(5). Similar to the command="..." option accepted in ~/.ssh/authorized_keys, this forces the execution of the specified command regardless of what the user requested. This is very useful in conjunction with the new "Match" option. + Add a "PermitOpen" directive to sshd_config(5). This mirrors the permitopen="..." authorized_keys option, allowing fine-grained control over the port-forwardings that a user is allowed to establish. + Add optional logging of transactions to sftp-server(8). + ssh(1) will now record port numbers for hosts stored in ~/.ssh/known_hosts when a non-standard port has been requested (closes: #50612). + Add an "ExitOnForwardFailure" option to cause ssh(1) to exit (with a non-zero exit code) when requested port forwardings could not be established. + Extend sshd_config(5) "SubSystem" declarations to allow the specification of command-line arguments. + Replacement of all integer overflow susceptible invocations of malloc(3) and realloc(3) with overflow-checking equivalents. + Many manpage fixes and improvements. + Add optional support for OpenSSL hardware accelerators (engines), enabled using the --with-ssl-engine configure option. + Tokens in configuration files may be double-quoted in order to contain spaces (closes: #319639). + Move a debug() call out of a SIGCHLD handler, fixing a hang when the session exits very quickly (closes: #307890). + Fix some incorrect buffer allocation calculations (closes: #410599). + ssh-add doesn't ask for a passphrase if key file permissions are too liberal (closes: #103677). + Likewise, ssh doesn't ask either (closes: #99675). - 4.6/4.6p1 (http://www.openssh.org/txt/release-4.6): + sshd now allows the enabling and disabling of authentication methods on a per user, group, host and network basis via the Match directive in sshd_config. + Fixed an inconsistent check for a terminal when displaying scp progress meter (closes: #257524). + Fix "hang on exit" when background processes are running at the time of exit on a ttyful/login session (closes: #88337). * Update to current GSSAPI patch from http://www.sxw.org.uk/computing/patches/openssh-4.6p1-gsskex-20070312.patch; install ChangeLog.gssapi.
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index f429c2c02..7ffbda421 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,3 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.74 2006/10/06 02:29:19 djm Exp $ */
1/* 2/*
2 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
3 * 4 *
@@ -7,24 +8,39 @@
7 */ 8 */
8 9
9#include "includes.h" 10#include "includes.h"
10RCSID("$OpenBSD: ssh-keyscan.c,v 1.57 2005/10/30 04:01:03 djm Exp $"); 11
11
12#include "openbsd-compat/sys-queue.h" 12#include "openbsd-compat/sys-queue.h"
13#include <sys/resource.h>
14#ifdef HAVE_SYS_TIME_H
15# include <sys/time.h>
16#endif
17
18#include <netinet/in.h>
19#include <arpa/inet.h>
13 20
14#include <openssl/bn.h> 21#include <openssl/bn.h>
15 22
23#include <netdb.h>
24#include <errno.h>
16#include <setjmp.h> 25#include <setjmp.h>
26#include <stdarg.h>
27#include <stdio.h>
28#include <stdlib.h>
29#include <signal.h>
30#include <string.h>
31#include <unistd.h>
32
17#include "xmalloc.h" 33#include "xmalloc.h"
18#include "ssh.h" 34#include "ssh.h"
19#include "ssh1.h" 35#include "ssh1.h"
36#include "buffer.h"
20#include "key.h" 37#include "key.h"
38#include "cipher.h"
21#include "kex.h" 39#include "kex.h"
22#include "compat.h" 40#include "compat.h"
23#include "myproposal.h" 41#include "myproposal.h"
24#include "packet.h" 42#include "packet.h"
25#include "dispatch.h" 43#include "dispatch.h"
26#include "buffer.h"
27#include "bufaux.h"
28#include "log.h" 44#include "log.h"
29#include "atomicio.h" 45#include "atomicio.h"
30#include "misc.h" 46#include "misc.h"
@@ -54,7 +70,7 @@ int maxfd;
54 70
55extern char *__progname; 71extern char *__progname;
56fd_set *read_wait; 72fd_set *read_wait;
57size_t read_wait_size; 73size_t read_wait_nfdset;
58int ncon; 74int ncon;
59int nonfatal_fatal = 0; 75int nonfatal_fatal = 0;
60jmp_buf kexjmp; 76jmp_buf kexjmp;
@@ -128,7 +144,7 @@ Linebuf_alloc(const char *filename, void (*errfun) (const char *,...))
128 lb->stream = stdin; 144 lb->stream = stdin;
129 } 145 }
130 146
131 if (!(lb->buf = malloc(lb->size = LINEBUF_SIZE))) { 147 if (!(lb->buf = malloc((lb->size = LINEBUF_SIZE)))) {
132 if (errfun) 148 if (errfun)
133 (*errfun) ("linebuf (%s): malloc failed\n", lb->filename); 149 (*errfun) ("linebuf (%s): malloc failed\n", lb->filename);
134 xfree(lb); 150 xfree(lb);
@@ -350,6 +366,7 @@ keygrab_ssh2(con *c)
350 c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; 366 c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;
351 c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; 367 c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;
352 c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; 368 c->c_kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;
369 c->c_kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;
353 c->c_kex->verify_host_key = hostjump; 370 c->c_kex->verify_host_key = hostjump;
354 371
355 if (!(j = setjmp(kexjmp))) { 372 if (!(j = setjmp(kexjmp))) {
@@ -602,7 +619,6 @@ conread(int s)
602 keyprint(c, keygrab_ssh1(c)); 619 keyprint(c, keygrab_ssh1(c));
603 confree(s); 620 confree(s);
604 return; 621 return;
605 break;
606 default: 622 default:
607 fatal("conread: invalid status %d", c->c_status); 623 fatal("conread: invalid status %d", c->c_status);
608 break; 624 break;
@@ -634,10 +650,10 @@ conloop(void)
634 } else 650 } else
635 seltime.tv_sec = seltime.tv_usec = 0; 651 seltime.tv_sec = seltime.tv_usec = 0;
636 652
637 r = xmalloc(read_wait_size); 653 r = xcalloc(read_wait_nfdset, sizeof(fd_mask));
638 memcpy(r, read_wait, read_wait_size); 654 e = xcalloc(read_wait_nfdset, sizeof(fd_mask));
639 e = xmalloc(read_wait_size); 655 memcpy(r, read_wait, read_wait_nfdset * sizeof(fd_mask));
640 memcpy(e, read_wait, read_wait_size); 656 memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask));
641 657
642 while (select(maxfd, r, NULL, e, &seltime) == -1 && 658 while (select(maxfd, r, NULL, e, &seltime) == -1 &&
643 (errno == EAGAIN || errno == EINTR)) 659 (errno == EAGAIN || errno == EINTR))
@@ -804,12 +820,10 @@ main(int argc, char **argv)
804 fatal("%s: not enough file descriptors", __progname); 820 fatal("%s: not enough file descriptors", __progname);
805 if (maxfd > fdlim_get(0)) 821 if (maxfd > fdlim_get(0))
806 fdlim_set(maxfd); 822 fdlim_set(maxfd);
807 fdcon = xmalloc(maxfd * sizeof(con)); 823 fdcon = xcalloc(maxfd, sizeof(con));
808 memset(fdcon, 0, maxfd * sizeof(con));
809 824
810 read_wait_size = howmany(maxfd, NFDBITS) * sizeof(fd_mask); 825 read_wait_nfdset = howmany(maxfd, NFDBITS);
811 read_wait = xmalloc(read_wait_size); 826 read_wait = xcalloc(read_wait_nfdset, sizeof(fd_mask));
812 memset(read_wait, 0, read_wait_size);
813 827
814 if (fopt_count) { 828 if (fopt_count) {
815 Linebuf *lb; 829 Linebuf *lb;