diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 61 |
1 files changed, 48 insertions, 13 deletions
@@ -2,16 +2,44 @@ | |||
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
5 | * Created: Sat Mar 18 16:36:11 1995 ylo | ||
6 | * Ssh client program. This program can be used to log into a remote machine. | 5 | * Ssh client program. This program can be used to log into a remote machine. |
7 | * The software supports strong authentication, encryption, and forwarding | 6 | * The software supports strong authentication, encryption, and forwarding |
8 | * of X11, TCP/IP, and authentication connections. | 7 | * of X11, TCP/IP, and authentication connections. |
9 | * | 8 | * |
10 | * Modified to work with SSL by Niels Provos <provos@citi.umich.edu> in Canada. | 9 | * As far as I am concerned, the code I have written for this software |
10 | * can be used freely for any purpose. Any derived versions of this | ||
11 | * software must be clearly marked as such, and if the derived work is | ||
12 | * incompatible with the protocol description in the RFC file, it must be | ||
13 | * called by a name other than "ssh" or "Secure Shell". | ||
14 | * | ||
15 | * Copyright (c) 1999 Niels Provos. All rights reserved. | ||
16 | * | ||
17 | * Modified to work with SSL by Niels Provos <provos@citi.umich.edu> | ||
18 | * in Canada (German citizen). | ||
19 | * | ||
20 | * Redistribution and use in source and binary forms, with or without | ||
21 | * modification, are permitted provided that the following conditions | ||
22 | * are met: | ||
23 | * 1. Redistributions of source code must retain the above copyright | ||
24 | * notice, this list of conditions and the following disclaimer. | ||
25 | * 2. Redistributions in binary form must reproduce the above copyright | ||
26 | * notice, this list of conditions and the following disclaimer in the | ||
27 | * documentation and/or other materials provided with the distribution. | ||
28 | * | ||
29 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
30 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
31 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
32 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
33 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
34 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
38 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
11 | */ | 39 | */ |
12 | 40 | ||
13 | #include "includes.h" | 41 | #include "includes.h" |
14 | RCSID("$OpenBSD: ssh.c,v 1.63 2000/08/28 20:19:52 markus Exp $"); | 42 | RCSID("$OpenBSD: ssh.c,v 1.66 2000/09/12 20:53:10 markus Exp $"); |
15 | 43 | ||
16 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
17 | #include <openssl/dsa.h> | 45 | #include <openssl/dsa.h> |
@@ -127,6 +155,7 @@ usage() | |||
127 | fprintf(stderr, " -t Tty; allocate a tty even if command is given.\n"); | 155 | fprintf(stderr, " -t Tty; allocate a tty even if command is given.\n"); |
128 | fprintf(stderr, " -T Do not allocate a tty.\n"); | 156 | fprintf(stderr, " -T Do not allocate a tty.\n"); |
129 | fprintf(stderr, " -v Verbose; display verbose debugging messages.\n"); | 157 | fprintf(stderr, " -v Verbose; display verbose debugging messages.\n"); |
158 | fprintf(stderr, " Multiple -v increases verbosity.\n"); | ||
130 | fprintf(stderr, " -V Display version number only.\n"); | 159 | fprintf(stderr, " -V Display version number only.\n"); |
131 | fprintf(stderr, " -P Don't allocate a privileged port.\n"); | 160 | fprintf(stderr, " -P Don't allocate a privileged port.\n"); |
132 | fprintf(stderr, " -q Quiet; don't display any warning messages.\n"); | 161 | fprintf(stderr, " -q Quiet; don't display any warning messages.\n"); |
@@ -354,6 +383,16 @@ main(int ac, char **av) | |||
354 | tty_flag = 1; | 383 | tty_flag = 1; |
355 | break; | 384 | break; |
356 | case 'v': | 385 | case 'v': |
386 | if (0 == debug_flag) { | ||
387 | debug_flag = 1; | ||
388 | options.log_level = SYSLOG_LEVEL_DEBUG1; | ||
389 | } else if (options.log_level < SYSLOG_LEVEL_DEBUG3) { | ||
390 | options.log_level++; | ||
391 | break; | ||
392 | } else { | ||
393 | fatal("Too high debugging level.\n"); | ||
394 | } | ||
395 | /* fallthrough */ | ||
357 | case 'V': | 396 | case 'V': |
358 | fprintf(stderr, "SSH Version %s, protocol versions %d.%d/%d.%d.\n", | 397 | fprintf(stderr, "SSH Version %s, protocol versions %d.%d/%d.%d.\n", |
359 | SSH_VERSION, | 398 | SSH_VERSION, |
@@ -362,8 +401,6 @@ main(int ac, char **av) | |||
362 | fprintf(stderr, "Compiled with SSL (0x%8.8lx).\n", SSLeay()); | 401 | fprintf(stderr, "Compiled with SSL (0x%8.8lx).\n", SSLeay()); |
363 | if (opt == 'V') | 402 | if (opt == 'V') |
364 | exit(0); | 403 | exit(0); |
365 | debug_flag = 1; | ||
366 | options.log_level = SYSLOG_LEVEL_DEBUG; | ||
367 | break; | 404 | break; |
368 | case 'q': | 405 | case 'q': |
369 | options.log_level = SYSLOG_LEVEL_QUIET; | 406 | options.log_level = SYSLOG_LEVEL_QUIET; |
@@ -994,18 +1031,16 @@ ssh_session2(void) | |||
994 | if (daemon(1, 1) < 0) | 1031 | if (daemon(1, 1) < 0) |
995 | fatal("daemon() failed: %.200s", strerror(errno)); | 1032 | fatal("daemon() failed: %.200s", strerror(errno)); |
996 | 1033 | ||
997 | window = 32*1024; | 1034 | window = CHAN_SES_WINDOW_DEFAULT; |
998 | if (tty_flag) { | 1035 | packetmax = CHAN_SES_PACKET_DEFAULT; |
999 | packetmax = window/8; | 1036 | if (!tty_flag) { |
1000 | } else { | ||
1001 | window *= 2; | 1037 | window *= 2; |
1002 | packetmax = window/2; | 1038 | packetmax *=2; |
1003 | } | 1039 | } |
1004 | |||
1005 | /*XXX MAXPACK */ | ||
1006 | id = channel_new( | 1040 | id = channel_new( |
1007 | "session", SSH_CHANNEL_OPENING, in, out, err, | 1041 | "session", SSH_CHANNEL_OPENING, in, out, err, |
1008 | window, packetmax, CHAN_EXTENDED_WRITE, xstrdup("client-session")); | 1042 | window, packetmax, CHAN_EXTENDED_WRITE, |
1043 | xstrdup("client-session")); | ||
1009 | 1044 | ||
1010 | channel_open(id); | 1045 | channel_open(id); |
1011 | channel_register_callback(id, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, client_init, (void *)0); | 1046 | channel_register_callback(id, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, client_init, (void *)0); |