comparison common-session.c @ 398:59c7938af2bd

merge of '1250b8af44b62d8f4fe0f8d9fc7e7a1cc34e7e1c' and '7f8670ac3bb975f40967f3979d09d2199b7e90c8'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:20:30 +0000
parents bf29e6659fb9
children 70caa99bfe3a
comparison
equal deleted inserted replaced
396:e7c1a77d2921 398:59c7938af2bd
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 }