summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sshconnect2.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2016-07-17 04:20:17 +0000
committerDamien Miller <djm@cvs.openbsd.org>2016-07-17 04:20:17 +0000
commit8649a619794b5d46af9557f4fa6a38442ecc9ced (patch)
treeaa1a45feed2bedce5b06dcb5efd05a0a896e764e /usr.bin/ssh/sshconnect2.c
parent11b88baab6cc6a16072e3f96a6bdd741b5353c2d (diff)
support UTF-8 characters in ssh(1) banners using schwarze@'s
safe fmprintf printer; bz#2058 feedback schwarze@ ok dtucker@
Diffstat (limited to 'usr.bin/ssh/sshconnect2.c')
-rw-r--r--usr.bin/ssh/sshconnect2.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c
index 1698b598e9e..90ff5af0618 100644
--- a/usr.bin/ssh/sshconnect2.c
+++ b/usr.bin/ssh/sshconnect2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.245 2016/05/24 04:43:45 dtucker Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.246 2016/07/17 04:20:16 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -65,6 +65,7 @@
#include "uidswap.h"
#include "hostfile.h"
#include "ssherr.h"
+#include "utf8.h"
#ifdef GSSAPI
#include "ssh-gss.h"
@@ -487,21 +488,15 @@ input_userauth_error(int type, u_int32_t seq, void *ctxt)
int
input_userauth_banner(int type, u_int32_t seq, void *ctxt)
{
- char *msg, *raw, *lang;
+ char *msg, *lang;
u_int len;
- debug3("input_userauth_banner");
- raw = packet_get_string(&len);
+ debug3("%s", __func__);
+ msg = packet_get_string(&len);
lang = packet_get_string(NULL);
- if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO) {
- if (len > 65536)
- len = 65536;
- msg = xmalloc(len * 4 + 1); /* max expansion from strnvis() */
- strnvis(msg, raw, len * 4 + 1, VIS_SAFE|VIS_OCTAL|VIS_NOSLASH);
- fprintf(stderr, "%s", msg);
- free(msg);
- }
- free(raw);
+ if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO)
+ fmprintf(stderr, "%s", msg);
+ free(msg);
free(lang);
return 0;
}