From e398004f6c9aec5d46d0b77950592462f327e28b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 10 Oct 2001 15:02:03 +1000 Subject: [PATCH] - markus@cvs.openbsd.org 2001/10/06 00:14:50 [sshconnect.c] remove unused argument --- ChangeLog | 5 ++++- sshconnect.c | 21 +++++---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index afb752b9d..13a1ef109 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ - markus@cvs.openbsd.org 2001/10/04 15:12:37 [serverloop.c] client_alive_check cleanup + - markus@cvs.openbsd.org 2001/10/06 00:14:50 + [sshconnect.c] + remove unused argument 20011007 - (bal) ssh-copy-id corrected permissions for .ssh/ and authorized_keys. @@ -6654,4 +6657,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1587 2001/10/10 05:01:40 djm Exp $ +$Id: ChangeLog,v 1.1588 2001/10/10 05:02:03 djm Exp $ diff --git a/sshconnect.c b/sshconnect.c index 6a9b5489e..ed2125230 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.111 2001/10/01 21:51:16 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.112 2001/10/06 00:14:50 markus Exp $"); #include @@ -491,7 +491,7 @@ ssh_exchange_identification(void) /* defaults to 'no' */ static int -read_yes_or_no(const char *prompt, int defval) +confirm(const char *prompt) { char buf[1024]; FILE *f; @@ -499,33 +499,22 @@ read_yes_or_no(const char *prompt, int defval) if (options.batch_mode) return 0; - if (isatty(STDIN_FILENO)) f = stdin; else f = fopen(_PATH_TTY, "rw"); - if (f == NULL) return 0; - fflush(stdout); - while (1) { fprintf(stderr, "%s", prompt); if (fgets(buf, sizeof(buf), f) == NULL) { - /* - * Print a newline (the prompt probably didn\'t have - * one). - */ fprintf(stderr, "\n"); strlcpy(buf, "no", sizeof buf); } /* Remove newline from response. */ if (strchr(buf, '\n')) *strchr(buf, '\n') = 0; - - if (buf[0] == 0) - retval = defval; if (strcmp(buf, "yes") == 0) retval = 1; else if (strcmp(buf, "no") == 0) @@ -713,7 +702,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, "Are you sure you want to continue connecting " "(yes/no)? ", host, ip, type, fp); xfree(fp); - if (!read_yes_or_no(prompt, -1)) { + if (!confirm(prompt)) { log("Aborted by user!"); goto fail; } @@ -830,8 +819,8 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, error("Exiting, you have requested strict checking."); goto fail; } else if (options.strict_host_key_checking == 2) { - if (!read_yes_or_no("Are you sure you want " - "to continue connecting (yes/no)? ", -1)) { + if (!confirm("Are you sure you want " + "to continue connecting (yes/no)? ")) { log("Aborted by user!"); goto fail; }