summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2009-02-14 16:28:21 +1100
committerDamien Miller <djm@mindrot.org>2009-02-14 16:28:21 +1100
commit4bf648f7766ba764d7a78b1dbb26df4f0d42a8c9 (patch)
treecc576e28218cb3ad9617a12eabe68c21a7e09614 /readconf.c
parentfdd66fc750228b5d040c45bc36565299374b72c8 (diff)
- djm@cvs.openbsd.org 2009/02/12 03:00:56
[canohost.c canohost.h channels.c channels.h clientloop.c readconf.c] [readconf.h serverloop.c ssh.c] support remote port forwarding with a zero listen port (-R0:...) to dyamically allocate a listen port at runtime (this is actually specified in rfc4254); bz#1003 ok markus@
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/readconf.c b/readconf.c
index 0a8be1400..53fc6c7ba 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.175 2009/01/22 10:02:34 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.176 2009/02/12 03:00:56 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -735,7 +735,8 @@ parse_int:
735 } 735 }
736 736
737 if (parse_forward(&fwd, fwdarg, 737 if (parse_forward(&fwd, fwdarg,
738 opcode == oDynamicForward ? 1 : 0) == 0) 738 opcode == oDynamicForward ? 1 : 0,
739 opcode == oRemoteForward ? 1 : 0) == 0)
739 fatal("%.200s line %d: Bad forwarding specification.", 740 fatal("%.200s line %d: Bad forwarding specification.",
740 filename, linenum); 741 filename, linenum);
741 742
@@ -1220,7 +1221,7 @@ fill_default_options(Options * options)
1220 * returns number of arguments parsed or zero on error 1221 * returns number of arguments parsed or zero on error
1221 */ 1222 */
1222int 1223int
1223parse_forward(Forward *fwd, const char *fwdspec, int dynamicfwd) 1224parse_forward(Forward *fwd, const char *fwdspec, int dynamicfwd, int remotefwd)
1224{ 1225{
1225 int i; 1226 int i;
1226 char *p, *cp, *fwdarg[4]; 1227 char *p, *cp, *fwdarg[4];
@@ -1283,12 +1284,16 @@ parse_forward(Forward *fwd, const char *fwdspec, int dynamicfwd)
1283 goto fail_free; 1284 goto fail_free;
1284 } 1285 }
1285 1286
1286 if (fwd->listen_port <= 0) 1287 if (fwd->listen_port < 0 || (!remotefwd && fwd->listen_port == 0))
1287 goto fail_free; 1288 goto fail_free;
1288 1289
1289 if (fwd->connect_host != NULL && 1290 if (fwd->connect_host != NULL &&
1290 strlen(fwd->connect_host) >= NI_MAXHOST) 1291 strlen(fwd->connect_host) >= NI_MAXHOST)
1291 goto fail_free; 1292 goto fail_free;
1293 if (fwd->listen_host != NULL &&
1294 strlen(fwd->listen_host) >= NI_MAXHOST)
1295 goto fail_free;
1296
1292 1297
1293 return (i); 1298 return (i);
1294 1299