filetest - Perl pragma to control the filetest permission operators
$can_perhaps_read = -r "file"; # use the mode bits { use filetest 'access'; # intuit harder $can_really_read = -r "file"; } $can_perhaps_read = -r "file"; # use the mode bits again
The default behaviour is to use the mode bits as returned by the stat() family of calls. This, however, may not be the right thing to do if for example various ACL (access control lists) schemes are in use. For such environments, "use filetest" may help the permission operators to return results more consistent with other tools.
Each ``use filetest'' or ``no filetest'' affects statements to the end of the enclosing block.
There may be a slight performance decrease in the filetests when "use filetest" is in effect, because in some systems the extended functionality needs to be emulated.
NOTE: using the file tests for security purposes is a lost cause from the start: there is a window open for race conditions (who is to say that the permissions will not change between the test and the real operation?). Therefore if you are serious about security, just try the real operation and test for its success - think in terms of atomic operations.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |