comparison common-session.c @ 344:bf29e6659fb9

Just use the normal "remote closed" handler when reading ident stings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 27 Jul 2006 01:24:39 +0000
parents 7f9adaf85fca
children 70caa99bfe3a
comparison
equal deleted inserted replaced
343:ffbe6f691ca3 344:bf29e6659fb9
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 }