Blame SOURCES/opencryptoki-3.16.0-e88a9de3128df1c4b89bd4c7312c15bb3eb34593.patch

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