~ubuntu-branches/debian/jessie/dropbear/jessie

« back to all changes in this revision

Viewing changes to cli-tcpfwd.c

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2011-11-16 12:36:03 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20111116123603-qglj410f11op2gg0
Tags: upstream-2011.54
ImportĀ upstreamĀ versionĀ 2011.54

Show diffs side-by-side

added added

removed removed

Lines of Context:
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);
 
166
                                if (allocport > 0) {
 
167
                                        dropbear_log(LOG_INFO, "Allocated port %d for remote forward to %s:%d", 
 
168
                                                        allocport, fwd->connectaddr, fwd->connectport);
 
169
                                }
 
170
                        }
160
171
                        return;
161
172
                }
162
173
        }