From: Samuel Tardieu <sam@rfc1149.net>
Subject: Bug#300175: Patch for clamav/clamsmtp
Date: Mon, 21 Mar 2005 11:07:48 +0100
To: 300175@bugs.debian.org
Cc: erwan@rail.eu.org
Reply-To: sam@rfc1149.net

On recent glibc, files created with mkstemp() are created with mode
0600. If the mode is not changed, there is no way for another user to
read the temporary file, regardless of the users' respective groups.

This patch allows users in the same group to read the temporary files.
This should solve Erwan's problem, and certainly has solved mine:

Sam

PS/ older glibc used to create the file in 0666 mode, which may explain
    why not everyone has this problem

Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/sam

--- clamsmtp/common/smtppass.c.old	2005-01-27 01:22:56.000000000 +0100
+++ clamsmtp/common/smtppass.c	2005-03-21 10:58:38.000000000 +0100
@@ -1270,6 +1270,7 @@
             return -1;
         }
 
+        fchmod(tfd, 0640);
         fcntl(tfd, F_SETFD, fcntl(tfd, F_GETFD, 0) | FD_CLOEXEC);    
         sp_messagex(ctx, LOG_DEBUG, "created cache file: %s", ctx->cachename);
     }

