Mercurial > dropbear
comparison cli-tcpfwd.c @ 546:568638be7203 agent-client
propagate from branch 'au.asn.ucc.matt.dropbear' (head 899a8851a5edf840b2f7925bcc26ffe99dcac54d)
to branch 'au.asn.ucc.matt.dropbear.cli-agent' (head 6bbab8364de17bd9ecb1dee5ffb796e48c0380d2)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 01 Jul 2009 04:16:32 +0000 |
parents | 805e557fdff7 |
children | c3f2ec71e3d4 69e98c45db7c |
comparison
equal
deleted
inserted
replaced
500:d588e3ea557a | 546:568638be7203 |
---|---|
126 TRACE(("enter send_msg_global_request_remotetcp")) | 126 TRACE(("enter send_msg_global_request_remotetcp")) |
127 | 127 |
128 CHECKCLEARTOWRITE(); | 128 CHECKCLEARTOWRITE(); |
129 buf_putbyte(ses.writepayload, SSH_MSG_GLOBAL_REQUEST); | 129 buf_putbyte(ses.writepayload, SSH_MSG_GLOBAL_REQUEST); |
130 buf_putstring(ses.writepayload, "tcpip-forward", 13); | 130 buf_putstring(ses.writepayload, "tcpip-forward", 13); |
131 buf_putbyte(ses.writepayload, 0); | 131 buf_putbyte(ses.writepayload, 1); /* want_reply */ |
132 if (opts.listen_fwd_all) { | 132 if (opts.listen_fwd_all) { |
133 listenspec = ""; | 133 listenspec = ""; |
134 } else { | 134 } else { |
135 listenspec = "localhost"; | 135 listenspec = "localhost"; |
136 } | 136 } |
139 buf_putint(ses.writepayload, port); | 139 buf_putint(ses.writepayload, port); |
140 | 140 |
141 encrypt_packet(); | 141 encrypt_packet(); |
142 | 142 |
143 TRACE(("leave send_msg_global_request_remotetcp")) | 143 TRACE(("leave send_msg_global_request_remotetcp")) |
144 } | |
145 | |
146 /* The only global success/failure messages are for remotetcp. | |
147 * Since there isn't any identifier in these messages, we have to rely on them | |
148 * being in the same order as we sent the requests. This is the ordering | |
149 * of the cli_opts.remotefwds list */ | |
150 void cli_recv_msg_request_success() { | |
151 | |
152 /* Nothing in the packet. We just mark off that we have received the reply, | |
153 * so that we can report failure for later ones. */ | |
154 struct TCPFwdList * iter = NULL; | |
155 | |
156 iter = cli_opts.remotefwds; | |
157 while (iter != NULL) { | |
158 if (!iter->have_reply) | |
159 { | |
160 iter->have_reply = 1; | |
161 return; | |
162 } | |
163 iter = iter->next; | |
164 } | |
165 } | |
166 | |
167 void cli_recv_msg_request_failure() { | |
168 struct TCPFwdList * iter = NULL; | |
169 | |
170 iter = cli_opts.remotefwds; | |
171 while (iter != NULL) { | |
172 if (!iter->have_reply) | |
173 { | |
174 iter->have_reply = 1; | |
175 dropbear_log(LOG_WARNING, "Remote TCP forward request failed (port %d -> %s:%d)", iter->listenport, iter->connectaddr, iter->connectport); | |
176 return; | |
177 } | |
178 iter = iter->next; | |
179 } | |
144 } | 180 } |
145 | 181 |
146 void setup_remotetcp() { | 182 void setup_remotetcp() { |
147 | 183 |
148 struct TCPFwdList * iter = NULL; | 184 struct TCPFwdList * iter = NULL; |