comparison common-session.c @ 378:a124aff0cbf1

merge of '182c2d8dbd5321ef4d1df8758936f4dc7127015f' and '31dcd7a22983ef19d6c63248e415e71d292dd0ec'
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Dec 2006 13:11:41 +0000
parents bf29e6659fb9
children 70caa99bfe3a
comparison
equal deleted inserted replaced
377:1bfa65fed772 378:a124aff0cbf1
227 int i; 227 int i;
228 228
229 /* write our version string, this blocks */ 229 /* write our version string, this blocks */
230 if (atomicio(write, ses.sock, LOCAL_IDENT "\r\n", 230 if (atomicio(write, ses.sock, LOCAL_IDENT "\r\n",
231 strlen(LOCAL_IDENT "\r\n")) == DROPBEAR_FAILURE) { 231 strlen(LOCAL_IDENT "\r\n")) == DROPBEAR_FAILURE) {
232 dropbear_exit("Error writing ident string"); 232 ses.remoteclosed();
233 } 233 }
234 234
235 /* If they send more than 50 lines, something is wrong */ 235 /* If they send more than 50 lines, something is wrong */
236 for (i = 0; i < 50; i++) { 236 for (i = 0; i < 50; i++) {
237 len = ident_readln(ses.sock, linebuf, sizeof(linebuf)); 237 len = ident_readln(ses.sock, linebuf, sizeof(linebuf));
248 } 248 }
249 } 249 }
250 250
251 if (!done) { 251 if (!done) {
252 TRACE(("err: %s for '%s'\n", strerror(errno), linebuf)) 252 TRACE(("err: %s for '%s'\n", strerror(errno), linebuf))
253 dropbear_exit("Failed to get remote version"); 253 ses.remoteclosed();
254 } else { 254 } else {
255 /* linebuf is already null terminated */ 255 /* linebuf is already null terminated */
256 ses.remoteident = m_malloc(len); 256 ses.remoteident = m_malloc(len);
257 memcpy(ses.remoteident, linebuf, len); 257 memcpy(ses.remoteident, linebuf, len);
258 } 258 }