OpenSSH banner doesnot display multibyte characters like korean

Roland Mainz roland.mainz at
Wed Nov 28 00:21:04 EST 2012

On Tue, Nov 27, 2012 at 12:17 PM, balu chandra <balu9463 at> wrote:
> I did not come across any UTF8 implementation of strnvis.
> Howver have modified strnvis() to display Multibyte char (tested the
> fix with Korean char).
> Though all calls to strnvis() could be extended to skip Multibyte char
> this fix is limited to skipping only for Banner message(introduced a
> flag for doing so).
> The fix is provided here for comments.
> [root at rhel62 bala]# diff -ur openssh6.1 openssh6.1_mod
> diff -ur openssh6.1/openbsd-compat/vis.c openssh6.1_mod/openbsd-compat/vis.c
> --- openssh6.1/openbsd-compat/vis.c     2012-11-27 16:12:23.986690241 +0530
> +++ openssh6.1_mod/openbsd-compat/vis.c 2012-11-27 16:12:43.559859183 +0530

Erm... the problem with this code is that it is specific to UTF-8
only... but there are other multibyte encodings which are still in
common use (like ja_JP.PCK/ShiftJIS on Solaris/Linux, both are used
and mandated by goverment customers) and GB18030 (which is a) "modern"
(e.g. not "legacy" like some people call the EUC encodings) and b)
mandatory in PRC[1] (China)).

AFAIK a possible fix would be to pass the data through the libc
multibyte functions and filter anything out which looks like the ASCII
control characters (since more or less all multibyte characters have
ASCII as basis) + anything which matches |iswcntrl()|

[1]=Erm... does anyone know how "Red Flag Linux" solved this ?



  __ .  . __
 (o.\ \/ /.o) roland.mainz at
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

More information about the openssh-unix-dev mailing list