jkunstle / rpms / vim

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