summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/servconf.c b/servconf.c
index 96ad18084..9e420a527 100644
--- a/servconf.c
+++ b/servconf.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: servconf.c,v 1.140 2005/03/10 22:01:05 deraadt Exp $"); 13RCSID("$OpenBSD: servconf.c,v 1.144 2005/08/06 10:03:12 dtucker Exp $");
14 14
15#include "ssh.h" 15#include "ssh.h"
16#include "log.h" 16#include "log.h"
@@ -201,7 +201,7 @@ fill_default_server_options(ServerOptions *options)
201 if (options->use_login == -1) 201 if (options->use_login == -1)
202 options->use_login = 0; 202 options->use_login = 0;
203 if (options->compression == -1) 203 if (options->compression == -1)
204 options->compression = 1; 204 options->compression = COMP_DELAYED;
205 if (options->allow_tcp_forwarding == -1) 205 if (options->allow_tcp_forwarding == -1)
206 options->allow_tcp_forwarding = 1; 206 options->allow_tcp_forwarding = 1;
207 if (options->gateway_ports == -1) 207 if (options->gateway_ports == -1)
@@ -398,7 +398,7 @@ parse_token(const char *cp, const char *filename,
398static void 398static void
399add_listen_addr(ServerOptions *options, char *addr, u_short port) 399add_listen_addr(ServerOptions *options, char *addr, u_short port)
400{ 400{
401 int i; 401 u_int i;
402 402
403 if (options->num_ports == 0) 403 if (options->num_ports == 0)
404 options->ports[options->num_ports++] = SSH_DEFAULT_PORT; 404 options->ports[options->num_ports++] = SSH_DEFAULT_PORT;
@@ -438,9 +438,10 @@ process_server_config_line(ServerOptions *options, char *line,
438 const char *filename, int linenum) 438 const char *filename, int linenum)
439{ 439{
440 char *cp, **charptr, *arg, *p; 440 char *cp, **charptr, *arg, *p;
441 int *intptr, value, i, n; 441 int *intptr, value, n;
442 ServerOpCodes opcode; 442 ServerOpCodes opcode;
443 u_short port; 443 u_short port;
444 u_int i;
444 445
445 cp = line; 446 cp = line;
446 arg = strdelim(&cp); 447 arg = strdelim(&cp);
@@ -516,6 +517,12 @@ parse_time:
516 if (arg == NULL || *arg == '\0') 517 if (arg == NULL || *arg == '\0')
517 fatal("%s line %d: missing address", 518 fatal("%s line %d: missing address",
518 filename, linenum); 519 filename, linenum);
520 /* check for bare IPv6 address: no "[]" and 2 or more ":" */
521 if (strchr(arg, '[') == NULL && (p = strchr(arg, ':')) != NULL
522 && strchr(p+1, ':') != NULL) {
523 add_listen_addr(options, arg, 0);
524 break;
525 }
519 p = hpdelim(&arg); 526 p = hpdelim(&arg);
520 if (p == NULL) 527 if (p == NULL)
521 fatal("%s line %d: bad address:port usage", 528 fatal("%s line %d: bad address:port usage",
@@ -532,6 +539,9 @@ parse_time:
532 539
533 case sAddressFamily: 540 case sAddressFamily:
534 arg = strdelim(&cp); 541 arg = strdelim(&cp);
542 if (!arg || *arg == '\0')
543 fatal("%s line %d: missing address family.",
544 filename, linenum);
535 intptr = &options->address_family; 545 intptr = &options->address_family;
536 if (options->listen_addrs != NULL) 546 if (options->listen_addrs != NULL)
537 fatal("%s line %d: address family must be specified before " 547 fatal("%s line %d: address family must be specified before "
@@ -721,7 +731,23 @@ parse_flag:
721 731
722 case sCompression: 732 case sCompression:
723 intptr = &options->compression; 733 intptr = &options->compression;
724 goto parse_flag; 734 arg = strdelim(&cp);
735 if (!arg || *arg == '\0')
736 fatal("%s line %d: missing yes/no/delayed "
737 "argument.", filename, linenum);
738 value = 0; /* silence compiler */
739 if (strcmp(arg, "delayed") == 0)
740 value = COMP_DELAYED;
741 else if (strcmp(arg, "yes") == 0)
742 value = COMP_ZLIB;
743 else if (strcmp(arg, "no") == 0)
744 value = COMP_NONE;
745 else
746 fatal("%s line %d: Bad yes/no/delayed "
747 "argument: %s", filename, linenum, arg);
748 if (*intptr == -1)
749 *intptr = value;
750 break;
725 751
726 case sGatewayPorts: 752 case sGatewayPorts:
727 intptr = &options->gateway_ports; 753 intptr = &options->gateway_ports;