mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zkey: Fix generate and import leaving key in an inconsistent state
When a volume or APQN association is made while generating or importing a key, and a duplicate association is detected, then this may leave the key in an inconsistent state. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
344965bd29
commit
672548ce30
+2
-2
@@ -1534,7 +1534,7 @@ int keystore_generate_key(struct keystore *keystore, const char *name,
|
||||
out_free_props:
|
||||
if (key_props != NULL)
|
||||
properties_free(key_props);
|
||||
if (rc != 0 && rc != -EEXIST)
|
||||
if (rc != 0)
|
||||
remove(file_names.skey_filename);
|
||||
out_free_key_filenames:
|
||||
_keystore_free_key_filenames(&file_names);
|
||||
@@ -1617,7 +1617,7 @@ int keystore_import_key(struct keystore *keystore, const char *name,
|
||||
out_free_props:
|
||||
if (key_props != NULL)
|
||||
properties_free(key_props);
|
||||
if (rc != 0 && rc != -EEXIST)
|
||||
if (rc != 0)
|
||||
remove(file_names.skey_filename);
|
||||
out_free_key_filenames:
|
||||
_keystore_free_key_filenames(&file_names);
|
||||
|
||||
Reference in New Issue
Block a user