#23069 [Com]: [critical] tempnam creates readonly file

From: Date: Mon, 27 Sep 2004 09:47:05 +0000
Subject: #23069 [Com]: [critical] tempnam creates readonly file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-66753@lists.php.net to get a copy of this message
ID: 23069 Comment by: jorisvanmontfort at chello dot nl Reported By: paj at pearfr dot org Status: Closed Bug Type: CGI related Operating System: Windows 2000 PHP Version: 4CVS-2003-04-06 (stable) New Comment: Running php 4.3.9 on as CGI on IIS 5 for windows 2000 I get a read only tempfile. It seemed to work wel in version 4.3.7. What's wrong? Previous Comments: ------------------------------------------------------------------------ [2003-04-11 06:12:32] wez@php.net This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2003-04-11 04:09:45] wez@php.net Can you try this patch? untested, but should work... Index: main/php_open_temporary_file.c =================================================================== RCS file: /repository/php4/main/php_open_temporary_file.c,v retrieving revision 1.25 diff -u -p -r1.25 php_open_temporary_file.c --- main/php_open_temporary_file.c 18 Mar 2003 16:40:29 -0000 1.25 +++ main/php_open_temporary_file.c 11 Apr 2003 09:09:15 -0000 @@ -132,7 +132,8 @@ static int php_do_open_temporary_file(co #ifdef PHP_WIN32 if (GetTempFileName(path, pfx, 0, opened_path)) { - fd = VCWD_OPEN(opened_path, open_flags); + VCWD_CHMOD(opened_path, 0600); + fd = VCWD_OPEN_MODE(opened_path, open_flags, 0600); } #elif defined(NETWARE) /* Using standard mktemp() implementation for NetWare */ ------------------------------------------------------------------------ [2003-04-08 02:28:44] pajoye@php.net It is critical in general too, not only for PEAR, afaik, this is the only way to get a safe temp name and seems to be widely used. I cannot reproduce it with the stable snapshot from 03/4/4 on w2K CLI. hth pierre ------------------------------------------------------------------------ [2003-04-07 16:14:50] edink@php.net Just forgot to mention that I have reproduced this using latest win32 cli. ------------------------------------------------------------------------ [2003-04-07 16:13:00] edink@php.net Marking this critical as it prevents much anticipated pear on windows release. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/23069 -- Edit this bug report at http://bugs.php.net/?id=23069&edit=1

« previous php.bugs (#66753) next »