summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-10-10 15:02:03 +1000
committerDamien Miller <djm@mindrot.org>2001-10-10 15:02:03 +1000
commite398004f6c9aec5d46d0b77950592462f327e28b (patch)
treea56b85b2c0842e6ded55de95bba5a75b5a99d859 /sshconnect.c
parent8c3902afde376c2efbd587ea63043e7abceabaff (diff)
- markus@cvs.openbsd.org 2001/10/06 00:14:50
[sshconnect.c] remove unused argument
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 6a9b5489e..ed2125230 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.111 2001/10/01 21:51:16 markus Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.112 2001/10/06 00:14:50 markus Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -491,7 +491,7 @@ ssh_exchange_identification(void)
491 491
492/* defaults to 'no' */ 492/* defaults to 'no' */
493static int 493static int
494read_yes_or_no(const char *prompt, int defval) 494confirm(const char *prompt)
495{ 495{
496 char buf[1024]; 496 char buf[1024];
497 FILE *f; 497 FILE *f;
@@ -499,33 +499,22 @@ read_yes_or_no(const char *prompt, int defval)
499 499
500 if (options.batch_mode) 500 if (options.batch_mode)
501 return 0; 501 return 0;
502
503 if (isatty(STDIN_FILENO)) 502 if (isatty(STDIN_FILENO))
504 f = stdin; 503 f = stdin;
505 else 504 else
506 f = fopen(_PATH_TTY, "rw"); 505 f = fopen(_PATH_TTY, "rw");
507
508 if (f == NULL) 506 if (f == NULL)
509 return 0; 507 return 0;
510
511 fflush(stdout); 508 fflush(stdout);
512
513 while (1) { 509 while (1) {
514 fprintf(stderr, "%s", prompt); 510 fprintf(stderr, "%s", prompt);
515 if (fgets(buf, sizeof(buf), f) == NULL) { 511 if (fgets(buf, sizeof(buf), f) == NULL) {
516 /*
517 * Print a newline (the prompt probably didn\'t have
518 * one).
519 */
520 fprintf(stderr, "\n"); 512 fprintf(stderr, "\n");
521 strlcpy(buf, "no", sizeof buf); 513 strlcpy(buf, "no", sizeof buf);
522 } 514 }
523 /* Remove newline from response. */ 515 /* Remove newline from response. */
524 if (strchr(buf, '\n')) 516 if (strchr(buf, '\n'))
525 *strchr(buf, '\n') = 0; 517 *strchr(buf, '\n') = 0;
526
527 if (buf[0] == 0)
528 retval = defval;
529 if (strcmp(buf, "yes") == 0) 518 if (strcmp(buf, "yes") == 0)
530 retval = 1; 519 retval = 1;
531 else if (strcmp(buf, "no") == 0) 520 else if (strcmp(buf, "no") == 0)
@@ -713,7 +702,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
713 "Are you sure you want to continue connecting " 702 "Are you sure you want to continue connecting "
714 "(yes/no)? ", host, ip, type, fp); 703 "(yes/no)? ", host, ip, type, fp);
715 xfree(fp); 704 xfree(fp);
716 if (!read_yes_or_no(prompt, -1)) { 705 if (!confirm(prompt)) {
717 log("Aborted by user!"); 706 log("Aborted by user!");
718 goto fail; 707 goto fail;
719 } 708 }
@@ -830,8 +819,8 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key,
830 error("Exiting, you have requested strict checking."); 819 error("Exiting, you have requested strict checking.");
831 goto fail; 820 goto fail;
832 } else if (options.strict_host_key_checking == 2) { 821 } else if (options.strict_host_key_checking == 2) {
833 if (!read_yes_or_no("Are you sure you want " 822 if (!confirm("Are you sure you want "
834 "to continue connecting (yes/no)? ", -1)) { 823 "to continue connecting (yes/no)? ")) {
835 log("Aborted by user!"); 824 log("Aborted by user!");
836 goto fail; 825 goto fail;
837 } 826 }