commit 2eedcaea0fcc6a09e6774f90ab61f35a0d19b7e1
parent da1b45c1f740e74c392081065aa36c0bbf4a3e99
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Sat, 19 Mar 2016 20:00:57 +0100
Do not create password block when deleting a password from store.
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/passwordstore.c b/src/passwordstore.c
@@ -121,11 +121,17 @@ gboolean passwd_store_set(PasswordBlockType block_type,
(encrypted ? ", already encrypted" : "") );
// find correct block (create if needed)
- if ((block = _get_block(block_type, block_name)) == NULL &&
- (block = _new_block(block_type, block_name)) == NULL) {
- debug_print("Could not create password block (%d/%s)\n",
- block_type, block_name);
- return FALSE;
+ if ((block = _get_block(block_type, block_name)) == NULL) {
+ /* If caller wants to delete a password, and even its block
+ * doesn't exist, we're done. */
+ if (password == NULL)
+ return TRUE;
+
+ if ((block = _new_block(block_type, block_name)) == NULL) {
+ debug_print("Could not create password block (%d/%s)\n",
+ block_type, block_name);
+ return FALSE;
+ }
}
if (password == NULL) {