diff options
author | djm@openbsd.org <djm@openbsd.org> | 2016-07-17 04:20:16 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2016-07-17 14:21:38 +1000 |
commit | 65c6c6b567ab5ab12945a5ad8e0ab3a8c26119cc (patch) | |
tree | a26611a8f9877e4d5e0a1d55e4d96c3955f1c397 /sshconnect2.c | |
parent | e4eb7d910976fbfc7ce3e90c95c11b07b483d0d7 (diff) |
upstream commit
support UTF-8 characters in ssh(1) banners using
schwarze@'s safe fmprintf printer; bz#2058
feedback schwarze@ ok dtucker@
Upstream-ID: a72ce4e3644c957643c9524eea2959e41b91eea7
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index 3d3c7bf42..6742a318c 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.245 2016/05/24 04:43:45 dtucker Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.246 2016/07/17 04:20:16 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. |
@@ -71,6 +71,7 @@ | |||
71 | #include "uidswap.h" | 71 | #include "uidswap.h" |
72 | #include "hostfile.h" | 72 | #include "hostfile.h" |
73 | #include "ssherr.h" | 73 | #include "ssherr.h" |
74 | #include "utf8.h" | ||
74 | 75 | ||
75 | #ifdef GSSAPI | 76 | #ifdef GSSAPI |
76 | #include "ssh-gss.h" | 77 | #include "ssh-gss.h" |
@@ -495,21 +496,15 @@ input_userauth_error(int type, u_int32_t seq, void *ctxt) | |||
495 | int | 496 | int |
496 | input_userauth_banner(int type, u_int32_t seq, void *ctxt) | 497 | input_userauth_banner(int type, u_int32_t seq, void *ctxt) |
497 | { | 498 | { |
498 | char *msg, *raw, *lang; | 499 | char *msg, *lang; |
499 | u_int len; | 500 | u_int len; |
500 | 501 | ||
501 | debug3("input_userauth_banner"); | 502 | debug3("%s", __func__); |
502 | raw = packet_get_string(&len); | 503 | msg = packet_get_string(&len); |
503 | lang = packet_get_string(NULL); | 504 | lang = packet_get_string(NULL); |
504 | if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO) { | 505 | if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO) |
505 | if (len > 65536) | 506 | fmprintf(stderr, "%s", msg); |
506 | len = 65536; | 507 | free(msg); |
507 | msg = xmalloc(len * 4 + 1); /* max expansion from strnvis() */ | ||
508 | strnvis(msg, raw, len * 4 + 1, VIS_SAFE|VIS_OCTAL|VIS_NOSLASH); | ||
509 | fprintf(stderr, "%s", msg); | ||
510 | free(msg); | ||
511 | } | ||
512 | free(raw); | ||
513 | free(lang); | 508 | free(lang); |
514 | return 0; | 509 | return 0; |
515 | } | 510 | } |