filestat patch : convert to access().
| From: | Flavien Lebarbé | Date: | Sat, 18 Mar 2000 02:20:30 +0000 |
| Subject: | filestat patch : convert to access(). | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-16972@lists.php.net to get a copy of this message | ||
Hello,
Attached is the proposed patch to convert to access().
While testing, I discovered that access() always returns
success if getuid()=root. So, I had to add a check based
on the permissions just for this case. :-(
Benefits of this patch :
1) Don't mess anymore with getgroups, scanning all groups
and bit-mask-check if an operation (read, write, execute)
is authorized. Decrease code complexity a lot.
2) Get some more abstraction on the function level :
#define php_access access if we're not PHP_WIN32
// Needs some work from windows gurus, see below.
3) Determine rights using access(), so it's much less
user/group/other dependant.
4) If the system supports ACLs and access() checks
them, it should work.
Drawback : Calls access() three times.
WIN32 guys : Everything is ready to check permissions in
the Windows way, you don't have to emulate bitmasks or
any unix-likies anymore, the only function you need to
#define is php_access(const char *filename,READ|WRITE|EXECUTE).
Hartmut, if you think this patch is ok, could you please
commit it to cvs. I might ask for cvs access in the
future but I don't have one at the moment.
Flavien Lebarbé
---
Open Care