diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-06-09 18:35:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-06-09 18:35:25 +0200 |
commit | bc56336bb4501884257352446abb60713cef6452 (patch) | |
tree | bf4f55292e2e42533ceadfbd769aab281868a290 /src/option.c | |
parent | 0481fee48800817bee206bb2f958fe04be4d8db6 (diff) |
patch 7.4.730v7.4.730
Problem: When setting the crypt key and using a swap file, text may be
encrypted twice or unencrypted text remains in the swap file.
(Issue 369)
Solution: Call ml_preserve() before re-encrypting. Set correct index for
next pointer block.
Diffstat (limited to 'src/option.c')
-rw-r--r-- | src/option.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/option.c b/src/option.c index 56d94934d5..7bcb26abcf 100644 --- a/src/option.c +++ b/src/option.c @@ -6163,7 +6163,8 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, # endif if (STRCMP(curbuf->b_p_key, oldval) != 0) /* Need to update the swapfile. */ - ml_set_crypt_key(curbuf, oldval, crypt_get_method_nr(curbuf)); + ml_set_crypt_key(curbuf, oldval, + *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm); } else if (gvarp == &p_cm) @@ -6207,8 +6208,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, else p = curbuf->b_p_cm; if (STRCMP(s, p) != 0) - ml_set_crypt_key(curbuf, curbuf->b_p_key, - crypt_method_nr_from_name(s)); + ml_set_crypt_key(curbuf, curbuf->b_p_key, s); /* If the global value changes need to update the swapfile for all * buffers using that value. */ @@ -6218,8 +6218,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, for (buf = firstbuf; buf != NULL; buf = buf->b_next) if (buf != curbuf && *buf->b_p_cm == NUL) - ml_set_crypt_key(buf, buf->b_p_key, - crypt_method_nr_from_name(oldval)); + ml_set_crypt_key(buf, buf->b_p_key, oldval); } } } |