diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-01-08 18:48:02 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-01-08 18:48:02 +1100 |
commit | ab79169e2971ca4c9f98e0a98ac9f0e797b5eb18 (patch) | |
tree | 4531b04df323b9a567189af34f16d26c1fbb537c | |
parent | 210631922f86192e99aefe6cf985155d61f44965 (diff) |
- dtucker@cvs.openbsd.org 2009/11/20 00:59:36
[sshconnect2.c]
Use the HostKeyAlias when prompting for passwords. bz#1039, ok djm@
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | sshconnect2.c | 14 |
2 files changed, 12 insertions, 5 deletions
@@ -78,6 +78,9 @@ | |||
78 | and delay it until after the sftp protocol connection has been established. | 78 | and delay it until after the sftp protocol connection has been established. |
79 | Avoids confusing sequence of messages when the underlying ssh connection | 79 | Avoids confusing sequence of messages when the underlying ssh connection |
80 | experiences problems. ok dtucker@ | 80 | experiences problems. ok dtucker@ |
81 | - dtucker@cvs.openbsd.org 2009/11/20 00:59:36 | ||
82 | [sshconnect2.c] | ||
83 | Use the HostKeyAlias when prompting for passwords. bz#1039, ok djm@ | ||
81 | 84 | ||
82 | 20091226 | 85 | 20091226 |
83 | - (tim) [contrib/cygwin/Makefile] Install ssh-copy-id and ssh-copy-id.1 | 86 | - (tim) [contrib/cygwin/Makefile] Install ssh-copy-id and ssh-copy-id.1 |
diff --git a/sshconnect2.c b/sshconnect2.c index 299d4f4e3..378526bac 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.174 2009/11/10 04:30:45 dtucker Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.175 2009/11/20 00:59:36 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2008 Damien Miller. All rights reserved. |
@@ -804,6 +804,8 @@ userauth_passwd(Authctxt *authctxt) | |||
804 | static int attempt = 0; | 804 | static int attempt = 0; |
805 | char prompt[150]; | 805 | char prompt[150]; |
806 | char *password; | 806 | char *password; |
807 | const char *host = options.host_key_alias ? options.host_key_alias : | ||
808 | authctxt->host; | ||
807 | 809 | ||
808 | if (attempt++ >= options.number_of_password_prompts) | 810 | if (attempt++ >= options.number_of_password_prompts) |
809 | return 0; | 811 | return 0; |
@@ -812,7 +814,7 @@ userauth_passwd(Authctxt *authctxt) | |||
812 | error("Permission denied, please try again."); | 814 | error("Permission denied, please try again."); |
813 | 815 | ||
814 | snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", | 816 | snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", |
815 | authctxt->server_user, authctxt->host); | 817 | authctxt->server_user, host); |
816 | password = read_passphrase(prompt, 0); | 818 | password = read_passphrase(prompt, 0); |
817 | packet_start(SSH2_MSG_USERAUTH_REQUEST); | 819 | packet_start(SSH2_MSG_USERAUTH_REQUEST); |
818 | packet_put_cstring(authctxt->server_user); | 820 | packet_put_cstring(authctxt->server_user); |
@@ -841,6 +843,8 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
841 | Authctxt *authctxt = ctxt; | 843 | Authctxt *authctxt = ctxt; |
842 | char *info, *lang, *password = NULL, *retype = NULL; | 844 | char *info, *lang, *password = NULL, *retype = NULL; |
843 | char prompt[150]; | 845 | char prompt[150]; |
846 | const char *host = options.host_key_alias ? options.host_key_alias : | ||
847 | authctxt->host; | ||
844 | 848 | ||
845 | debug2("input_userauth_passwd_changereq"); | 849 | debug2("input_userauth_passwd_changereq"); |
846 | 850 | ||
@@ -861,7 +865,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
861 | packet_put_char(1); /* additional info */ | 865 | packet_put_char(1); /* additional info */ |
862 | snprintf(prompt, sizeof(prompt), | 866 | snprintf(prompt, sizeof(prompt), |
863 | "Enter %.30s@%.128s's old password: ", | 867 | "Enter %.30s@%.128s's old password: ", |
864 | authctxt->server_user, authctxt->host); | 868 | authctxt->server_user, host); |
865 | password = read_passphrase(prompt, 0); | 869 | password = read_passphrase(prompt, 0); |
866 | packet_put_cstring(password); | 870 | packet_put_cstring(password); |
867 | memset(password, 0, strlen(password)); | 871 | memset(password, 0, strlen(password)); |
@@ -870,7 +874,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
870 | while (password == NULL) { | 874 | while (password == NULL) { |
871 | snprintf(prompt, sizeof(prompt), | 875 | snprintf(prompt, sizeof(prompt), |
872 | "Enter %.30s@%.128s's new password: ", | 876 | "Enter %.30s@%.128s's new password: ", |
873 | authctxt->server_user, authctxt->host); | 877 | authctxt->server_user, host); |
874 | password = read_passphrase(prompt, RP_ALLOW_EOF); | 878 | password = read_passphrase(prompt, RP_ALLOW_EOF); |
875 | if (password == NULL) { | 879 | if (password == NULL) { |
876 | /* bail out */ | 880 | /* bail out */ |
@@ -878,7 +882,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
878 | } | 882 | } |
879 | snprintf(prompt, sizeof(prompt), | 883 | snprintf(prompt, sizeof(prompt), |
880 | "Retype %.30s@%.128s's new password: ", | 884 | "Retype %.30s@%.128s's new password: ", |
881 | authctxt->server_user, authctxt->host); | 885 | authctxt->server_user, host); |
882 | retype = read_passphrase(prompt, 0); | 886 | retype = read_passphrase(prompt, 0); |
883 | if (strcmp(password, retype) != 0) { | 887 | if (strcmp(password, retype) != 0) { |
884 | memset(password, 0, strlen(password)); | 888 | memset(password, 0, strlen(password)); |