aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2015-12-19 10:30:17 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2015-12-19 10:30:17 +0100
commit92b051bd4a00d1be0dc061f20b865d31dd5b014d (patch)
treedf5892cb2e6d28562ca2bc6b3b316d4eee0f6796
parent6943db5679585d2ee12aa9aba3dece6af196f0b4 (diff)
downloadstrongswan-92b051bd4a00d1be0dc061f20b865d31dd5b014d.tar.bz2
strongswan-92b051bd4a00d1be0dc061f20b865d31dd5b014d.tar.xz
vici: allow legacy shortcuts in cert queries
-rw-r--r--src/libcharon/plugins/vici/vici_query.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libcharon/plugins/vici/vici_query.c b/src/libcharon/plugins/vici/vici_query.c
index 76cfb52f9..f488a425a 100644
--- a/src/libcharon/plugins/vici/vici_query.c
+++ b/src/libcharon/plugins/vici/vici_query.c
@@ -40,6 +40,7 @@
#include "vici_query.h"
#include "vici_builder.h"
+#include "vici_cert_info.h"
#include <inttypes.h>
#include <time.h>
@@ -961,20 +962,23 @@ CALLBACK(list_certs, vici_message_t*,
char *str;
str = request->get_str(request, "ANY", "type");
- if (!enum_from_name(certificate_type_names, str, &filter.type))
+ if (enum_from_name(certificate_type_names, str, &filter.type))
{
- DBG1(DBG_CFG, "invalid certificate type '%s'", str);
- goto finalize;
- }
- if (filter.type == CERT_X509)
- {
- str = request->get_str(request, "ANY", "flag");
- if (!enum_from_name(x509_flag_names, str, &filter.flag))
+ if (filter.type == CERT_X509)
{
- DBG1(DBG_CFG, "invalid certificate flag '%s'", str);
- goto finalize;
+ str = request->get_str(request, "ANY", "flag");
+ if (!enum_from_name(x509_flag_names, str, &filter.flag))
+ {
+ DBG1(DBG_CFG, "invalid certificate flag '%s'", str);
+ goto finalize;
+ }
}
}
+ else if (!vici_cert_info_from_str(str, &filter.type, &filter.flag))
+ {
+ DBG1(DBG_CFG, "invalid certificate type '%s'", str);
+ goto finalize;
+ }
str = request->get_str(request, NULL, "subject");
if (str)