swanctl: Report PPK configuration in --list-conns
authorTobias Brunner <tobias@strongswan.org>
Fri, 27 Jul 2018 10:34:23 +0000 (12:34 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 10 Sep 2018 16:03:02 +0000 (18:03 +0200)
src/swanctl/commands/list_conns.c

index ce903e5..5f7dd81 100644 (file)
@@ -238,7 +238,7 @@ CALLBACK(conns, int,
        void *null, vici_res_t *res, char *name)
 {
        int ret;
-       char *version, *reauth_time, *rekey_time, *dpd_delay;
+       char *version, *reauth_time, *rekey_time, *dpd_delay, *ppk_id, *ppk_req;
        hashtable_t *ike;
 
        version     = vici_find_str(res, "", "%s.version", name);
@@ -282,6 +282,14 @@ CALLBACK(conns, int,
        }
        printf("\n");
 
+       ppk_id = vici_find_str(res, NULL, "%s.ppk_id", name);
+       ppk_req = vici_find_str(res, NULL, "%s.ppk_required", name);
+       if (ppk_id || ppk_req)
+       {
+               printf("  ppk: %s%s%srequired\n", ppk_id ?: "", ppk_id ? ", " : "",
+                          !ppk_req || !streq(ppk_req, "yes") ? "not " : "");
+       }
+
        ret = vici_parse_cb(res, conn_sn, NULL, conn_list, ike);
        free_hashtable(ike);
        return ret;