Method Pike.Security.User()->valid_open()
- Method valid_open
int(2bit)|stringvalid_open(stringtype,objectcurrent,stringfilename,stringflags,intaccess)- Description
This callback gets called when a new file is to be opened (and the Creds object has BIT_CONDITIONAL_IO set).
- Parameter
type The type of file operation requested. Can either be
"read"or"write".- Parameter
current The current object, i.e. the Fd object the user is trying to open.
- Parameter
filename The file name requested.
- Parameter
flags The flag string passed to open, e.g.
"cwt".- Parameter
access The access flags requested for the file, e.g.
0666.- Returns
The function can either return a string, which means that the user is allowed to open a file, but the returned file should be opened instead, or it can return an integer. The integers are intepreted as follows.
0The user was not allowed to open the file. ERRNO will be set to EPERM and an exception is thrown.
1Do nothing, i.e. valid_open has initilized the
currentobject with an open file. This can (natuarally) only be returned if acurrentobject was given, which is not always the case.2The user was allowed to open the file and the open code proceeds.
3The user was not allowed to open the file and an exception is thrown.