Blame SOURCES/opencryptoki-3.16.0-e88a9de3128df1c4b89bd4c7312c15bb3eb34593.patch

c87d79
commit e88a9de3128df1c4b89bd4c7312c15bb3eb34593
c87d79
Author: Ingo Franzki <ifranzki@linux.ibm.com>
c87d79
Date:   Thu Jul 8 15:18:30 2021 +0200
c87d79
c87d79
    pkcstok_migrate: Don't remove 'tokversion = x.y' during migration
c87d79
    
c87d79
    When migrating a slot the opencryptoki.conf file is modified. If it
c87d79
    contains slots that already contain the 'tokversion = x.y' keyword,
c87d79
    this is accidentally removed when migrating another slot.
c87d79
    
c87d79
    Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
c87d79
c87d79
diff --git a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
c87d79
index 3df1596e..05081aff 100644
c87d79
--- a/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
c87d79
+++ b/usr/sbin/pkcstok_migrate/pkcstok_migrate.c
c87d79
@@ -2119,7 +2119,7 @@ static int parseupdate_key_vers(void *private, int tok, unsigned int vers)
c87d79
 {
c87d79
 	struct parseupdate *u = (struct parseupdate *)private;
c87d79
 
c87d79
-    if (tok != KW_TOKVERSION)
c87d79
+    if (tok == KW_TOKVERSION && !u->activeslot)
c87d79
         fprintf(u->f, "  %s = %d.%d", keyword_token_to_str(tok),
c87d79
                 vers >> 16, vers & 0xffu);
c87d79
     return 0;