[exim-cvs] cvs commit: exim/exim-src/src exim.c

Pàgina inicial
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
A: exim-cvs
Assumpte: [exim-cvs] cvs commit: exim/exim-src/src exim.c
ph10 2006/02/23 10:25:01 GMT

  Modified files:
    exim-src/src         exim.c 
  Log:
  Restore old umask in modefopen() rather than forcing zero.


  Revision  Changes    Path
  1.36      +5 -6      exim/exim-src/src/exim.c


  Index: exim.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/exim.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- exim.c    22 Feb 2006 14:46:44 -0000    1.35
  +++ exim.c    23 Feb 2006 10:25:01 -0000    1.36
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/exim.c,v 1.35 2006/02/22 14:46:44 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/exim.c,v 1.36 2006/02/23 10:25:01 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -397,10 +397,9 @@
   FILE *
   modefopen(uschar *filename, char *options, mode_t mode)
   {
  -FILE *f;
  -umask(0777);
  -f = Ufopen(filename, options);
  -umask(0);
  +mode_t saved_umask = umask(0777);
  +FILE *f = Ufopen(filename, options);
  +(void)umask(saved_umask);
   if (f != NULL) (void)fchmod(fileno(f), mode);
   return f;
   }
  @@ -1473,7 +1472,7 @@
   message_id = message_id_external + 1;
   message_id[0] = 0;


-/* Set the umask to zero so that any files that Exim creates using open() are
+/* Set the umask to zero so that any files Exim creates using open() are
created with the modes that it specifies. NOTE: Files created with fopen() have
a problem, which was not recognized till rather late (February 2006). With this
umask, such files will be world writeable. (They are all content scanning files
@@ -1483,7 +1482,7 @@
now a function called modefopen() that fiddles with the umask while calling
fopen(). */

-umask(0);
+(void)umask(0);

/* Precompile the regular expression for matching a message id. Keep this in
step with the code that generates ids in the accept.c module. We need to do