aboutsummaryrefslogtreecommitdiff
path: root/rcynic
diff options
context:
space:
mode:
Diffstat (limited to 'rcynic')
-rw-r--r--rcynic/rcynic.c37
-rwxr-xr-xrcynic/validation_status.awk32
2 files changed, 51 insertions, 18 deletions
diff --git a/rcynic/rcynic.c b/rcynic/rcynic.c
index 3c7df816..64f44096 100644
--- a/rcynic/rcynic.c
+++ b/rcynic/rcynic.c
@@ -1554,6 +1554,17 @@ static walk_ctx_t *walk_ctx_stack_head(STACK_OF(walk_ctx_t) *wsk)
}
/**
+ * Whether we're done iterating over a walk context. Think of this as
+ * the thing you call (negated) in the second clause of a conceptual
+ * "for" loop.
+ */
+static int walk_ctx_loop_done(STACK_OF(walk_ctx_t) *wsk)
+{
+ walk_ctx_t *w = walk_ctx_stack_head(wsk);
+ return wsk == NULL || w == NULL || w->state >= walk_state_done;
+}
+
+/**
* Walk context iterator. Think of this as the thing you call in the
* third clause of a conceptual "for" loop: this reinitializes as
* necessary for the next pass through the loop.
@@ -1579,26 +1590,17 @@ static void walk_ctx_loop_next(const rcynic_ctx_t *rc, STACK_OF(walk_ctx_t) *wsk
return;
}
- if (w->state < walk_state_done) {
+ while (!walk_ctx_loop_done(wsk)) {
w->state++;
w->manifest_iteration = 0;
w->filename_iteration = 0;
sk_OPENSSL_STRING_pop_free(w->filenames, OPENSSL_STRING_free);
w->filenames = directory_filenames(rc, w->state, &w->certinfo.sia);
+ if (w->manifest != NULL || w->filenames != NULL)
+ return;
}
}
-/**
- * Whether we're done iterating over a walk context. Think of this as
- * the thing you call (negated) in the second clause of a conceptual
- * "for" loop.
- */
-static int walk_ctx_loop_done(STACK_OF(walk_ctx_t) *wsk)
-{
- walk_ctx_t *w = walk_ctx_stack_head(wsk);
- return wsk == NULL || w == NULL || w->state >= walk_state_done;
-}
-
static int check_manifest(rcynic_ctx_t *rc, STACK_OF(walk_ctx_t) *wsk);
/**
@@ -1626,17 +1628,16 @@ static void walk_ctx_loop_init(rcynic_ctx_t *rc, STACK_OF(walk_ctx_t) *wsk)
if (!w->manifest)
logmsg(rc, log_telemetry, "Couldn't get manifest %s, blundering onward", w->certinfo.manifest.s);
- assert(w->filenames == NULL);
- w->filenames = directory_filenames(rc, w->state, &w->certinfo.sia);
-
- w->stale_manifest = w->manifest != NULL && X509_cmp_current_time(w->manifest->nextUpdate) < 0;
-
w->manifest_iteration = 0;
w->filename_iteration = 0;
w->state++;
-
assert(w->state == walk_state_current);
+ assert(w->filenames == NULL);
+ w->filenames = directory_filenames(rc, w->state, &w->certinfo.sia);
+
+ w->stale_manifest = w->manifest != NULL && X509_cmp_current_time(w->manifest->nextUpdate) < 0;
+
while (!walk_ctx_loop_done(wsk) &&
(w->manifest == NULL || w->manifest_iteration >= sk_FileAndHash_num(w->manifest->fileList)) &&
(w->filenames == NULL || w->filename_iteration >= sk_OPENSSL_STRING_num(w->filenames)))
diff --git a/rcynic/validation_status.awk b/rcynic/validation_status.awk
new file mode 100755
index 00000000..92012595
--- /dev/null
+++ b/rcynic/validation_status.awk
@@ -0,0 +1,32 @@
+#!/usr/bin/awk -f
+
+# $Id$
+#
+# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# Prettyprint output of validation_status.xsl
+
+BEGIN {
+ FS = "\t";
+ cmd = "xsltproc validation_status.xsl";
+ if (ARGC == 1)
+ cmd = cmd " -";
+ else
+ for (i = 1; i < ARGC; ++i)
+ cmd = cmd " " ARGV[i];
+ while ((cmd | getline) > 0)
+ printf "%s %8s %-40s %s\n", $1, $4, $2, $3;
+ close(cmd);
+}