Bugzilla – Attachment 2444 Details for
Bug 2247
[visual host key] fix upper border display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
rework printing for visual host key upper border
0001-rework-printing-for-visual-host-key-upper-border.patch (text/plain), 2.11 KB, created by
Christian Hesse
on 2014-07-02 16:24:57 AEST
(
hide
)
Description:
rework printing for visual host key upper border
Filename:
MIME Type:
Creator:
Christian Hesse
Created:
2014-07-02 16:24:57 AEST
Size:
2.11 KB
patch
obsolete
>From 3c83e71eeec9acb72984bde9e7dcef3a6ac9e584 Mon Sep 17 00:00:00 2001 >From: Christian Hesse <mail@eworm.de> >Date: Wed, 2 Jul 2014 08:15:11 +0200 >Subject: [PATCH 1/1] rework printing for visual host key upper border > >Key types are getting longer and the current implementation of visual >host key breaks with ED25519, resulting in (note the missing bracket): > >+--[ED25519 256--+ > >This reworks the calculation of visual host key upper border. Please be >aware that this slightly modifies the output for other key types as >well: > >+--[ DSA 1024]----+ >+---[DSA 1024]----+ > >+--[ RSA 2048]----+ >+---[RSA 2048]----+ > >+--[ECDSA 256]---+ >+---[ECDSA 256]---+ > >+--[ED25519 256--+ >+--[ED25519 256]--+ >--- > sshkey.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > >diff --git a/sshkey.c b/sshkey.c >index 24023d0..aa00685 100644 >--- a/sshkey.c >+++ b/sshkey.c >@@ -1024,7 +1024,7 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len, > * intersects with itself. Matter of taste. > */ > char *augmentation_string = " .o+=*BOX@%&#/^SE"; >- char *retval, *p; >+ char *retval, *p, key_details[FLDSIZE_X + 1]; > u_char field[FLDSIZE_X][FLDSIZE_Y]; > size_t i; > u_int b; >@@ -1034,6 +1034,8 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len, > if ((retval = calloc((FLDSIZE_X + 3), (FLDSIZE_Y + 2))) == NULL) > return NULL; > >+ p = retval; >+ > /* initialize field */ > memset(field, 0, FLDSIZE_X * FLDSIZE_Y * sizeof(char)); > x = FLDSIZE_X / 2; >@@ -1066,12 +1068,16 @@ fingerprint_randomart(u_char *dgst_raw, size_t dgst_raw_len, > field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1; > field[x][y] = len; > >- /* fill in retval */ >- snprintf(retval, FLDSIZE_X, "+--[%4s %4u]", >- sshkey_type(k), sshkey_size(k)); >- p = strchr(retval, '\0'); >+ /* assemble key detail string */ >+ snprintf(key_details, FLDSIZE_X, "[%s %u]", >+ sshkey_type(k), sshkey_size(k)); > > /* output upper border */ >+ *p++ = '+'; >+ for (i = 0; i < (FLDSIZE_X - strlen(key_details)) / 2; i++) >+ *p++ = '-'; >+ for (i = 0; key_details[i] != 0; i++) >+ *p++ = key_details[i]; > for (i = p - retval - 1; i < FLDSIZE_X; i++) > *p++ = '-'; > *p++ = '+'; >-- >2.0.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2247
:
2442
|
2443
|
2444
|
2445