summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c55
1 files changed, 24 insertions, 31 deletions
diff --git a/readconf.c b/readconf.c
index d334ed437..04895be6d 100644
--- a/readconf.c
+++ b/readconf.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.87 2001/08/28 09:51:26 markus Exp $"); 15RCSID("$OpenBSD: readconf.c,v 1.88 2001/08/30 16:04:35 stevesk Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
@@ -260,6 +260,7 @@ process_config_line(Options *options, const char *host,
260 char buf[256], *s, *string, **charptr, *endofnumber, *keyword, *arg; 260 char buf[256], *s, *string, **charptr, *endofnumber, *keyword, *arg;
261 int opcode, *intptr, value; 261 int opcode, *intptr, value;
262 u_short fwd_port, fwd_host_port; 262 u_short fwd_port, fwd_host_port;
263 char sfwd_host_port[6];
263 264
264 s = line; 265 s = line;
265 /* Get the keyword. (Each line is supposed to begin with a keyword). */ 266 /* Get the keyword. (Each line is supposed to begin with a keyword). */
@@ -577,42 +578,34 @@ parse_int:
577 *intptr = (LogLevel) value; 578 *intptr = (LogLevel) value;
578 break; 579 break;
579 580
580 case oRemoteForward:
581 arg = strdelim(&s);
582 if (!arg || *arg == '\0')
583 fatal("%.200s line %d: Missing argument.", filename, linenum);
584 fwd_port = a2port(arg);
585 if (fwd_port == 0)
586 fatal("%.200s line %d: Badly formatted port number.",
587 filename, linenum);
588 arg = strdelim(&s);
589 if (!arg || *arg == '\0')
590 fatal("%.200s line %d: Missing second argument.",
591 filename, linenum);
592 if (sscanf(arg, "%255[^:]:%hu", buf, &fwd_host_port) != 2)
593 fatal("%.200s line %d: Badly formatted host:port.",
594 filename, linenum);
595 if (*activep)
596 add_remote_forward(options, fwd_port, buf, fwd_host_port);
597 break;
598
599 case oLocalForward: 581 case oLocalForward:
582 case oRemoteForward:
600 arg = strdelim(&s); 583 arg = strdelim(&s);
601 if (!arg || *arg == '\0') 584 if (!arg || *arg == '\0')
602 fatal("%.200s line %d: Missing argument.", filename, linenum); 585 fatal("%.200s line %d: Missing port argument.",
603 fwd_port = a2port(arg); 586 filename, linenum);
604 if (fwd_port == 0) 587 if ((fwd_port = a2port(arg)) == 0)
605 fatal("%.200s line %d: Badly formatted port number.", 588 fatal("%.200s line %d: Bad listen port.",
606 filename, linenum); 589 filename, linenum);
607 arg = strdelim(&s); 590 arg = strdelim(&s);
608 if (!arg || *arg == '\0') 591 if (!arg || *arg == '\0')
609 fatal("%.200s line %d: Missing second argument.", 592 fatal("%.200s line %d: Missing second argument.",
610 filename, linenum); 593 filename, linenum);
611 if (sscanf(arg, "%255[^:]:%hu", buf, &fwd_host_port) != 2) 594 if (sscanf(arg, "%255[^:]:%5[0-9]", buf, sfwd_host_port) != 2 &&
612 fatal("%.200s line %d: Badly formatted host:port.", 595 sscanf(arg, "%255[^/]/%5[0-9]", buf, sfwd_host_port) != 2)
613 filename, linenum); 596 fatal("%.200s line %d: Bad forwarding specification.",
614 if (*activep) 597 filename, linenum);
615 add_local_forward(options, fwd_port, buf, fwd_host_port); 598 if ((fwd_host_port = a2port(sfwd_host_port)) == 0)
599 fatal("%.200s line %d: Bad forwarding port.",
600 filename, linenum);
601 if (*activep) {
602 if (opcode == oLocalForward)
603 add_local_forward(options, fwd_port, buf,
604 fwd_host_port);
605 else if (opcode == oRemoteForward)
606 add_remote_forward(options, fwd_port, buf,
607 fwd_host_port);
608 }
616 break; 609 break;
617 610
618 case oDynamicForward: 611 case oDynamicForward: