summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/channels.c b/channels.c
index fecd4540e..bef8ad6aa 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.355 2016/09/30 20:24:46 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.356 2016/10/18 17:32:54 dtucker 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
@@ -3806,45 +3806,6 @@ channel_request_rforward_cancel(struct Forward *fwd)
3806} 3806}
3807 3807
3808/* 3808/*
3809 * This is called after receiving CHANNEL_FORWARDING_REQUEST. This initates
3810 * listening for the port, and sends back a success reply (or disconnect
3811 * message if there was an error).
3812 */
3813int
3814channel_input_port_forward_request(int is_root, struct ForwardOptions *fwd_opts)
3815{
3816 int success = 0;
3817 struct Forward fwd;
3818
3819 /* Get arguments from the packet. */
3820 memset(&fwd, 0, sizeof(fwd));
3821 fwd.listen_port = packet_get_int();
3822 fwd.connect_host = packet_get_string(NULL);
3823 fwd.connect_port = packet_get_int();
3824
3825#ifndef HAVE_CYGWIN
3826 /*
3827 * Check that an unprivileged user is not trying to forward a
3828 * privileged port.
3829 */
3830 if (fwd.listen_port < IPPORT_RESERVED && !is_root)
3831 packet_disconnect(
3832 "Requested forwarding of port %d but user is not root.",
3833 fwd.listen_port);
3834 if (fwd.connect_port == 0)
3835 packet_disconnect("Dynamic forwarding denied.");
3836#endif
3837
3838 /* Initiate forwarding */
3839 success = channel_setup_local_fwd_listener(&fwd, fwd_opts);
3840
3841 /* Free the argument string. */
3842 free(fwd.connect_host);
3843
3844 return (success ? 0 : -1);
3845}
3846
3847/*
3848 * Permits opening to any host/port if permitted_opens[] is empty. This is 3809 * Permits opening to any host/port if permitted_opens[] is empty. This is
3849 * usually called by the server, because the user could connect to any port 3810 * usually called by the server, because the user could connect to any port
3850 * anyway, and the server has no way to know but to trust the client anyway. 3811 * anyway, and the server has no way to know but to trust the client anyway.