148
148
/* The only global success/failure messages are for remotetcp.
149
149
* Since there isn't any identifier in these messages, we have to rely on them
150
150
* being in the same order as we sent the requests. This is the ordering
151
* of the cli_opts.remotefwds list */
151
* of the cli_opts.remotefwds list.
152
* If the requested remote port is 0 the listen port will be
153
* dynamically allocated by the server and the port number will be returned
154
* to client and the port number reported to the user. */
152
155
void cli_recv_msg_request_success() {
153
/* Nothing in the packet. We just mark off that we have received the reply,
156
/* We just mark off that we have received the reply,
154
157
* so that we can report failure for later ones. */
155
158
m_list_elem * iter = NULL;
156
159
for (iter = cli_opts.remotefwds->first; iter; iter = iter->next) {
157
160
struct TCPFwdEntry *fwd = (struct TCPFwdEntry*)iter->item;
158
161
if (!fwd->have_reply) {
159
162
fwd->have_reply = 1;
163
if (fwd->listenport == 0) {
164
/* The server should let us know which port was allocated if we requestd port 0 */
165
int allocport = buf_getint(ses.payload);
167
dropbear_log(LOG_INFO, "Allocated port %d for remote forward to %s:%d",
168
allocport, fwd->connectaddr, fwd->connectport);