blob: 3f73ca369bd496a84e08f4c65c7c381ab0d26c89 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra7ea4a032019-11-26 20:11:40 +01002 string valid_write(string path, string uid, string func, object ob)
MG Mud User88f12472016-06-24 23:31:02 +02003
4DESCRIPTION
Zesstra7ea4a032019-11-26 20:11:40 +01005 This function is called to check if the object ob with the
6 user-id uid has write permissions to the file given by path
7 for the operation named by func. It should return 0 if
8 permission is denied, or the normalized path if permission is
9 granted. You can also return 1 to indicate that the path can
10 be used unchanged.
MG Mud User88f12472016-06-24 23:31:02 +020011
Zesstra7ea4a032019-11-26 20:11:40 +010012 The returned pathname must not contain "..", a leading /
13 will be stripped by the interpreter. By default, the returned
14 path must also not contain space characters; if the driver
15 is instructed to allow them, the preprocessor macro
16 __FILENAME_SPACES__ is defined.
MG Mud User88f12472016-06-24 23:31:02 +020017
Zesstra7ea4a032019-11-26 20:11:40 +010018 Func denotes the efun call or other operation that caused
19 valid_write() to be called:
MG Mud User88f12472016-06-24 23:31:02 +020020
Zesstra7ea4a032019-11-26 20:11:40 +010021 copy_file : for the target file or directory name
22 rename_from : efun rename(), for the original name
23 rename_to : efun rename(), for the new name
24 ed_start : whenever the builtin ed tries to write to a file
25 garbage_collection
26 mkdir
27 memdump
28 objdump
29 opcdump
30 remove_file : efun rm()
31 rmdir
32 save_object
33 write_bytes
34 write_file
35
36 For save_object(), the <path> passed is the filename as given
37 in the efun call. If for this efun a filename ending in ".c" is
38 returned, the ".c" will be stripped from the filename.
39
40 This function is called in compat mode as well. If
41 you need to be compatible with the old 2.4.5-mudlib, redirect
42 these calls to the valid_read/valid_write in the user
43 object.
44
45HISTORY
46 LDMud 3.2.8 adds operation "copy_file", and replaces "do_rename"
47 by "rename_from" and "rename_to".
48 LDMud 3.2.9 adds operation "garbage_collection".
49 LDMud 3.3.526 adds operation "memdump".
MG Mud User88f12472016-06-24 23:31:02 +020050
51SEE ALSO
Zesstra7ea4a032019-11-26 20:11:40 +010052 valid_read(M), make_path_absolute(M)