ID: 40760 Updated by: [EMAIL PROTECTED] Reported By: secker at careviewcom dot com -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Debian 'Etch', kern 2.6.17-2-486 PHP Version: 5.2.1 New Comment:
>$sh = shm_attach($f); http://php.net/shm_attach "..and the optional perm-bits perm (default: 0666)..." >I would guess this is maybe because shm_attach can't open a segment >as read-only, and always tried to open it as rw? Exactly. That's because by default it tries to open it in 0666 mode. Specify 0644 and voila.. Previous Comments: ------------------------------------------------------------------------ [2007-03-08 17:41:31] secker at careviewcom dot com Description: ------------ If I create a Shared memory segment using shm_attach with one user, and set it as readable by all users, but only writable by the owner, then other users cannot open the segment via shm_attach, they get permission denied errors. I would guess this is maybe because shm_attach can't open a segment as read-only, and always tried to open it as rw? Reproduce code: --------------- run as someuser1: <?php $f = ftok('somefile', 'I'); $sh = shm_attach($f, 1024000, 0644); ?> works if its not already created by another user... run as someuser2: <?php $f = ftok('somefile', 'I'); $sh = shm_attach($f); ?> Expected result: ---------------- what I would expect is that since I created it as 0644, other users should be able to access it via read-only mode (which I can do if I open it using shmop_open with the read-only flag instead). Actual result: -------------- second user gets "Permission Denied" php warning messages. once again, I think this is mearly a result of shm_attach not actually ever opening an shm as read-only, always read-write... but I might be mistaken. Thanks. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40760&edit=1