diff options
author | Damien Miller <djm@mindrot.org> | 2009-02-14 06:33:09 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2009-02-14 06:33:09 +0100 |
commit | 330d58587f05fd34f3b1d20a64d254ea0470a6cc (patch) | |
tree | afd4ab7d7bf3c8caf9743388f8e3ebddf8e2e458 /serverloop.c | |
parent | - djm@cvs.openbsd.org 2009/02/12 03:00:56 (diff) | |
download | openssh-330d58587f05fd34f3b1d20a64d254ea0470a6cc.tar.xz openssh-330d58587f05fd34f3b1d20a64d254ea0470a6cc.zip |
- djm@cvs.openbsd.org 2009/02/12 03:16:01
[serverloop.c]
tighten check for -R0:... forwarding: only allow dynamic allocation
if want_reply is set in the packet
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/serverloop.c b/serverloop.c index 6244ad71c..81cafe6ad 100644 --- a/serverloop.c +++ b/serverloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: serverloop.c,v 1.156 2009/02/12 03:00:56 djm Exp $ */ +/* $OpenBSD: serverloop.c,v 1.157 2009/02/12 03:16:01 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1117,10 +1117,10 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) /* check permissions */ if (!options.allow_tcp_forwarding || - no_port_forwarding_flag + no_port_forwarding_flag || + (!want_reply && listen_port == 0) #ifndef NO_IPPORT_RESERVED_CONCEPT - || (listen_port != 0 && - listen_port < IPPORT_RESERVED && pw->pw_uid != 0) + || (listen_port < IPPORT_RESERVED && pw->pw_uid != 0) #endif ) { success = 0; @@ -1128,7 +1128,8 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) } else { /* Start listening on the port */ success = channel_setup_remote_fwd_listener( - listen_address, listen_port, options.gateway_ports); + listen_address, listen_port, + &allocated_listen_port, options.gateway_ports); } xfree(listen_address); } else if (strcmp(rtype, "cancel-tcpip-forward") == 0) { |