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
This commit is contained in:
parent
e4eb7d9109
commit
65c6c6b567
5
ssh.c
5
ssh.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: ssh.c,v 1.444 2016/07/16 06:57:55 jmc Exp $ */
|
/* $OpenBSD: ssh.c,v 1.445 2016/07/17 04:20:16 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
|
@ -67,6 +67,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
@ -592,6 +593,8 @@ main(int ac, char **av)
|
||||||
*/
|
*/
|
||||||
umask(022);
|
umask(022);
|
||||||
|
|
||||||
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize option structure to indicate that no values have been
|
* Initialize option structure to indicate that no values have been
|
||||||
* set.
|
* set.
|
||||||
|
|
|
@ -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) 2000 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2008 Damien Miller. All rights reserved.
|
* Copyright (c) 2008 Damien Miller. All rights reserved.
|
||||||
|
@ -71,6 +71,7 @@
|
||||||
#include "uidswap.h"
|
#include "uidswap.h"
|
||||||
#include "hostfile.h"
|
#include "hostfile.h"
|
||||||
#include "ssherr.h"
|
#include "ssherr.h"
|
||||||
|
#include "utf8.h"
|
||||||
|
|
||||||
#ifdef GSSAPI
|
#ifdef GSSAPI
|
||||||
#include "ssh-gss.h"
|
#include "ssh-gss.h"
|
||||||
|
@ -495,21 +496,15 @@ input_userauth_error(int type, u_int32_t seq, void *ctxt)
|
||||||
int
|
int
|
||||||
input_userauth_banner(int type, u_int32_t seq, void *ctxt)
|
input_userauth_banner(int type, u_int32_t seq, void *ctxt)
|
||||||
{
|
{
|
||||||
char *msg, *raw, *lang;
|
char *msg, *lang;
|
||||||
u_int len;
|
u_int len;
|
||||||
|
|
||||||
debug3("input_userauth_banner");
|
debug3("%s", __func__);
|
||||||
raw = packet_get_string(&len);
|
msg = packet_get_string(&len);
|
||||||
lang = packet_get_string(NULL);
|
lang = packet_get_string(NULL);
|
||||||
if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO) {
|
if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO)
|
||||||
if (len > 65536)
|
fmprintf(stderr, "%s", msg);
|
||||||
len = 65536;
|
free(msg);
|
||||||
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);
|
|
||||||
free(lang);
|
free(lang);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue