summaryrefslogtreecommitdiff
path: root/trust
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2018-12-23 14:11:00 +0100
committerDaiki Ueno <ueno@gnu.org>2019-01-04 15:12:04 +0100
commit0dd62395788ae566d3adef967611bce214a04435 (patch)
tree4181770abf1ebf40ebeb2a58fad7a468912a434b /trust
parent95faa51a23fc416e718dbd740adfce31f642530b (diff)
trust: Propagate library verbosity to module through init_args
Previously, even when the -v option is used with the 'trust' command, the messages from p11-kit-trust.so module were suppressed because the verbosity setting is not propagated to the module.
Diffstat (limited to 'trust')
-rw-r--r--trust/enumerate.c11
-rw-r--r--trust/module.c5
-rw-r--r--trust/p11-kit-trust.module4
3 files changed, 18 insertions, 2 deletions
diff --git a/trust/enumerate.c b/trust/enumerate.c
index e197765..0cef089 100644
--- a/trust/enumerate.c
+++ b/trust/enumerate.c
@@ -674,6 +674,8 @@ p11_enumerate_opt_purpose (p11_enumerate *ex,
return true;
}
+extern bool p11_print_messages;
+
bool
p11_enumerate_ready (p11_enumerate *ex,
const char *def_filter)
@@ -687,8 +689,13 @@ p11_enumerate_ready (p11_enumerate *ex,
* We only "believe" the CKA_TRUSTED and CKA_X_DISTRUSTED attributes
* we get from modules explicitly marked as containing trust-policy.
*/
- if (!ex->modules)
- ex->modules = p11_kit_modules_load_and_initialize (P11_KIT_MODULE_TRUSTED);
+ if (!ex->modules) {
+ int flags = P11_KIT_MODULE_TRUSTED;
+ if (p11_print_messages)
+ flags |= P11_KIT_MODULE_VERBOSE;
+
+ ex->modules = p11_kit_modules_load_and_initialize (flags);
+ }
if (!ex->modules)
return false;
if (ex->modules[0] == NULL)
diff --git a/trust/module.c b/trust/module.c
index 24cda87..0c16a39 100644
--- a/trust/module.c
+++ b/trust/module.c
@@ -287,6 +287,11 @@ parse_argument (char *arg,
free (gl.paths);
gl.paths = value ? strdup (value) : NULL;
+ } else if (strcmp (arg, "verbose") == 0) {
+ if (strcmp (value, "yes") == 0)
+ p11_message_loud ();
+ else if (strcmp (value, "no") == 0)
+ p11_message_quiet ();
} else {
p11_message ("unrecognized module argument: %s", arg);
}
diff --git a/trust/p11-kit-trust.module b/trust/p11-kit-trust.module
index 72122c3..a2a3306 100644
--- a/trust/p11-kit-trust.module
+++ b/trust/p11-kit-trust.module
@@ -18,3 +18,7 @@ x-trust-lookup: pkcs11:library-description=PKCS%2311%20Kit%20Trust%20Module
# Prevent this module being loaded by the proxy module
disable-in: p11-kit-proxy
+
+# This will be overwritten by appending "verbose=yes", if the trust
+# command is called with the -v option.
+x-init-reserved: