diff options
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/serverloop.c b/serverloop.c index 931779e30..6244ad71c 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.c,v 1.155 2009/01/22 10:02:34 djm Exp $ */ | 1 | /* $OpenBSD: serverloop.c,v 1.156 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 |
@@ -1095,7 +1095,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1095 | { | 1095 | { |
1096 | char *rtype; | 1096 | char *rtype; |
1097 | int want_reply; | 1097 | int want_reply; |
1098 | int success = 0; | 1098 | int success = 0, allocated_listen_port = 0; |
1099 | 1099 | ||
1100 | rtype = packet_get_string(NULL); | 1100 | rtype = packet_get_string(NULL); |
1101 | want_reply = packet_get_char(); | 1101 | want_reply = packet_get_char(); |
@@ -1119,7 +1119,8 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1119 | if (!options.allow_tcp_forwarding || | 1119 | if (!options.allow_tcp_forwarding || |
1120 | no_port_forwarding_flag | 1120 | no_port_forwarding_flag |
1121 | #ifndef NO_IPPORT_RESERVED_CONCEPT | 1121 | #ifndef NO_IPPORT_RESERVED_CONCEPT |
1122 | || (listen_port < IPPORT_RESERVED && pw->pw_uid != 0) | 1122 | || (listen_port != 0 && |
1123 | listen_port < IPPORT_RESERVED && pw->pw_uid != 0) | ||
1123 | #endif | 1124 | #endif |
1124 | ) { | 1125 | ) { |
1125 | success = 0; | 1126 | success = 0; |
@@ -1149,6 +1150,8 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1149 | if (want_reply) { | 1150 | if (want_reply) { |
1150 | packet_start(success ? | 1151 | packet_start(success ? |
1151 | SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE); | 1152 | SSH2_MSG_REQUEST_SUCCESS : SSH2_MSG_REQUEST_FAILURE); |
1153 | if (success && allocated_listen_port > 0) | ||
1154 | packet_put_int(allocated_listen_port); | ||
1152 | packet_send(); | 1155 | packet_send(); |
1153 | packet_write_wait(); | 1156 | packet_write_wait(); |
1154 | } | 1157 | } |