summaryrefslogtreecommitdiff
path: root/sshconnect1.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshconnect1.c')
-rw-r--r--sshconnect1.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sshconnect1.c b/sshconnect1.c
index c33ac503..a71d28c2 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -13,7 +13,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect1.c,v 1.24 2001/02/08 19:30:52 itojun Exp $");
+RCSID("$OpenBSD: sshconnect1.c,v 1.25 2001/02/08 23:11:43 dugsong Exp $");
#include <openssl/bn.h>
#include <openssl/evp.h>
@@ -51,6 +51,20 @@ u_int supported_authentications = 0;
extern Options options;
extern char *__progname;
+void
+ssh1_put_password(char *password)
+{
+ int size;
+ char *padded;
+
+ size = roundup(strlen(password), 32);
+ padded = xmalloc(size);
+ strlcpy(padded, password, size);
+ packet_put_string(padded, size);
+ memset(padded, 0, size);
+ xfree(padded);
+}
+
/*
* Checks if the user has an authentication agent, and if so, tries to
* authenticate using the agent.
@@ -658,7 +672,7 @@ try_challenge_reponse_authentication(void)
break;
}
packet_start(SSH_CMSG_AUTH_TIS_RESPONSE);
- packet_put_string(response, strlen(response));
+ ssh1_put_password(response);
memset(response, 0, strlen(response));
xfree(response);
packet_send();
@@ -691,7 +705,7 @@ try_password_authentication(char *prompt)
error("Permission denied, please try again.");
password = read_passphrase(prompt, 0);
packet_start(SSH_CMSG_AUTH_PASSWORD);
- packet_put_string(password, strlen(password));
+ ssh1_put_password(password);
memset(password, 0, strlen(password));
xfree(password);
packet_send();