Blob Blame History Raw
commit 5824364d995e5d2418f885ee57e377e11d1b3302
Author: Ingo Franzki <ifranzki@linux.ibm.com>
Date:   Wed Jul 7 13:44:46 2021 +0200

    pkcstok_migrate: Quote strings with spaces in opencryptoki.conf
    
    When modifying opencryptoki.conf during token migration, put quotes
    around strings that contain spaces, e.g. for the slot description and
    manufacturer.
    
    Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>

diff --git a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
index 94fd1196..3df1596e 100644
--- a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
+++ b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
@@ -2107,7 +2107,10 @@ static int parseupdate_key_str(void *private, int tok, const char *val)
 {
 	struct parseupdate *u = (struct parseupdate *)private;
 
-    if (tok != KW_TOKVERSION)
+    if (tok != KW_HWVERSION && tok != KW_FWVERSION &&
+        strchr(val, ' ') != NULL)
+        fprintf(u->f, "  %s = \"%s\"", keyword_token_to_str(tok), val);
+    else if (tok != KW_TOKVERSION)
         fprintf(u->f, "  %s = %s", keyword_token_to_str(tok), val);
     return 0;
 }