diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 61 |
1 files changed, 48 insertions, 13 deletions
@@ -2,19 +2,45 @@ | |||
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: Fri Mar 17 17:09:28 1995 ylo | 5 | * This program is the ssh daemon. It listens for connections from clients, |
6 | * This program is the ssh daemon. It listens for connections from clients, and | 6 | * and performs authentication, executes use commands or shell, and forwards |
7 | * performs authentication, executes use commands or shell, and forwards | ||
8 | * information to/from the application to the user client over an encrypted | 7 | * information to/from the application to the user client over an encrypted |
9 | * connection. This can also handle forwarding of X11, TCP/IP, and authentication | 8 | * connection. This can also handle forwarding of X11, TCP/IP, and |
10 | * agent connections. | 9 | * authentication agent connections. |
11 | * | 10 | * |
12 | * SSH2 implementation, | 11 | * As far as I am concerned, the code I have written for this software |
13 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 12 | * can be used freely for any purpose. Any derived versions of this |
13 | * software must be clearly marked as such, and if the derived work is | ||
14 | * incompatible with the protocol description in the RFC file, it must be | ||
15 | * called by a name other than "ssh" or "Secure Shell". | ||
16 | * | ||
17 | * SSH2 implementation: | ||
18 | * | ||
19 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | ||
20 | * | ||
21 | * Redistribution and use in source and binary forms, with or without | ||
22 | * modification, are permitted provided that the following conditions | ||
23 | * are met: | ||
24 | * 1. Redistributions of source code must retain the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer. | ||
26 | * 2. Redistributions in binary form must reproduce the above copyright | ||
27 | * notice, this list of conditions and the following disclaimer in the | ||
28 | * documentation and/or other materials provided with the distribution. | ||
29 | * | ||
30 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
31 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
32 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
33 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
35 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
39 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
14 | */ | 40 | */ |
15 | 41 | ||
16 | #include "includes.h" | 42 | #include "includes.h" |
17 | RCSID("$OpenBSD: sshd.c,v 1.125 2000/08/17 20:06:34 markus Exp $"); | 43 | RCSID("$OpenBSD: sshd.c,v 1.127 2000/09/12 20:53:10 markus Exp $"); |
18 | 44 | ||
19 | #include "xmalloc.h" | 45 | #include "xmalloc.h" |
20 | #include "rsa.h" | 46 | #include "rsa.h" |
@@ -485,8 +511,15 @@ main(int ac, char **av) | |||
485 | config_file_name = optarg; | 511 | config_file_name = optarg; |
486 | break; | 512 | break; |
487 | case 'd': | 513 | case 'd': |
488 | debug_flag = 1; | 514 | if (0 == debug_flag) { |
489 | options.log_level = SYSLOG_LEVEL_DEBUG; | 515 | debug_flag = 1; |
516 | options.log_level = SYSLOG_LEVEL_DEBUG1; | ||
517 | } else if (options.log_level < SYSLOG_LEVEL_DEBUG3) { | ||
518 | options.log_level++; | ||
519 | } else { | ||
520 | fprintf(stderr, "Too high debugging level.\n"); | ||
521 | exit(1); | ||
522 | } | ||
490 | break; | 523 | break; |
491 | case 'i': | 524 | case 'i': |
492 | inetd_flag = 1; | 525 | inetd_flag = 1; |
@@ -502,8 +535,10 @@ main(int ac, char **av) | |||
502 | break; | 535 | break; |
503 | case 'p': | 536 | case 'p': |
504 | options.ports_from_cmdline = 1; | 537 | options.ports_from_cmdline = 1; |
505 | if (options.num_ports >= MAX_PORTS) | 538 | if (options.num_ports >= MAX_PORTS) { |
506 | fatal("too many ports.\n"); | 539 | fprintf(stderr, "too many ports.\n"); |
540 | exit(1); | ||
541 | } | ||
507 | options.ports[options.num_ports++] = atoi(optarg); | 542 | options.ports[options.num_ports++] = atoi(optarg); |
508 | break; | 543 | break; |
509 | case 'g': | 544 | case 'g': |
@@ -529,7 +564,7 @@ main(int ac, char **av) | |||
529 | fprintf(stderr, "Usage: %s [options]\n", av0); | 564 | fprintf(stderr, "Usage: %s [options]\n", av0); |
530 | fprintf(stderr, "Options:\n"); | 565 | fprintf(stderr, "Options:\n"); |
531 | fprintf(stderr, " -f file Configuration file (default %s)\n", SERVER_CONFIG_FILE); | 566 | fprintf(stderr, " -f file Configuration file (default %s)\n", SERVER_CONFIG_FILE); |
532 | fprintf(stderr, " -d Debugging mode\n"); | 567 | fprintf(stderr, " -d Debugging mode (multiple -d means more debugging)\n"); |
533 | fprintf(stderr, " -i Started from inetd\n"); | 568 | fprintf(stderr, " -i Started from inetd\n"); |
534 | fprintf(stderr, " -q Quiet (no logging)\n"); | 569 | fprintf(stderr, " -q Quiet (no logging)\n"); |
535 | fprintf(stderr, " -p port Listen on the specified port (default: 22)\n"); | 570 | fprintf(stderr, " -p port Listen on the specified port (default: 22)\n"); |