summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-11-28 06:00:38 +0000
committerDamien Miller <djm@mindrot.org>2018-12-07 13:10:57 +1100
commit91b19198c3f604f5eef2c56dbe36f29478243141 (patch)
tree021e747d9bcd69cfece01690ed1938d4e4f6bf9e /sshconnect2.c
parentdd0cf6318d9b4b3533bda1e3bc021b2cd7246b7a (diff)
upstream: don't truncate user or host name in "user@host's
OpenBSD-Commit-ID: e6ca01a8d58004b7f2cac0b1b7ce8f87e425e360
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sshconnect2.c b/sshconnect2.c
index cf60c7d43..adb4e4cbd 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect2.c,v 1.289 2018/11/16 02:46:20 djm Exp $ */ 1/* $OpenBSD: sshconnect2.c,v 1.290 2018/11/28 06:00:38 djm 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.
@@ -958,8 +958,7 @@ userauth_passwd(Authctxt *authctxt)
958{ 958{
959 struct ssh *ssh = active_state; /* XXX */ 959 struct ssh *ssh = active_state; /* XXX */
960 static int attempt = 0; 960 static int attempt = 0;
961 char prompt[256]; 961 char *password, *prompt = NULL;
962 char *password;
963 const char *host = options.host_key_alias ? options.host_key_alias : 962 const char *host = options.host_key_alias ? options.host_key_alias :
964 authctxt->host; 963 authctxt->host;
965 int r; 964 int r;
@@ -970,8 +969,7 @@ userauth_passwd(Authctxt *authctxt)
970 if (attempt != 1) 969 if (attempt != 1)
971 error("Permission denied, please try again."); 970 error("Permission denied, please try again.");
972 971
973 snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", 972 xasprintf(&prompt, "%s@%s's password: ", authctxt->server_user, host);
974 authctxt->server_user, host);
975 password = read_passphrase(prompt, 0); 973 password = read_passphrase(prompt, 0);
976 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || 974 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 ||
977 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || 975 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
@@ -983,7 +981,8 @@ userauth_passwd(Authctxt *authctxt)
983 (r = sshpkt_send(ssh)) != 0) 981 (r = sshpkt_send(ssh)) != 0)
984 fatal("%s: %s", __func__, ssh_err(r)); 982 fatal("%s: %s", __func__, ssh_err(r));
985 983
986 if (password) 984 free(prompt);
985 if (password != NULL)
987 freezero(password, strlen(password)); 986 freezero(password, strlen(password));
988 987
989 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, 988 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ,