1fa1ff
To: vim_dev@googlegroups.com
1fa1ff
Subject: Patch 7.4.024
1fa1ff
Fcc: outbox
1fa1ff
From: Bram Moolenaar <Bram@moolenaar.net>
1fa1ff
Mime-Version: 1.0
1fa1ff
Content-Type: text/plain; charset=UTF-8
1fa1ff
Content-Transfer-Encoding: 8bit
1fa1ff
------------
1fa1ff
1fa1ff
Patch 7.4.024
1fa1ff
Problem:    When root edits a file the undo file is owned by root while the
1fa1ff
	    edited file may be owned by another user, which is not allowed.
1fa1ff
	    (cac2s)
1fa1ff
Solution:   Accept an undo file owned by the current user.
1fa1ff
Files:	    src/undo.c
1fa1ff
1fa1ff
1fa1ff
*** ../vim-7.4.023/src/undo.c	2013-06-10 20:13:37.000000000 +0200
1fa1ff
--- src/undo.c	2013-09-07 15:45:56.000000000 +0200
1fa1ff
***************
1fa1ff
*** 1604,1613 ****
1fa1ff
  
1fa1ff
  #ifdef UNIX
1fa1ff
  	/* For safety we only read an undo file if the owner is equal to the
1fa1ff
! 	 * owner of the text file. */
1fa1ff
  	if (mch_stat((char *)orig_name, &st_orig) >= 0
1fa1ff
  		&& mch_stat((char *)file_name, &st_undo) >= 0
1fa1ff
! 		&& st_orig.st_uid != st_undo.st_uid)
1fa1ff
  	{
1fa1ff
  	    if (p_verbose > 0)
1fa1ff
  	    {
1fa1ff
--- 1604,1614 ----
1fa1ff
  
1fa1ff
  #ifdef UNIX
1fa1ff
  	/* For safety we only read an undo file if the owner is equal to the
1fa1ff
! 	 * owner of the text file or equal to the current user. */
1fa1ff
  	if (mch_stat((char *)orig_name, &st_orig) >= 0
1fa1ff
  		&& mch_stat((char *)file_name, &st_undo) >= 0
1fa1ff
! 		&& st_orig.st_uid != st_undo.st_uid
1fa1ff
! 		&& st_undo.st_uid != getuid())
1fa1ff
  	{
1fa1ff
  	    if (p_verbose > 0)
1fa1ff
  	    {
1fa1ff
*** ../vim-7.4.023/src/version.c	2013-09-07 16:35:38.000000000 +0200
1fa1ff
--- src/version.c	2013-09-08 15:38:52.000000000 +0200
1fa1ff
***************
1fa1ff
*** 740,741 ****
1fa1ff
--- 740,743 ----
1fa1ff
  {   /* Add new patch number below this line */
1fa1ff
+ /**/
1fa1ff
+     24,
1fa1ff
  /**/
1fa1ff
1fa1ff
-- 
1fa1ff
hundred-and-one symptoms of being an internet addict:
1fa1ff
186. You overstay in the office so you can have more time surfing the net.
1fa1ff
1fa1ff
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
1fa1ff
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
1fa1ff
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
1fa1ff
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///