diff options
Diffstat (limited to 'usr.sbin/ikectl')
-rw-r--r-- | usr.sbin/ikectl/ikectl.c | 28 | ||||
-rw-r--r-- | usr.sbin/ikectl/parser.c | 3 | ||||
-rw-r--r-- | usr.sbin/ikectl/parser.h | 3 |
3 files changed, 31 insertions, 3 deletions
diff --git a/usr.sbin/ikectl/ikectl.c b/usr.sbin/ikectl/ikectl.c index 91b3dd317bf..71f403d39ed 100644 --- a/usr.sbin/ikectl/ikectl.c +++ b/usr.sbin/ikectl/ikectl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikectl.c,v 1.24 2020/03/18 22:12:43 tobhe Exp $ */ +/* $OpenBSD: ikectl.c,v 1.25 2020/03/22 15:59:05 tobhe Exp $ */ /* * Copyright (c) 2007-2013 Reyk Floeter <reyk@openbsd.org> @@ -48,6 +48,8 @@ struct imsgname *monitor_lookup(uint8_t); void monitor_id(struct imsg *); int monitor(struct imsg *); +int show_string(struct imsg *); + int ca_opt(struct parse_result *); struct imsgname imsgs[] = { @@ -56,6 +58,7 @@ struct imsgname imsgs[] = { { IMSG_CTL_VERBOSE, "verbose", NULL }, { IMSG_CTL_RELOAD, "reload", NULL }, { IMSG_CTL_RESET, "reset", NULL }, + { IMSG_CTL_SHOW_SA, "show sa", NULL }, { 0, NULL, NULL } }; @@ -295,6 +298,10 @@ main(int argc, char *argv[]) imsg_compose(ibuf, IMSG_CTL_RESET_ID, 0, 0, -1, res->id, strlen(res->id)); break; + case SHOW_SA: + imsg_compose(ibuf, IMSG_CTL_SHOW_SA, 0, 0, -1, NULL, 0); + done = 0; + break; case RELOAD: imsg_compose(ibuf, IMSG_CTL_RELOAD, 0, 0, -1, NULL, 0); break; @@ -342,6 +349,9 @@ main(int argc, char *argv[]) case MONITOR: done = monitor(&imsg); break; + case SHOW_SA: + done = show_string(&imsg); + break; default: break; } @@ -385,3 +395,19 @@ monitor(struct imsg *imsg) return (done); } + +int +show_string(struct imsg *imsg) +{ + int done = 0; + + if (imsg->hdr.type != IMSG_CTL_SHOW_SA) + return (done); + + if (IMSG_DATA_SIZE(imsg) > 0) + printf("%s", imsg->data); + else + done = 1; + + return (done); +} diff --git a/usr.sbin/ikectl/parser.c b/usr.sbin/ikectl/parser.c index 1d47b98cdb1..fceb60d3d58 100644 --- a/usr.sbin/ikectl/parser.c +++ b/usr.sbin/ikectl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.18 2020/03/18 22:12:43 tobhe Exp $ */ +/* $OpenBSD: parser.c,v 1.19 2020/03/22 15:59:05 tobhe Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -213,6 +213,7 @@ static const struct token t_ca_key_path[] = { static const struct token t_show[] = { { KEYWORD, "ca", SHOW_CA, t_show_ca }, + { KEYWORD, "sa", SHOW_SA, NULL }, { ENDTOKEN, "", NONE, NULL } }; diff --git a/usr.sbin/ikectl/parser.h b/usr.sbin/ikectl/parser.h index 35188bcc343..e69096ab2cd 100644 --- a/usr.sbin/ikectl/parser.h +++ b/usr.sbin/ikectl/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.15 2020/03/18 22:12:43 tobhe Exp $ */ +/* $OpenBSD: parser.h,v 1.16 2020/03/22 15:59:05 tobhe Exp $ */ /* * Copyright (c) 2007-2013 Reyk Floeter <reyk@openbsd.org> @@ -55,6 +55,7 @@ enum actions { CA_KEY_IMPORT, SHOW_CA, SHOW_CA_CERTIFICATES, + SHOW_SA, RESET_ID }; |