aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2011-05-19 22:37:50 +0000
committerRob Austein <sra@hactrn.net>2011-05-19 22:37:50 +0000
commit21f20c298a4ec9fb107fee09b78b0aa209a09590 (patch)
treeed12d9ab7e0343b9e23a74f2e2abb10f3d799212
parentc1c0cbe434232f31c36c6c90f3704b931b7c7185 (diff)
Checkpoint
svn path=/rcynic-ng/rcynic.c; revision=3822
-rw-r--r--rcynic-ng/rcynic.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/rcynic-ng/rcynic.c b/rcynic-ng/rcynic.c
index be9cbdc9..178d41ba 100644
--- a/rcynic-ng/rcynic.c
+++ b/rcynic-ng/rcynic.c
@@ -583,6 +583,31 @@ static STACK_OF(walk_ctx_t) *walk_ctx_stack_clone(STACK_OF(walk_ctx_t) *old_sk)
}
/**
+ * Extract certificate stack from walk context stack. Returns a newly
+ * created STACK_OF(X509) pointing to the existing cert objects (ie,
+ * this is a shallow copy, so only free the STACK_OF(X509), not the
+ * certificates themselves).
+ */
+static STACK_OF(X509) *walk_ctx_stack_certs(STACK_OF(walk_ctx_t) *sk)
+{
+ STACK_OF(X509) *xk = sk_X509_new_null();
+ int i;
+
+ for (i = 0; i < sk_walk_ctx_t_num(sk); i++) {
+ walk_ctx_t *w = sk_walk_ctx_t_value(sk, i);
+ if (w == NULL || !sk_X509_push(xk, w->cert))
+ goto fail;
+ }
+
+ return xk;
+
+ fail:
+ sk_X509_free(xk);
+ return NULL;
+}
+
+
+/**
* Free a walk context stack, decrementing reference counts of each
* frame on it.
*/