Blame SOURCES/opencryptoki-3.16.0-5824364d995e5d2418f885ee57e377e11d1b3302.patch

8520e9
commit 5824364d995e5d2418f885ee57e377e11d1b3302
8520e9
Author: Ingo Franzki <ifranzki@linux.ibm.com>
8520e9
Date:   Wed Jul 7 13:44:46 2021 +0200
8520e9
8520e9
    pkcstok_migrate: Quote strings with spaces in opencryptoki.conf
8520e9
    
8520e9
    When modifying opencryptoki.conf during token migration, put quotes
8520e9
    around strings that contain spaces, e.g. for the slot description and
8520e9
    manufacturer.
8520e9
    
8520e9
    Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
8520e9
8520e9
diff --git a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
8520e9
index 94fd1196..3df1596e 100644
8520e9
--- a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
8520e9
+++ b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
8520e9
@@ -2107,7 +2107,10 @@ static int parseupdate_key_str(void *private, int tok, const char *val)
8520e9
 {
8520e9
 	struct parseupdate *u = (struct parseupdate *)private;
8520e9
 
8520e9
-    if (tok != KW_TOKVERSION)
8520e9
+    if (tok != KW_HWVERSION && tok != KW_FWVERSION &&
8520e9
+        strchr(val, ' ') != NULL)
8520e9
+        fprintf(u->f, "  %s = \"%s\"", keyword_token_to_str(tok), val);
8520e9
+    else if (tok != KW_TOKVERSION)
8520e9
         fprintf(u->f, "  %s = %s", keyword_token_to_str(tok), val);
8520e9
     return 0;
8520e9
 }