summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-04-30 17:51:33 +0200
committerYves-Alexis Perez <corsac@debian.org>2013-04-30 17:51:33 +0200
commitc83921a2b566aa9d55d8ccc7258f04fca6292ee6 (patch)
tree44039788fc816c84d5788df847d1555413ebe55a /scripts
parent10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43 (diff)
downloadvyos-strongswan-c83921a2b566aa9d55d8ccc7258f04fca6292ee6.tar.gz
vyos-strongswan-c83921a2b566aa9d55d8ccc7258f04fca6292ee6.zip
Imported Upstream version 5.0.4
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.in1
-rw-r--r--scripts/dnssec.c41
2 files changed, 30 insertions, 12 deletions
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 1aa9c2e60..390c820aa 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -283,6 +283,7 @@ dev_headers = @dev_headers@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
+fips_mode = @fips_mode@
gtk_CFLAGS = @gtk_CFLAGS@
gtk_LIBS = @gtk_LIBS@
h_plugins = @h_plugins@
diff --git a/scripts/dnssec.c b/scripts/dnssec.c
index 89ea56ea6..315a14618 100644
--- a/scripts/dnssec.c
+++ b/scripts/dnssec.c
@@ -16,25 +16,47 @@
#include <stdio.h>
#include <library.h>
+#include <utils/debug.h>
+
+/**
+ * Define debug level
+ */
+static level_t dbg_level = 1;
+
+static void dbg_dnssec(debug_t group, level_t level, char *fmt, ...)
+{
+ if ((level <= dbg_level) || level <= 1)
+ {
+ va_list args;
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ }
+}
int main(int argc, char *argv[])
{
resolver_t *resolver;
resolver_response_t *response;
enumerator_t *enumerator;
+ chunk_t rdata;
rr_set_t *rrset;
rr_t *rr;
- chunk_t chunk;
library_init(NULL);
atexit(library_deinit);
+
+ dbg = dbg_dnssec;
+
if (!lib->plugins->load(lib->plugins, NULL, PLUGINS))
{
return 1;
}
if (argc != 2)
{
- fprintf(stderr, "usage: %s <name>\n", argv[0]);
+ fprintf(stderr, "usage: dnssec <name>\n");
return 1;
}
@@ -82,9 +104,7 @@ int main(int argc, char *argv[])
enumerator = rrset->create_rr_enumerator(rrset);
while (enumerator->enumerate(enumerator, &rr))
{
- printf(" name: ");
- printf(rr->get_name(rr));
- printf("\n");
+ printf(" name: %s\n", rr->get_name(rr));
}
enumerator = rrset->create_rrsig_enumerator(rrset);
@@ -93,13 +113,10 @@ int main(int argc, char *argv[])
printf(" RRSIGs for the RRset:\n");
while (enumerator->enumerate(enumerator, &rr))
{
- printf(" name: ");
- printf(rr->get_name(rr));
- printf("\n RDATA: ");
- chunk = rr->get_rdata(rr);
- chunk = chunk_to_hex(chunk, NULL, TRUE);
- printf(chunk.ptr);
- printf("\n");
+ rdata = rr->get_rdata(rr);
+
+ printf(" name: %s\n", rr->get_name(rr));
+ printf(" RDATA: %#B\n", &rdata);
}
}