Mercurial > dropbear
comparison cli-runopts.c @ 1085:ad14e2e71190
Fix building when ENABLE_CLI_PUBKEY_AUTH is unset
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 03 Jun 2015 21:45:32 +0800 |
parents | 47643024fc90 |
children | 36557295418e |
comparison
equal
deleted
inserted
replaced
1084:2265d7ebfdeb | 1085:ad14e2e71190 |
---|---|
445 if (cli_opts.cmd && cli_opts.netcat_host) { | 445 if (cli_opts.cmd && cli_opts.netcat_host) { |
446 dropbear_log(LOG_INFO, "Ignoring command '%s' in netcat mode", cli_opts.cmd); | 446 dropbear_log(LOG_INFO, "Ignoring command '%s' in netcat mode", cli_opts.cmd); |
447 } | 447 } |
448 #endif | 448 #endif |
449 | 449 |
450 #ifdef DROPBEAR_DEFAULT_CLI_AUTHKEY | 450 #if defined(DROPBEAR_DEFAULT_CLI_AUTHKEY) && defined(ENABLE_CLI_PUBKEY_AUTH) |
451 { | 451 { |
452 char *expand_path = expand_tilde(DROPBEAR_DEFAULT_CLI_AUTHKEY); | 452 char *expand_path = expand_tilde(DROPBEAR_DEFAULT_CLI_AUTHKEY); |
453 loadidentityfile(expand_path, 0); | 453 loadidentityfile(expand_path, 0); |
454 m_free(expand_path); | 454 m_free(expand_path); |
455 } | 455 } |
496 int total; | 496 int total; |
497 unsigned int len = 0; | 497 unsigned int len = 0; |
498 m_list_elem *iter; | 498 m_list_elem *iter; |
499 /* Fill out -i, -y, -W options that make sense for all | 499 /* Fill out -i, -y, -W options that make sense for all |
500 * the intermediate processes */ | 500 * the intermediate processes */ |
501 #ifdef ENABLE_CLI_PUBKEY_AUTH | |
501 for (iter = cli_opts.privkeys->first; iter; iter = iter->next) | 502 for (iter = cli_opts.privkeys->first; iter; iter = iter->next) |
502 { | 503 { |
503 sign_key * key = (sign_key*)iter->item; | 504 sign_key * key = (sign_key*)iter->item; |
504 len += 3 + strlen(key->filename); | 505 len += 3 + strlen(key->filename); |
505 } | 506 } |
507 #endif /* ENABLE_CLI_PUBKEY_AUTH */ | |
508 | |
506 len += 30; /* space for -W <size>, terminator. */ | 509 len += 30; /* space for -W <size>, terminator. */ |
507 ret = m_malloc(len); | 510 ret = m_malloc(len); |
508 total = 0; | 511 total = 0; |
509 | 512 |
510 if (cli_opts.no_hostkey_check) | 513 if (cli_opts.no_hostkey_check) |
522 { | 525 { |
523 int written = snprintf(ret+total, len-total, "-W %d ", opts.recv_window); | 526 int written = snprintf(ret+total, len-total, "-W %d ", opts.recv_window); |
524 total += written; | 527 total += written; |
525 } | 528 } |
526 | 529 |
530 #ifdef ENABLE_CLI_PUBKEY_AUTH | |
527 for (iter = cli_opts.privkeys->first; iter; iter = iter->next) | 531 for (iter = cli_opts.privkeys->first; iter; iter = iter->next) |
528 { | 532 { |
529 sign_key * key = (sign_key*)iter->item; | 533 sign_key * key = (sign_key*)iter->item; |
530 const size_t size = len - total; | 534 const size_t size = len - total; |
531 int written = snprintf(ret+total, size, "-i %s ", key->filename); | 535 int written = snprintf(ret+total, size, "-i %s ", key->filename); |
532 dropbear_assert((unsigned int)written < size); | 536 dropbear_assert((unsigned int)written < size); |
533 total += written; | 537 total += written; |
534 } | 538 } |
539 #endif /* ENABLE_CLI_PUBKEY_AUTH */ | |
535 | 540 |
536 /* if args were passed, total will be not zero, and it will have a space at the end, so remove that */ | 541 /* if args were passed, total will be not zero, and it will have a space at the end, so remove that */ |
537 if (total > 0) | 542 if (total > 0) |
538 { | 543 { |
539 total--; | 544 total--; |