3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.024
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.024
3ef2ca
Problem:    When root edits a file the undo file is owned by root while the
3ef2ca
	    edited file may be owned by another user, which is not allowed.
3ef2ca
	    (cac2s)
3ef2ca
Solution:   Accept an undo file owned by the current user.
3ef2ca
Files:	    src/undo.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.023/src/undo.c	2013-06-10 20:13:37.000000000 +0200
3ef2ca
--- src/undo.c	2013-09-07 15:45:56.000000000 +0200
3ef2ca
***************
3ef2ca
*** 1604,1613 ****
3ef2ca
  
3ef2ca
  #ifdef UNIX
3ef2ca
  	/* For safety we only read an undo file if the owner is equal to the
3ef2ca
! 	 * owner of the text file. */
3ef2ca
  	if (mch_stat((char *)orig_name, &st_orig) >= 0
3ef2ca
  		&& mch_stat((char *)file_name, &st_undo) >= 0
3ef2ca
! 		&& st_orig.st_uid != st_undo.st_uid)
3ef2ca
  	{
3ef2ca
  	    if (p_verbose > 0)
3ef2ca
  	    {
3ef2ca
--- 1604,1614 ----
3ef2ca
  
3ef2ca
  #ifdef UNIX
3ef2ca
  	/* For safety we only read an undo file if the owner is equal to the
3ef2ca
! 	 * owner of the text file or equal to the current user. */
3ef2ca
  	if (mch_stat((char *)orig_name, &st_orig) >= 0
3ef2ca
  		&& mch_stat((char *)file_name, &st_undo) >= 0
3ef2ca
! 		&& st_orig.st_uid != st_undo.st_uid
3ef2ca
! 		&& st_undo.st_uid != getuid())
3ef2ca
  	{
3ef2ca
  	    if (p_verbose > 0)
3ef2ca
  	    {
3ef2ca
*** ../vim-7.4.023/src/version.c	2013-09-07 16:35:38.000000000 +0200
3ef2ca
--- src/version.c	2013-09-08 15:38:52.000000000 +0200
3ef2ca
***************
3ef2ca
*** 740,741 ****
3ef2ca
--- 740,743 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     24,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
hundred-and-one symptoms of being an internet addict:
3ef2ca
186. You overstay in the office so you can have more time surfing the net.
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    ///