MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 2 | string valid_write(string path, string uid, string func, object ob) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
| 4 | DESCRIPTION |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 5 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 11 | |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 12 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 17 | |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 18 | Func denotes the efun call or other operation that caused |
| 19 | valid_write() to be called: |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 20 | |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 21 | 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 | |
| 45 | HISTORY |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 50 | |
| 51 | SEE ALSO |
Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 52 | valid_read(M), make_path_absolute(M) |