summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-01-04 22:21:27 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-01-04 22:21:27 +0000
commit4c4371430b64674c845f232528779ae9234e4446 (patch)
tree89a89d9f66a0f42c15628b7578151c6303b71424
parent3fb7b358940a0b539b7015cc2566f129bcf35ac1 (diff)
handle SSH2_MSG_USERAUTH_BANNER; fixes bug when connecting to a server that prints a banner (e.g. /etc/issue.net)
-rw-r--r--usr.bin/ssh/sshconnect2.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c
index 34d72818f3d..8321c9eb755 100644
--- a/usr.bin/ssh/sshconnect2.c
+++ b/usr.bin/ssh/sshconnect2.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect2.c,v 1.34 2000/12/27 12:34:50 markus Exp $");
+RCSID("$OpenBSD: sshconnect2.c,v 1.35 2001/01/04 22:21:26 markus Exp $");
#include <openssl/bn.h>
#include <openssl/rsa.h>
@@ -467,6 +467,7 @@ struct Authmethod {
void input_userauth_success(int type, int plen, void *ctxt);
void input_userauth_failure(int type, int plen, void *ctxt);
+void input_userauth_banner(int type, int plen, void *ctxt);
void input_userauth_error(int type, int plen, void *ctxt);
void input_userauth_info_req(int type, int plen, void *ctxt);
@@ -543,6 +544,7 @@ ssh_userauth2(const char *server_user, char *host)
dispatch_init(&input_userauth_error);
dispatch_set(SSH2_MSG_USERAUTH_SUCCESS, &input_userauth_success);
dispatch_set(SSH2_MSG_USERAUTH_FAILURE, &input_userauth_failure);
+ dispatch_set(SSH2_MSG_USERAUTH_BANNER, &input_userauth_banner);
dispatch_run(DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */
if (authctxt.agent != NULL)
@@ -553,7 +555,19 @@ ssh_userauth2(const char *server_user, char *host)
void
input_userauth_error(int type, int plen, void *ctxt)
{
- fatal("input_userauth_error: bad message during authentication");
+ fatal("input_userauth_error: bad message during authentication: "
+ "type %d", type);
+}
+void
+input_userauth_banner(int type, int plen, void *ctxt)
+{
+ char *msg, *lang;
+ debug3("input_userauth_banner");
+ msg = packet_get_string(NULL);
+ lang = packet_get_string(NULL);
+ fprintf(stderr, "%s", msg);
+ xfree(msg);
+ xfree(lang);
}
void
input_userauth_success(int type, int plen, void *ctxt)