swanctl: list EAP type in --list-conns
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 26 Apr 2016 15:13:20 +0000 (17:13 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 26 Apr 2016 15:15:37 +0000 (17:15 +0200)
src/swanctl/commands/list_conns.c

index 22a5633..b73a9f7 100644 (file)
@@ -2,6 +2,9 @@
  * Copyright (C) 2014 Martin Willi
  * Copyright (C) 2014 revosec AG
  *
+ * Copyright (C) 2016 Andreas Steffen
+ * HSR Hochschule fuer Technik Rapperswil
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
  * Free Software Foundation; either version 2 of the License, or (at your
@@ -119,15 +122,19 @@ CALLBACK(conn_sn, int,
        if (strpfx(name, "local") || strpfx(name, "remote"))
        {
                hashtable_t *auth;
+               char *class;
 
                auth = hashtable_create(hashtable_hash_str, hashtable_equals_str, 1);
                ret = vici_parse_cb(res, NULL, values, list, auth);
                if (ret == 0)
                {
+                       class = auth->get(auth, "class") ?: "unspecified";
+                       if (strcaseeq(class, "EAP"))
+                       {
+                               class = auth->get(auth, "eap-type") ?: class;
+                       }
                        printf("  %s %s authentication:\n",
-                               strpfx(name, "local") ? "local" : "remote",
-                               auth->get(auth, "class") ?: "unspecified");
-                       if (auth->get(auth, "id"))
+                               strpfx(name, "local") ? "local" : "remote", class);
                        {
                                printf("    id: %s\n", auth->get(auth, "id"));
                        }