summaryrefslogtreecommitdiff
path: root/proto/rpki/ssh_transport.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2021-01-07 05:56:34 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2021-01-07 06:04:31 +0100
commit17663b6a7c505226cfe9ccc0671611075a3dff57 (patch)
tree45bff7762a01dad8ddcca0826d71bc3083e6137a /proto/rpki/ssh_transport.c
parent2a8cc7259e236773f1b8423ef63305a5b8bfd652 (diff)
RPKI: Remove port (and SSH username) from 'Cache server' output line
It was mixed-up if hostname is IPv6 address, and reporting separate values (like port) on separate lines fits better into key-value style of 'show protocols all' output. Also, the patch simplifies transport identification formatting (although it is unused now). Thanks to Alarig Le Lay for the suggestion.
Diffstat (limited to 'proto/rpki/ssh_transport.c')
-rw-r--r--proto/rpki/ssh_transport.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/proto/rpki/ssh_transport.c b/proto/rpki/ssh_transport.c
index 469eb199..6333f367 100644
--- a/proto/rpki/ssh_transport.c
+++ b/proto/rpki/ssh_transport.c
@@ -47,17 +47,15 @@ rpki_tr_ssh_ident(struct rpki_tr_sock *tr)
struct rpki_cache *cache = tr->cache;
struct rpki_config *cf = (void *) cache->p->p.cf;
struct rpki_tr_ssh_config *ssh_cf = (void *) cf->tr_config.spec;
+ const char *username = ssh_cf->user;
if (tr->ident != NULL)
return tr->ident;
- const char *username = ssh_cf->user;
- const char *host = cf->hostname;
- u16 port = cf->port;
-
- size_t len = strlen(username) + 1 + strlen(host) + 1 + 5 + 1; /* <user> + '@' + <host> + ':' + <port> + '\0' */
+ /* Length: <user> + '@' + <host> + ' port ' + <port> + '\0' */
+ size_t len = strlen(username) + 1 + strlen(cf->hostname) + 1 + 5 + 1;
char *ident = mb_alloc(cache->pool, len);
- bsnprintf(ident, len, "%s@%s:%u", username, host, port);
+ bsnprintf(ident, len, "%s@%s:%u", username, cf->hostname, cf->port);
tr->ident = ident;
return tr->ident;