chiark / gitweb /
server/admin.c, server/tripe-admin.5.in: Fix PEERINFO segfault.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 15 Dec 2012 13:40:57 +0000 (13:40 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 15 Dec 2012 14:13:05 +0000 (14:13 +0000)
It's allowed for p_privtag to return null, so just trying to print it is
a bad idea.  This introduces a protocol change, since there is no single
tag chosen in the absence of `-priv' or `-t' options -- instead, there's
a search list; this is represented with the special tag `(default)'.

server/admin.c
server/tripe-admin.5.in

index 0e3effb0a00389324e2d1b5939402961809432d5..487010e18e213ae70255cdd40261b2342d92ddae 100644 (file)
@@ -1831,13 +1831,15 @@ static void acmd_peerinfo(admin *a, unsigned ac, char *av[])
 {
   peer *p;
   const peerspec *ps;
+  const char *ptag;
 
   if ((p = a_findpeer(a, av[0])) != 0) {
     ps = p_spec(p);
     a_info(a, "tunnel=%s", ps->tops->name, A_END);
     a_info(a, "key=%s", p_tag(p),
           "current-key=%s", p->kx.kpub->tag, A_END);
-    a_info(a, "private-key=%s", p_privtag(p),
+    if ((ptag = p_privtag(p)) == 0) ptag = "(default)";
+    a_info(a, "private-key=%s", ptag,
           "current-private-key=%s", p->kx.kpriv->tag, A_END);
     a_info(a, "keepalive=%lu", ps->t_ka, A_END);
     a_ok(a);
index 3f13de4a8840cc4370173a6423d43d38c1da32b7..7b801740a396fff799a13c218b287b56fb5f893d 100644 (file)
@@ -570,7 +570,12 @@ may change during the life of the association.
 .B private-key
 The private key tag being used for the peer, as passed to the
 .B ADD
-command.
+command, or the
+.RB ` \-t '
+command-line option.  If neither of these was given explicitly, the
+private key tag is shown as
+.RB ` (default) ',
+since there is no fixed tag used under these circumstances.
 .TP
 .B current-private-key
 The full key tag of the private key currently being used for this