Blob Blame History Raw
From 2565cf6c5cc7a0af7f426b7c9b03ac2f7c76005a Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 7 Jan 2019 11:31:50 +0100
Subject: [PATCH] options: fix broken -T option when passing additional
 arguments

The commit 175e47711c7 ("lib/tpm2_options: restore TCTI configuration
environment variables") restored how the TCTI configuration was setup
for the 3.X releases, but this broke the -T,--tcti option since was
ignored.

Commit 554a13f45c0 ("options: fix broken -T option") partially fixed
this, but only when additional TCTI arguments were not used.

For example when specifying the -T device:/dev/tpmrm0 TCTI option:

$ tpm2_pcrlist -T device:/dev/tpmrm0
...
ERROR: Could not dlopen library: "device:/dev/tpmrm0"
ERROR: Could not load tcti, got: "device:/dev/tpmrm0"

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
 lib/tpm2_options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tpm2_options.c b/lib/tpm2_options.c
index 006c46e4944..1d1093aa74d 100644
--- a/lib/tpm2_options.c
+++ b/lib/tpm2_options.c
@@ -291,7 +291,7 @@ static tcti_conf tcti_get_config(const char *optstr) {
             }
         }
     } else {
-        conf.name = strdup(optstr);
+        parse_env_tcti(optstr, &conf);
     }
 
     if (!conf.name) {
-- 
2.19.2