From 082bc5773abe1c003bf34bbb3bf6a6b5282a212c Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 8 Mar 2013 08:32:50 +0100 Subject: extract: Fix regression in --purpose option The --purpose option would only match certificates that had no purposes marked on them. Fix it so that it correctly matches certificates with the given purpose. https://bugs.freedesktop.org/show_bug.cgi?id=62009 --- tools/extract-info.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tools/extract-info.c') diff --git a/tools/extract-info.c b/tools/extract-info.c index aa66c83..ee6dbe1 100644 --- a/tools/extract-info.c +++ b/tools/extract-info.c @@ -316,9 +316,18 @@ void p11_extract_info_limit_purpose (p11_extract_info *ex, const char *purpose) { - if (!ex->limit_to_purposes) + char *value; + + if (!ex->limit_to_purposes) { ex->limit_to_purposes = p11_dict_new (p11_dict_str_hash, p11_dict_str_equal, free, NULL); - p11_dict_set (ex->limit_to_purposes, strdup (purpose), NULL); + return_if_fail (ex->limit_to_purposes != NULL); + } + + value = strdup (purpose); + return_if_fail (value != NULL); + + if (!p11_dict_set (ex->limit_to_purposes, value, value)) + return_if_reached (); } static char * -- cgit v1.1