summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-09-16 13:29:08 +1100
committerDamien Miller <djm@mindrot.org>2000-09-16 13:29:08 +1100
commite4340be5b3ff16f4d9ba5e3ea7e449dc1b6fa7a8 (patch)
treeaba9e2ae234edeb888b922c6a13b755c1248deea /ssh.c
parentf384c366d33cb435627743f7ea0ed3f966543d40 (diff)
- (djm) Merge OpenBSD changes:
- markus@cvs.openbsd.org 2000/09/05 02:59:57 [session.c] print hostname (not hushlogin) - markus@cvs.openbsd.org 2000/09/05 13:18:48 [authfile.c ssh-add.c] enable ssh-add -d for DSA keys - markus@cvs.openbsd.org 2000/09/05 13:20:49 [sftp-server.c] cleanup - markus@cvs.openbsd.org 2000/09/06 03:46:41 [authfile.h] prototype - deraadt@cvs.openbsd.org 2000/09/07 14:27:56 [ALL] cleanup copyright notices on all files. I have attempted to be accurate with the details. everything is now under Tatu's licence (which I copied from his readme), and/or the core-sdi bsd-ish thing for deattack, or various openbsd developers under a 2-term bsd licence. We're not changing any rules, just being accurate. - markus@cvs.openbsd.org 2000/09/07 14:40:30 [channels.c channels.h clientloop.c serverloop.c ssh.c] cleanup window and packet sizes for ssh2 flow control; ok niels - markus@cvs.openbsd.org 2000/09/07 14:53:00 [scp.c] typo - markus@cvs.openbsd.org 2000/09/07 15:13:37 [auth-options.c auth-options.h auth-rh-rsa.c auth-rsa.c auth.c] [authfile.h canohost.c channels.h compat.c hostfile.h log.c match.h] [pty.c readconf.c] some more Copyright fixes - markus@cvs.openbsd.org 2000/09/08 03:02:51 [README.openssh2] bye bye - deraadt@cvs.openbsd.org 2000/09/11 18:38:33 [LICENCE cipher.c] a few more comments about it being ARC4 not RC4 - markus@cvs.openbsd.org 2000/09/12 14:53:11 [log-client.c log-server.c log.c ssh.1 ssh.c ssh.h sshd.8 sshd.c] multiple debug levels - markus@cvs.openbsd.org 2000/09/14 14:25:15 [clientloop.c] typo - deraadt@cvs.openbsd.org 2000/09/15 01:13:51 [ssh-agent.c] check return value for setenv(3) for failure, and deal appropriately
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c61
1 files changed, 48 insertions, 13 deletions
diff --git a/ssh.c b/ssh.c
index c117ad5ed..33eac930d 100644
--- a/ssh.c
+++ b/ssh.c
@@ -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"
14RCSID("$OpenBSD: ssh.c,v 1.63 2000/08/28 20:19:52 markus Exp $"); 42RCSID("$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);