astepano / rpms / vim

Forked from rpms/vim 6 years ago
Clone
f7e3447
To: vim_dev@googlegroups.com
f7e3447
Subject: Patch 7.4.509
f7e3447
Fcc: outbox
f7e3447
From: Bram Moolenaar <Bram@moolenaar.net>
f7e3447
Mime-Version: 1.0
f7e3447
Content-Type: text/plain; charset=UTF-8
f7e3447
Content-Transfer-Encoding: 8bit
f7e3447
------------
f7e3447
f7e3447
Patch 7.4.509
f7e3447
Problem:    Users are not aware their encryption is weak.
f7e3447
Solution:   Give a warning when prompting for the key.
f7e3447
Files:	    src/crypt.c, src/ex_docmd.c, src/fileio.c, src/main.c,
f7e3447
	    src/proto/crypt.pro
f7e3447
f7e3447
f7e3447
*** ../vim-7.4.508/src/crypt.c	2014-08-13 22:05:49.032892299 +0200
f7e3447
--- src/crypt.c	2014-11-12 15:10:22.359161977 +0100
f7e3447
***************
f7e3447
*** 504,509 ****
f7e3447
--- 504,529 ----
f7e3447
  }
f7e3447
  
f7e3447
  /*
f7e3447
+  * Check the crypt method and give a warning if it's outdated.
f7e3447
+  */
f7e3447
+     void
f7e3447
+ crypt_check_method(method)
f7e3447
+     int method;
f7e3447
+ {
f7e3447
+     if (method < CRYPT_M_BF2)
f7e3447
+     {
f7e3447
+ 	msg_scroll = TRUE;
f7e3447
+ 	MSG(_("Warning: Using a weak encryption method; see :help 'cm'"));
f7e3447
+     }
f7e3447
+ }
f7e3447
+ 
f7e3447
+     void
f7e3447
+ crypt_check_current_method()
f7e3447
+ {
f7e3447
+     crypt_check_method(crypt_get_method_nr(curbuf));
f7e3447
+ }
f7e3447
+ 
f7e3447
+ /*
f7e3447
   * Ask the user for a crypt key.
f7e3447
   * When "store" is TRUE, the new key is stored in the 'key' option, and the
f7e3447
   * 'key' option value is returned: Don't free it.
f7e3447
*** ../vim-7.4.508/src/ex_docmd.c	2014-11-05 09:53:19.989153321 +0100
f7e3447
--- src/ex_docmd.c	2014-11-12 14:53:09.621921631 +0100
f7e3447
***************
f7e3447
*** 11524,11529 ****
f7e3447
--- 11524,11530 ----
f7e3447
  ex_X(eap)
f7e3447
      exarg_T	*eap UNUSED;
f7e3447
  {
f7e3447
+     crypt_check_current_method();
f7e3447
      (void)crypt_get_key(TRUE, TRUE);
f7e3447
  }
f7e3447
  #endif
f7e3447
*** ../vim-7.4.508/src/fileio.c	2014-10-31 19:51:33.010698056 +0100
f7e3447
--- src/fileio.c	2014-11-12 15:10:44.986925300 +0100
f7e3447
***************
f7e3447
*** 2958,2963 ****
f7e3447
--- 2958,2964 ----
f7e3447
  		 * Happens when retrying to detect encoding. */
f7e3447
  		smsg((char_u *)_(need_key_msg), fname);
f7e3447
  		msg_scroll = TRUE;
f7e3447
+ 		crypt_check_method(method);
f7e3447
  		cryptkey = crypt_get_key(newfile, FALSE);
f7e3447
  		*did_ask = TRUE;
f7e3447
  
f7e3447
*** ../vim-7.4.508/src/main.c	2014-09-19 13:46:49.550399801 +0200
f7e3447
--- src/main.c	2014-11-12 14:52:47.866169622 +0100
f7e3447
***************
f7e3447
*** 854,859 ****
f7e3447
--- 854,860 ----
f7e3447
  #ifdef FEAT_CRYPT
f7e3447
      if (params.ask_for_key)
f7e3447
      {
f7e3447
+ 	crypt_check_current_method();
f7e3447
  	(void)crypt_get_key(TRUE, TRUE);
f7e3447
  	TIME_MSG("getting crypt key");
f7e3447
      }
f7e3447
*** ../vim-7.4.508/src/proto/crypt.pro	2014-08-10 13:34:59.060785459 +0200
f7e3447
--- src/proto/crypt.pro	2014-11-12 15:06:51.349363319 +0100
f7e3447
***************
f7e3447
*** 19,24 ****
f7e3447
--- 19,26 ----
f7e3447
  void crypt_encode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len));
f7e3447
  void crypt_decode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len));
f7e3447
  void crypt_free_key __ARGS((char_u *key));
f7e3447
+ void crypt_check_method __ARGS((int method));
f7e3447
+ void crypt_check_current_method __ARGS((void));
f7e3447
  char_u *crypt_get_key __ARGS((int store, int twice));
f7e3447
  void crypt_append_msg __ARGS((buf_T *buf));
f7e3447
  /* vim: set ft=c : */
f7e3447
*** ../vim-7.4.508/src/version.c	2014-11-12 13:07:48.774069557 +0100
f7e3447
--- src/version.c	2014-11-12 14:45:09.979391243 +0100
f7e3447
***************
f7e3447
*** 743,744 ****
f7e3447
--- 743,746 ----
f7e3447
  {   /* Add new patch number below this line */
f7e3447
+ /**/
f7e3447
+     509,
f7e3447
  /**/
f7e3447
f7e3447
-- 
f7e3447
Q: How do you tell the difference between a female cat and a male cat?
f7e3447
A: You ask it a question and if HE answers, it's a male but, if SHE
f7e3447
   answers, it's a female.
f7e3447
f7e3447
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
f7e3447
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
f7e3447
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
f7e3447
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///