Mercurial > dropbear
comparison cli-kex.c @ 1121:bb3a03feb31f
Merge pull request #13 from gazoo74/fix-warnings
Fix warnings
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 04 Jun 2015 22:25:28 +0800 |
parents | c45d65392c1a |
children | aaf576b27a10 d7b752525b91 |
comparison
equal
deleted
inserted
replaced
1087:1e486f368ec3 | 1121:bb3a03feb31f |
---|---|
320 TRACE(("line is too short to be sensible")) | 320 TRACE(("line is too short to be sensible")) |
321 continue; | 321 continue; |
322 } | 322 } |
323 | 323 |
324 /* Compare hostnames */ | 324 /* Compare hostnames */ |
325 if (strncmp(cli_opts.remotehost, buf_getptr(line, hostlen), | 325 if (strncmp(cli_opts.remotehost, (const char *) buf_getptr(line, hostlen), |
326 hostlen) != 0) { | 326 hostlen) != 0) { |
327 continue; | 327 continue; |
328 } | 328 } |
329 | 329 |
330 buf_incrpos(line, hostlen); | 330 buf_incrpos(line, hostlen); |
332 /* there wasn't a space after the hostname, something dodgy */ | 332 /* there wasn't a space after the hostname, something dodgy */ |
333 TRACE(("missing space afte matching hostname")) | 333 TRACE(("missing space afte matching hostname")) |
334 continue; | 334 continue; |
335 } | 335 } |
336 | 336 |
337 if (strncmp(buf_getptr(line, algolen), algoname, algolen) != 0) { | 337 if (strncmp((const char *) buf_getptr(line, algolen), algoname, algolen) != 0) { |
338 TRACE(("algo doesn't match")) | 338 TRACE(("algo doesn't match")) |
339 continue; | 339 continue; |
340 } | 340 } |
341 | 341 |
342 buf_incrpos(line, algolen); | 342 buf_incrpos(line, algolen); |
344 TRACE(("missing space after algo")) | 344 TRACE(("missing space after algo")) |
345 continue; | 345 continue; |
346 } | 346 } |
347 | 347 |
348 /* Now we're at the interesting hostkey */ | 348 /* Now we're at the interesting hostkey */ |
349 ret = cmp_base64_key(keyblob, keybloblen, algoname, algolen, | 349 ret = cmp_base64_key(keyblob, keybloblen, (const unsigned char *) algoname, algolen, |
350 line, &fingerprint); | 350 line, &fingerprint); |
351 | 351 |
352 if (ret == DROPBEAR_SUCCESS) { | 352 if (ret == DROPBEAR_SUCCESS) { |
353 /* Good matching key */ | 353 /* Good matching key */ |
354 TRACE(("good matching key")) | 354 TRACE(("good matching key")) |
380 if (!cli_opts.always_accept_key) { | 380 if (!cli_opts.always_accept_key) { |
381 /* put the new entry in the file */ | 381 /* put the new entry in the file */ |
382 fseek(hostsfile, 0, SEEK_END); /* In case it wasn't opened append */ | 382 fseek(hostsfile, 0, SEEK_END); /* In case it wasn't opened append */ |
383 buf_setpos(line, 0); | 383 buf_setpos(line, 0); |
384 buf_setlen(line, 0); | 384 buf_setlen(line, 0); |
385 buf_putbytes(line, cli_opts.remotehost, hostlen); | 385 buf_putbytes(line, (const unsigned char *) cli_opts.remotehost, hostlen); |
386 buf_putbyte(line, ' '); | 386 buf_putbyte(line, ' '); |
387 buf_putbytes(line, algoname, algolen); | 387 buf_putbytes(line, (const unsigned char *) algoname, algolen); |
388 buf_putbyte(line, ' '); | 388 buf_putbyte(line, ' '); |
389 len = line->size - line->pos; | 389 len = line->size - line->pos; |
390 /* The only failure with base64 is buffer_overflow, but buf_getwriteptr | 390 /* The only failure with base64 is buffer_overflow, but buf_getwriteptr |
391 * will die horribly in the case anyway */ | 391 * will die horribly in the case anyway */ |
392 base64_encode(keyblob, keybloblen, buf_getwriteptr(line, len), &len); | 392 base64_encode(keyblob, keybloblen, buf_getwriteptr(line, len), &len); |