summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/servconf.c b/servconf.c
index 541a9c85b..2d1a0c362 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.138 2004/12/23 23:11:00 djm Exp $"); 13RCSID("$OpenBSD: servconf.c,v 1.139 2005/03/01 10:09:52 djm Exp $");
14 14
15#include "ssh.h" 15#include "ssh.h"
16#include "log.h" 16#include "log.h"
@@ -440,6 +440,7 @@ process_server_config_line(ServerOptions *options, char *line,
440 char *cp, **charptr, *arg, *p; 440 char *cp, **charptr, *arg, *p;
441 int *intptr, value, i, n; 441 int *intptr, value, i, n;
442 ServerOpCodes opcode; 442 ServerOpCodes opcode;
443 u_short port;
443 444
444 cp = line; 445 cp = line;
445 arg = strdelim(&cp); 446 arg = strdelim(&cp);
@@ -512,39 +513,21 @@ parse_time:
512 513
513 case sListenAddress: 514 case sListenAddress:
514 arg = strdelim(&cp); 515 arg = strdelim(&cp);
515 if (!arg || *arg == '\0' || strncmp(arg, "[]", 2) == 0) 516 if (arg == NULL || *arg == '\0')
516 fatal("%s line %d: missing inet addr.", 517 fatal("%s line %d: missing address",
517 filename, linenum); 518 filename, linenum);
518 if (*arg == '[') { 519 p = hpdelim(&arg);
519 if ((p = strchr(arg, ']')) == NULL) 520 if (p == NULL)
520 fatal("%s line %d: bad ipv6 inet addr usage.", 521 fatal("%s line %d: bad address:port usage",
521 filename, linenum);
522 arg++;
523 memmove(p, p+1, strlen(p+1)+1);
524 } else if (((p = strchr(arg, ':')) == NULL) ||
525 (strchr(p+1, ':') != NULL)) {
526 add_listen_addr(options, arg, 0);
527 break;
528 }
529 if (*p == ':') {
530 u_short port;
531
532 p++;
533 if (*p == '\0')
534 fatal("%s line %d: bad inet addr:port usage.",
535 filename, linenum);
536 else {
537 *(p-1) = '\0';
538 if ((port = a2port(p)) == 0)
539 fatal("%s line %d: bad port number.",
540 filename, linenum);
541 add_listen_addr(options, arg, port);
542 }
543 } else if (*p == '\0')
544 add_listen_addr(options, arg, 0);
545 else
546 fatal("%s line %d: bad inet addr usage.",
547 filename, linenum); 522 filename, linenum);
523 p = cleanhostname(p);
524 if (arg == NULL)
525 port = 0;
526 else if ((port = a2port(arg)) == 0)
527 fatal("%s line %d: bad port number", filename, linenum);
528
529 add_listen_addr(options, p, port);
530
548 break; 531 break;
549 532
550 case sAddressFamily: 533 case sAddressFamily:
@@ -742,7 +725,23 @@ parse_flag:
742 725
743 case sGatewayPorts: 726 case sGatewayPorts:
744 intptr = &options->gateway_ports; 727 intptr = &options->gateway_ports;
745 goto parse_flag; 728 arg = strdelim(&cp);
729 if (!arg || *arg == '\0')
730 fatal("%s line %d: missing yes/no/clientspecified "
731 "argument.", filename, linenum);
732 value = 0; /* silence compiler */
733 if (strcmp(arg, "clientspecified") == 0)
734 value = 2;
735 else if (strcmp(arg, "yes") == 0)
736 value = 1;
737 else if (strcmp(arg, "no") == 0)
738 value = 0;
739 else
740 fatal("%s line %d: Bad yes/no/clientspecified "
741 "argument: %s", filename, linenum, arg);
742 if (*intptr == -1)
743 *intptr = value;
744 break;
746 745
747 case sUseDNS: 746 case sUseDNS:
748 intptr = &options->use_dns; 747 intptr = &options->use_dns;