summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2009-02-14 16:33:09 +1100
committerDamien Miller <djm@mindrot.org>2009-02-14 16:33:09 +1100
commit330d58587f05fd34f3b1d20a64d254ea0470a6cc (patch)
treeafd4ab7d7bf3c8caf9743388f8e3ebddf8e2e458 /serverloop.c
parent4bf648f7766ba764d7a78b1dbb26df4f0d42a8c9 (diff)
- 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.c11
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 @@
1/* $OpenBSD: serverloop.c,v 1.156 2009/02/12 03:00:56 djm Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.157 2009/02/12 03:16:01 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
@@ -1117,10 +1117,10 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
1117 1117
1118 /* check permissions */ 1118 /* check permissions */
1119 if (!options.allow_tcp_forwarding || 1119 if (!options.allow_tcp_forwarding ||
1120 no_port_forwarding_flag 1120 no_port_forwarding_flag ||
1121 (!want_reply && listen_port == 0)
1121#ifndef NO_IPPORT_RESERVED_CONCEPT 1122#ifndef NO_IPPORT_RESERVED_CONCEPT
1122 || (listen_port != 0 && 1123 || (listen_port < IPPORT_RESERVED && pw->pw_uid != 0)
1123 listen_port < IPPORT_RESERVED && pw->pw_uid != 0)
1124#endif 1124#endif
1125 ) { 1125 ) {
1126 success = 0; 1126 success = 0;
@@ -1128,7 +1128,8 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
1128 } else { 1128 } else {
1129 /* Start listening on the port */ 1129 /* Start listening on the port */
1130 success = channel_setup_remote_fwd_listener( 1130 success = channel_setup_remote_fwd_listener(
1131 listen_address, listen_port, options.gateway_ports); 1131 listen_address, listen_port,
1132 &allocated_listen_port, options.gateway_ports);
1132 } 1133 }
1133 xfree(listen_address); 1134 xfree(listen_address);
1134 } else if (strcmp(rtype, "cancel-tcpip-forward") == 0) { 1135 } else if (strcmp(rtype, "cancel-tcpip-forward") == 0) {