Mstdlib-1.24.0
|
M_fs_perms_t * M_fs_perms_create | ( | void | ) |
Create a perms object.
M_fs_perms_t * M_fs_perms_dup | ( | const M_fs_perms_t * | perms | ) |
Duplicate a perms object.
[in] | perms | The perms object to duplicate. |
void M_fs_perms_merge | ( | M_fs_perms_t ** | dest, |
M_fs_perms_t * | src | ||
) |
Merge two perms objects together.
The second (src) perms will be destroyed automatically upon completion of this function.
This is intended for dest to hold exact permissions. In this case, when src is exact then src will replace the permissions in dest. If src is an add or remove it will modify dest accordingly.
When the perms in dest are not set then the permissions from src will be used.
When dest is a modifier (add or remove) then the permissions from src will replace the permission in dest. This happens regardless of the permissions in src being exact or a modifier.
When the permissions in src are not set then dest will not be modified.
[in,out] | dest | Pointer by reference to the perms receiving the values. if this is NULL, the pointer will simply be switched out for src. |
[in,out] | src | Pointer to the perms giving up its values. |
void M_fs_perms_destroy | ( | M_fs_perms_t * | perms | ) |
Destroy a perms object.
[in] | perms | The perms. |
M_fs_error_t M_fs_perms_can_access | ( | const char * | path, |
M_uint32 | mode | ||
) |
Can the process access the path with the given perms.
This function should not be used to make access control decisions due to Time-of-check Time-of-use (TOCTOU) race condition attacks.
[in] | path | The path to access. |
[in] | mode | M_fs_perms_mode_t permissions to be checked. Optional, pass 0 if only checking if the path exists. |
M_fs_error_t M_fs_perms_set_perms | ( | const M_fs_perms_t * | perms, |
const char * | path | ||
) |
Apply perms to a path.
This will set/change/modify the perms on a path.
[in] | perms | The perms. |
[in] | path | The path. |
M_fs_error_t M_fs_perms_set_perms_file | ( | const M_fs_perms_t * | perms, |
M_fs_file_t * | fd | ||
) |
Apply perms to open file.
This will set/change/modify the perms on a file.
[in] | perms | The perms. |
[in] | fd | The file. |
const char * M_fs_perms_get_user | ( | const M_fs_perms_t * | perms | ) |
Get the user associated with the perms.
[in] | perms | The perms. |
const char * M_fs_perms_get_group | ( | const M_fs_perms_t * | perms | ) |
Get the group associated with the perms.
[in] | perms | The perms. |
M_uint32 M_fs_perms_get_mode | ( | const M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Get the mode associated with the perms for the given permission.
[in] | perms | The perms. |
[in] | who | The permissions this applies to. |
M_fs_perms_type_t M_fs_perms_get_type | ( | const M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Get the type (exact/add/remove) associated with the perms for the given permission.
[in] | perms | The perms. |
[in] | who | The permissions this applies to. |
M_bool M_fs_perms_get_isset | ( | const M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Check if a given permission is set.
If not set the permission will be ignored during merge, set and other operation that use the permissions.
[in] | perms | The perms. |
[in] | who | The permissions this applies to. |
M_uint32 M_fs_perms_get_dir_mode | ( | const M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Get the directory override mode associated with the perms for the given permission.
[in] | perms | The perms. |
[in] | who | The permissions this applies to. |
M_fs_perms_type_t M_fs_perms_get_dir_type | ( | const M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Get the directory override type (exact/add/remove) associated with the perms for the given permission.
[in] | perms | The perms. |
[in] | who | The permissions this applies to. |
M_bool M_fs_perms_get_dir_isset | ( | const M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Check if a given directory override permission is set.
If not set the permission will be ignored during merge, set and other operation that use the permissions.
[in] | perms | The perms. |
[in] | who | The permissions this applies to. |
M_fs_error_t M_fs_perms_set_user | ( | M_fs_perms_t * | perms, |
const char * | user | ||
) |
Set the user.
[in] | perms | The perms. |
[in] | user | The user. |
M_fs_error_t M_fs_perms_set_group | ( | M_fs_perms_t * | perms, |
const char * | group | ||
) |
Set the group.
[in] | perms | The perms. |
[in] | group | The group. |
void M_fs_perms_set_mode | ( | M_fs_perms_t * | perms, |
M_uint32 | mode, | ||
M_fs_perms_who_t | who, | ||
M_fs_perms_type_t | type | ||
) |
Set the mode for the perms.
[in] | perms | The perms. |
[in] | mode | M_fs_file_mode_t modes. |
[in] | who | Who this applies to. |
[in] | type | The type permissions being set. |
void M_fs_perms_set_dir_mode | ( | M_fs_perms_t * | perms, |
M_uint32 | mode, | ||
M_fs_perms_who_t | who, | ||
M_fs_perms_type_t | type | ||
) |
Set the directory override mode for the perms.
[in] | perms | The perms. |
[in] | mode | M_fs_file_mode_t modes. |
[in] | who | Who this applies to. |
[in] | type | The type permissions being set. |
void M_fs_perms_unset_mode | ( | M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Unset permissions.
This is different than setting no permissions.
This will also unset the equivalent directory override permissions.
[in] | perms | The perms. |
[in] | who | Who this applies to. |
void M_fs_perms_unset_dir_mode | ( | M_fs_perms_t * | perms, |
M_fs_perms_who_t | who | ||
) |
Unset directory override permissions.
This is different than setting no permissions.
[in] | perms | The perms. |
[in] | who | Who this applies to. |