|
|
073263 |
To: vim_dev@googlegroups.com
|
|
|
073263 |
Subject: Patch 7.4.403
|
|
|
073263 |
Fcc: outbox
|
|
|
073263 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
073263 |
Mime-Version: 1.0
|
|
|
073263 |
Content-Type: text/plain; charset=UTF-8
|
|
|
073263 |
Content-Transfer-Encoding: 8bit
|
|
|
073263 |
------------
|
|
|
073263 |
|
|
|
073263 |
Patch 7.4.403
|
|
|
073263 |
Problem: Valgrind reports errors when running test 72. (Dominique Pelle)
|
|
|
073263 |
Solution: Reset the local 'cryptmethod' option before storing the seed.
|
|
|
073263 |
Set the seed in the memfile even when there is no block0 yet.
|
|
|
073263 |
Files: src/fileio.c, src/option.c, src/memline.c
|
|
|
073263 |
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.402/src/fileio.c 2014-08-10 13:34:59.056785459 +0200
|
|
|
073263 |
--- src/fileio.c 2014-08-13 21:27:51.452857400 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 2944,2949 ****
|
|
|
073263 |
--- 2944,2950 ----
|
|
|
073263 |
* Avoids accidentally overwriting the file with garbage. */
|
|
|
073263 |
curbuf->b_p_ro = TRUE;
|
|
|
073263 |
|
|
|
073263 |
+ /* Set the cryptmethod local to the buffer. */
|
|
|
073263 |
crypt_set_cm_option(curbuf, method);
|
|
|
073263 |
if (cryptkey == NULL && !*did_ask)
|
|
|
073263 |
{
|
|
|
073263 |
*** ../vim-7.4.402/src/option.c 2014-08-10 13:34:59.060785459 +0200
|
|
|
073263 |
--- src/option.c 2014-08-13 21:48:49.924876683 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 6163,6168 ****
|
|
|
073263 |
--- 6163,6176 ----
|
|
|
073263 |
p_cm = vim_strsave((char_u *)"zip");
|
|
|
073263 |
new_value_alloced = TRUE;
|
|
|
073263 |
}
|
|
|
073263 |
+ /* When using ":set cm=name" the local value is going to be empty.
|
|
|
073263 |
+ * Do that here, otherwise the crypt functions will still use the
|
|
|
073263 |
+ * local value. */
|
|
|
073263 |
+ if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ free_string_option(curbuf->b_p_cm);
|
|
|
073263 |
+ curbuf->b_p_cm = empty_option;
|
|
|
073263 |
+ }
|
|
|
073263 |
|
|
|
073263 |
/* Need to update the swapfile when the effective method changed.
|
|
|
073263 |
* Set "s" to the effective old value, "p" to the effective new
|
|
|
073263 |
*** ../vim-7.4.402/src/memline.c 2014-08-10 13:34:59.060785459 +0200
|
|
|
073263 |
--- src/memline.c 2014-08-13 21:52:40.076880210 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 235,240 ****
|
|
|
073263 |
--- 235,241 ----
|
|
|
073263 |
} upd_block0_T;
|
|
|
073263 |
|
|
|
073263 |
#ifdef FEAT_CRYPT
|
|
|
073263 |
+ static void ml_set_mfp_crypt __ARGS((buf_T *buf));
|
|
|
073263 |
static void ml_set_b0_crypt __ARGS((buf_T *buf, ZERO_BL *b0p));
|
|
|
073263 |
#endif
|
|
|
073263 |
static int ml_check_b0_id __ARGS((ZERO_BL *b0p));
|
|
|
073263 |
***************
|
|
|
073263 |
*** 433,438 ****
|
|
|
073263 |
--- 434,458 ----
|
|
|
073263 |
|
|
|
073263 |
#if defined(FEAT_CRYPT) || defined(PROTO)
|
|
|
073263 |
/*
|
|
|
073263 |
+ * Prepare encryption for "buf" for the current key and method.
|
|
|
073263 |
+ */
|
|
|
073263 |
+ static void
|
|
|
073263 |
+ ml_set_mfp_crypt(buf)
|
|
|
073263 |
+ buf_T *buf;
|
|
|
073263 |
+ {
|
|
|
073263 |
+ if (*buf->b_p_key != NUL)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ int method_nr = crypt_get_method_nr(buf);
|
|
|
073263 |
+
|
|
|
073263 |
+ if (method_nr > CRYPT_M_ZIP)
|
|
|
073263 |
+ {
|
|
|
073263 |
+ /* Generate a seed and store it in the memfile. */
|
|
|
073263 |
+ sha2_seed(buf->b_ml.ml_mfp->mf_seed, MF_SEED_LEN, NULL, 0);
|
|
|
073263 |
+ }
|
|
|
073263 |
+ }
|
|
|
073263 |
+ }
|
|
|
073263 |
+
|
|
|
073263 |
+ /*
|
|
|
073263 |
* Prepare encryption for "buf" with block 0 "b0p".
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
***************
|
|
|
073263 |
*** 915,922 ****
|
|
|
073263 |
ZERO_BL *b0p;
|
|
|
073263 |
|
|
|
073263 |
mfp = buf->b_ml.ml_mfp;
|
|
|
073263 |
! if (mfp == NULL || (hp = mf_get(mfp, (blocknr_T)0, 1)) == NULL)
|
|
|
073263 |
return;
|
|
|
073263 |
b0p = (ZERO_BL *)(hp->bh_data);
|
|
|
073263 |
if (ml_check_b0_id(b0p) == FAIL)
|
|
|
073263 |
EMSG(_("E304: ml_upd_block0(): Didn't get block 0??"));
|
|
|
073263 |
--- 935,953 ----
|
|
|
073263 |
ZERO_BL *b0p;
|
|
|
073263 |
|
|
|
073263 |
mfp = buf->b_ml.ml_mfp;
|
|
|
073263 |
! if (mfp == NULL)
|
|
|
073263 |
! return;
|
|
|
073263 |
! hp = mf_get(mfp, (blocknr_T)0, 1);
|
|
|
073263 |
! if (hp == NULL)
|
|
|
073263 |
! {
|
|
|
073263 |
! #ifdef FEAT_CRYPT
|
|
|
073263 |
! /* Possibly update the seed in the memfile before there is a block0. */
|
|
|
073263 |
! if (what == UB_CRYPT)
|
|
|
073263 |
! ml_set_mfp_crypt(buf);
|
|
|
073263 |
! #endif
|
|
|
073263 |
return;
|
|
|
073263 |
+ }
|
|
|
073263 |
+
|
|
|
073263 |
b0p = (ZERO_BL *)(hp->bh_data);
|
|
|
073263 |
if (ml_check_b0_id(b0p) == FAIL)
|
|
|
073263 |
EMSG(_("E304: ml_upd_block0(): Didn't get block 0??"));
|
|
|
073263 |
*** ../vim-7.4.402/src/version.c 2014-08-12 20:14:28.795371197 +0200
|
|
|
073263 |
--- src/version.c 2014-08-13 17:23:02.964632329 +0200
|
|
|
073263 |
***************
|
|
|
073263 |
*** 743,744 ****
|
|
|
073263 |
--- 743,746 ----
|
|
|
073263 |
{ /* Add new patch number below this line */
|
|
|
073263 |
+ /**/
|
|
|
073263 |
+ 403,
|
|
|
073263 |
/**/
|
|
|
073263 |
|
|
|
073263 |
--
|
|
|
073263 |
How To Keep A Healthy Level Of Insanity:
|
|
|
073263 |
9. As often as possible, skip rather than walk.
|
|
|
073263 |
|
|
|
073263 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
073263 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
073263 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
073263 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|