comparison cli-tcpfwd.c @ 70:b0316ce64e4b

Merging in the changes from 0.41-0.43 main Dropbear tree
author Matt Johnston <matt@ucc.asn.au>
date Thu, 12 Aug 2004 16:41:58 +0000
parents 38c3146aa23d
children e3adf4cf5465
comparison
equal deleted inserted replaced
69:59d16db56e9f 70:b0316ce64e4b
118 118
119 unsigned int origport; 119 unsigned int origport;
120 struct TCPFwdList * iter = NULL; 120 struct TCPFwdList * iter = NULL;
121 char portstring[NI_MAXSERV]; 121 char portstring[NI_MAXSERV];
122 int sock; 122 int sock;
123 int ret = DROPBEAR_FAILURE; 123 int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED;
124 124
125 /* We don't care what address they connected to */ 125 /* We don't care what address they connected to */
126 buf_eatstring(ses.payload); 126 buf_eatstring(ses.payload);
127 127
128 origport = buf_getint(ses.payload); 128 origport = buf_getint(ses.payload);
146 146
147 snprintf(portstring, sizeof(portstring), "%d", iter->connectport); 147 snprintf(portstring, sizeof(portstring), "%d", iter->connectport);
148 sock = connect_remote(iter->connectaddr, portstring, 1, NULL); 148 sock = connect_remote(iter->connectaddr, portstring, 1, NULL);
149 if (sock < 0) { 149 if (sock < 0) {
150 TRACE(("leave newtcpdirect: sock failed")); 150 TRACE(("leave newtcpdirect: sock failed"));
151 err = SSH_OPEN_CONNECT_FAILED;
151 goto out; 152 goto out;
152 } 153 }
153 154
154 ses.maxfd = MAX(ses.maxfd, sock); 155 ses.maxfd = MAX(ses.maxfd, sock);
155 156
158 * We don't set outfd, that will get set after the connection's 159 * We don't set outfd, that will get set after the connection's
159 * progress succeeds */ 160 * progress succeeds */
160 channel->infd = sock; 161 channel->infd = sock;
161 channel->initconn = 1; 162 channel->initconn = 1;
162 163
163 ret = DROPBEAR_SUCCESS; 164 err = SSH_OPEN_IN_PROGRESS;
164 165
165 out: 166 out:
166 TRACE(("leave newtcpdirect: ret %d", ret)); 167 TRACE(("leave newtcpdirect: err %d", err));
167 return ret; 168 return err;
168 } 169 }