[PATCH v2 1/1] paint visual host key with unicode box-drawing characters

Christian Hesse list at eworm.de
Wed Jul 8 18:08:22 AEST 2015


Ben Lindstrom <mouring at eviladmin.org> on Tue, 2015/07/07 20:05:
> 
> 
> Christian Hesse wrote:
> > Hello everybody,
> >
> > this is an updated version with these changes:
> >
> > * unicode characters are encoded using octal values
> > * added two more unicode characters to replace brackets
> > * made ssh work, but:
> >
> > Christian Hesse<list at eworm.de>  on Mon, 2015/07/06 15:18:
> >> --- a/log.c
> >> +++ b/log.c
> >> @@ -444,7 +444,7 @@ do_log(LogLevel level, const char *fmt, va_list args)
> >>   		tmp_handler(level, fmtbuf, log_handler_ctx);
> >>   		log_handler = tmp_handler;
> >>   	} else if (log_on_stderr) {
> >> -		snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
> >> +		/* we want unicode multi byte characters, so do not use
> >> fmtbuf here */ (void)write(log_stderr_fd, msgbuf, strlen(msgbuf));
> >>   	} else {
> >>   #if defined(HAVE_OPENLOG_R)&&  defined(SYSLOG_DATA_INIT)
> >
> > Does that break anything?
> 
> I don't think this is right.. You are logging "msgbuf" to 
> write(log_stderr, ..) but you just deleted the line that GENERATES that 
> variable..  So your logging nothing but an undefined string.

That is wrong. msgbuf is initialized and contains what we want.

strnvis() writes from msgbuf to fmtbu. The line I removed then (over-) writes
from fmtbu to msgbuf (the other way round), adding a new line.

> At least it needs to swap it to use fmtbuf, but I suspect this screws up 
> the output as you no longer are doing \r\n in the general case where 
> this may be required.

That is right. So we need an extra

(void)write(log_stderr_fd, "\r\n", 2);

> So I'm not convinced this is right.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20150708/90a45bf6/attachment.bin>


More information about the openssh-unix-dev mailing list