Date: 06/01/01
- Next message: Ignatius Teo: "Re: [phplib] Microsoft..."
- Previous message: Jens Benecke: "Re: [phplib] Microsoft..."
- Next in thread: Steve Edberg: "Re: [phplib] tempnam() function problem (resolved)"
- Reply: Steve Edberg: "Re: [phplib] tempnam() function problem (resolved)"
- Reply: Rowel I. Lirag: "[phplib] problem..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi -
Sorry this is non-PHPLIB related, but since the PHP list has been
down for the last week, this is the most relevant list I can think
of...
I recently upgraded from Apache 1.3.12/PHP 3.0.16 to Apache
1.3.20/PHP 4.0.5 (on Solaris 2.6: uname -a says 'SunOS pgfsun 5.6
Generic_105181-26 sun4u sparc SUNW,Ultra-1'), and tempnam()
functionality seems to have been broken in the following snippet:
$TempFileAce = tempnam('', 'aceld');
$TempFileCmd = tempnam('', 'aceld');
if ($hTempAce = <email protected>($TempFileAce, 'w+')) {
# snipped code
} else {
clean_up_and_end(1, 'Unable to open temporary .ace file.');
}
if ($hTempCmd = <email protected>($TempFileCmd, 'w+')) {
# snipped code
} else {
clean_up_and_end(1, 'Unable to open temporary tace command file.');
}
This code was working fine in the original PHP3 configuration, but
now two problems occur:
(1) With the first parameter of tempnam() blank, filenames would be
created with the default temp directory path, eg:
/var/tmp/aceldMkOaaay
Now, it attempts to create files named like
/var/tmp//aceldMkOaaay
(2) Permissions on the created files are more restrictive.
Originally, files would be created with the user/group of Apache
(d-www/nobody) and user d-www's umask (umask says 022 - that is,
u=rwx,g=r-x,o=r-x). Now, the permissions on the created files are set
to u=rw-,g=---,o=---.
Problem (1) can be circumvented via an explicit first parameter:
$TempFileAce = tempnam('/var/tmp', 'aceld');
but problem (2) remains a problem. I subsequently call sudo via
passthru() to run a program as another user (using $TempFileAce and
$TempFileCmd as input), and the temp files are no longer readable as
that other user!
I RTFM'ed
http://www.php.net/manual/en/function.tempnam.php
but the changes in tempnam() between PHP3 & PHP4 (creating the file
as well as creating the file name, using mkstemp() system function
instead of tempnam() where possible) don't seem relevant here. Doing
man tempnam and man mkstemp didn't shed any light on this either.
Am I missing something? Is there a workaround? Should I file a bug report?
Again, apologies for posting here...but without an operating PHP
list, I'm lost :^O
-steve
-- +--- So long, and thanks for all the fish - -----------------------------+ | Steve Edberg University of California, Davis | | sbedberg <email protected> Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +----------------------------------- Douglas Adams 1952 - 11 may 2001 ---+--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Ignatius Teo: "Re: [phplib] Microsoft..."
- Previous message: Jens Benecke: "Re: [phplib] Microsoft..."
- Next in thread: Steve Edberg: "Re: [phplib] tempnam() function problem (resolved)"
- Reply: Steve Edberg: "Re: [phplib] tempnam() function problem (resolved)"
- Reply: Rowel I. Lirag: "[phplib] problem..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

