diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | readconf.c | 55 | ||||
-rw-r--r-- | ssh.1 | 14 |
3 files changed, 39 insertions, 37 deletions
@@ -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 | ||
65 | 20010815 | 70 | 20010815 |
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" |
15 | RCSID("$OpenBSD: readconf.c,v 1.87 2001/08/28 09:51:26 markus Exp $"); | 15 | RCSID("$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: |
@@ -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 |
945 | Specifies that a TCP/IP port on the local machine be forwarded over | 945 | Specifies that a TCP/IP port on the local machine be forwarded over |
946 | the secure channel to given host:port from the remote machine. | 946 | the secure channel to the specified host and port from the remote machine. |
947 | The first argument must be a port number, and the second must be | 947 | The first argument must be a port number, and the second must be |
948 | host:port. | 948 | .Ar host:port . |
949 | IPv6 addresses can be specified with an alternative syntax: | ||
950 | .Ar host/port . | ||
949 | Multiple forwardings may be specified, and additional | 951 | Multiple forwardings may be specified, and additional |
950 | forwardings can be given on the command line. | 952 | forwardings can be given on the command line. |
951 | Only the superuser can forward privileged ports. | 953 | Only the superuser can forward privileged ports. |
@@ -1037,9 +1039,11 @@ The default is | |||
1037 | This option applies to protocol version 2 only. | 1039 | This option applies to protocol version 2 only. |
1038 | .It Cm RemoteForward | 1040 | .It Cm RemoteForward |
1039 | Specifies that a TCP/IP port on the remote machine be forwarded over | 1041 | Specifies that a TCP/IP port on the remote machine be forwarded over |
1040 | the secure channel to given host:port from the local machine. | 1042 | the secure channel to the specified host and port from the local machine. |
1041 | The first argument must be a port number, and the second must be | 1043 | The first argument must be a port number, and the second must be |
1042 | host:port. | 1044 | .Ar host:port . |
1045 | IPv6 addresses can be specified with an alternative syntax: | ||
1046 | .Ar host/port . | ||
1043 | Multiple forwardings may be specified, and additional | 1047 | Multiple forwardings may be specified, and additional |
1044 | forwardings can be given on the command line. | 1048 | forwardings can be given on the command line. |
1045 | Only the superuser can forward privileged ports. | 1049 | Only the superuser can forward privileged ports. |