Patch 8.0.1287
Problem:    The temp file used when updating the viminfo file may have the
            wrong permissions if setting the group fails.
Solution:   Check if the group matches and reduce permissions if not.
Files:      src/ex_cmds.c


*** ../vim-8.0.1286/src/ex_cmds.c       2017-10-24 22:32:56.205116305 +0200
--- src/ex_cmds.c       2017-11-11 16:19:06.469683366 +0100
***************
*** 2007,2013 ****
  
            /*
             * If we can't create in the same directory, try creating a
!            * "normal" temp file.
             */
            if (fp_out == NULL)
            {
--- 2007,2014 ----
  
            /*
             * If we can't create in the same directory, try creating a
!            * "normal" temp file.  This is just an attempt, renaming the temp
!            * file might fail as well.
             */
            if (fp_out == NULL)
            {
***************
*** 2018,2028 ****
  
  #if defined(UNIX) && defined(HAVE_FCHOWN)
            /*
!            * Make sure the owner can read/write it.  This only works for
!            * root.
             */
            if (fp_out != NULL)
!               ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
  #endif
        }
      }
--- 2019,2047 ----
  
  #if defined(UNIX) && defined(HAVE_FCHOWN)
            /*
!            * Make sure the original owner can read/write the tempfile and
!            * otherwise preserve permissions, making sure the group matches.
             */
            if (fp_out != NULL)
!           {
!               stat_T  tmp_st;
! 
!               if (mch_stat((char *)tempname, &tmp_st) >= 0)
!               {
!                   if (st_old.st_uid != tmp_st.st_uid)
!                       /* Changing the owner might fail, in which case the
!                        * file will now owned by the current user, oh well. */
!                       ignored = fchown(fileno(fp_out), st_old.st_uid, -1);
!                   if (st_old.st_gid != tmp_st.st_gid
!                           && fchown(fileno(fp_out), -1, st_old.st_gid) == -1)
!                       /* can't set the group to what it should be, remove
!                        * group permissions */
!                       (void)mch_setperm(tempname, 0600);
!               }
!               else
!                   /* can't stat the file, set conservative permissions */
!                   (void)mch_setperm(tempname, 0600);
!           }
  #endif
        }
      }
***************
*** 7536,7542 ****
      int               idx;
      sign_T    *sp;
      sign_T    *sp_prev;
!     buf_T     *buf;
  
      /* Parse the subcommand. */
      p = skiptowhite(arg);
--- 7555,7561 ----
      int               idx;
      sign_T    *sp;
      sign_T    *sp_prev;
!     buf_T     *buf = NULL;
  
      /* Parse the subcommand. */
      p = skiptowhite(arg);
*** ../vim-8.0.1286/src/version.c       2017-11-11 15:53:56.520172366 +0100
--- src/version.c       2017-11-11 16:44:08.143299609 +0100
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1287,
  /**/

-- 
"The future's already arrived - it's just not evenly distributed yet."
                -- William Gibson

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui