Mercurial > dropbear
comparison common-session.c @ 293:9d110777f345 contrib-blacklist
propagate from branch 'au.asn.ucc.matt.dropbear' (head 7ad1775ed65e75dbece27fe6b65bf1a234db386a)
to branch 'au.asn.ucc.matt.dropbear.contrib.blacklist' (head 1d86a4f0a401cc68c2670d821a2f6366c37af143)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 10 Mar 2006 06:31:29 +0000 |
parents | 7f9adaf85fca |
children | bf29e6659fb9 |
comparison
equal
deleted
inserted
replaced
247:c07de41b53d7 | 293:9d110777f345 |
---|---|
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 dropbear_exit("Error writing ident string"); |
233 } | 233 } |
234 | 234 |
235 /* We allow up to 9 lines before the actual version string, to | 235 /* If they send more than 50 lines, something is wrong */ |
236 * account for wrappers/cruft etc. According to the spec only the client | 236 for (i = 0; i < 50; i++) { |
237 * needs to handle this, but no harm in letting the server handle it too */ | |
238 for (i = 0; i < 10; i++) { | |
239 len = ident_readln(ses.sock, linebuf, sizeof(linebuf)); | 237 len = ident_readln(ses.sock, linebuf, sizeof(linebuf)); |
240 | 238 |
241 if (len < 0 && errno != EINTR) { | 239 if (len < 0 && errno != EINTR) { |
242 /* It failed */ | 240 /* It failed */ |
243 break; | 241 break; |
256 } else { | 254 } else { |
257 /* linebuf is already null terminated */ | 255 /* linebuf is already null terminated */ |
258 ses.remoteident = m_malloc(len); | 256 ses.remoteident = m_malloc(len); |
259 memcpy(ses.remoteident, linebuf, len); | 257 memcpy(ses.remoteident, linebuf, len); |
260 } | 258 } |
259 | |
260 /* Shall assume that 2.x will be backwards compatible. */ | |
261 if (strncmp(ses.remoteident, "SSH-2.", 6) != 0 | |
262 && strncmp(ses.remoteident, "SSH-1.99-", 9) != 0) { | |
263 dropbear_exit("Incompatible remote version '%s'", ses.remoteident); | |
264 } | |
261 | 265 |
262 TRACE(("remoteident: %s", ses.remoteident)) | 266 TRACE(("remoteident: %s", ses.remoteident)) |
263 | 267 |
264 } | 268 } |
265 | 269 |