summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--readconf.c55
-rw-r--r--ssh.114
3 files changed, 39 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index d678947e8..a90b6702d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,11 @@
61 - naddy@cvs.openbsd.org 2001/08/30 15:42:36 61 - naddy@cvs.openbsd.org 2001/08/30 15:42:36
62 [ssh.1] 62 [ssh.1]
63 add -D to synopsis line; ok markus@ 63 add -D to synopsis line; ok markus@
64 - stevesk@cvs.openbsd.org 2001/08/30 16:04:35
65 [readconf.c ssh.1]
66 validate ports for LocalForward/RemoteForward.
67 add host/port alternative syntax for IPv6 (like -L/-R).
68 ok markus@
64 69
6520010815 7020010815
66 - (bal) Fixed stray code in readconf.c that went in by mistake. 71 - (bal) Fixed stray code in readconf.c that went in by mistake.
@@ -6384,4 +6389,4 @@
6384 - Wrote replacements for strlcpy and mkdtemp 6389 - Wrote replacements for strlcpy and mkdtemp
6385 - Released 1.0pre1 6390 - Released 1.0pre1
6386 6391
6387$Id: ChangeLog,v 1.1503 2001/09/12 17:59:59 mouring Exp $ 6392$Id: ChangeLog,v 1.1504 2001/09/12 18:01:59 mouring Exp $
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:
diff --git a/ssh.1 b/ssh.1
index 90e32ebd6..d7529d7a9 100644
--- a/ssh.1
+++ b/ssh.1
@@ -34,7 +34,7 @@
34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 34.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36.\" 36.\"
37.\" $OpenBSD: ssh.1,v 1.135 2001/08/30 15:42:36 naddy Exp $ 37.\" $OpenBSD: ssh.1,v 1.136 2001/08/30 16:04:35 stevesk Exp $
38.Dd September 25, 1999 38.Dd September 25, 1999
39.Dt SSH 1 39.Dt SSH 1
40.Os 40.Os
@@ -943,9 +943,11 @@ or
943.Dq no . 943.Dq no .
944.It Cm LocalForward 944.It Cm LocalForward
945Specifies that a TCP/IP port on the local machine be forwarded over 945Specifies that a TCP/IP port on the local machine be forwarded over
946the secure channel to given host:port from the remote machine. 946the secure channel to the specified host and port from the remote machine.
947The first argument must be a port number, and the second must be 947The first argument must be a port number, and the second must be
948host:port. 948.Ar host:port .
949IPv6 addresses can be specified with an alternative syntax:
950.Ar host/port .
949Multiple forwardings may be specified, and additional 951Multiple forwardings may be specified, and additional
950forwardings can be given on the command line. 952forwardings can be given on the command line.
951Only the superuser can forward privileged ports. 953Only the superuser can forward privileged ports.
@@ -1037,9 +1039,11 @@ The default is
1037This option applies to protocol version 2 only. 1039This option applies to protocol version 2 only.
1038.It Cm RemoteForward 1040.It Cm RemoteForward
1039Specifies that a TCP/IP port on the remote machine be forwarded over 1041Specifies that a TCP/IP port on the remote machine be forwarded over
1040the secure channel to given host:port from the local machine. 1042the secure channel to the specified host and port from the local machine.
1041The first argument must be a port number, and the second must be 1043The first argument must be a port number, and the second must be
1042host:port. 1044.Ar host:port .
1045IPv6 addresses can be specified with an alternative syntax:
1046.Ar host/port .
1043Multiple forwardings may be specified, and additional 1047Multiple forwardings may be specified, and additional
1044forwardings can be given on the command line. 1048forwardings can be given on the command line.
1045Only the superuser can forward privileged ports. 1049Only the superuser can forward privileged ports.