int
puffs_cred_getuid(
const struct puffs_cred *pcr
, uid_t *uid
)
int
puffs_cred_getgid(
const struct puffs_cred *pcr
, gid_t *gid
)
int
puffs_cred_getgroups(
const struct puffs_cred *pcr
gid_t *gids
short *ngids
)
bool
puffs_cred_isuid(const struct puffs_cred *pcr
, uid_t uid
)
bool
puffs_cred_hasgroup(const struct puffs_cred *pcr
, gid_t gid
)
bool
puffs_cred_iskernel(const struct puffs_cred *pcr
)
bool
puffs_cred_isfs(const struct puffs_cred *pcr
)
bool
puffs_cred_isjuggernaut(const struct puffs_cred *pcr
)
int
puffs_access(
enum vtype type
mode_t file_mode
uid_t owner
gid_t group
mode_t access_mode
const struct puffs_cred *pcr
)
int
puffs_access_chown(
uid_t owner
gid_t group
uid_t newowner
gid_t newgroup
const struct puffs_cred *pcr
)
int
puffs_access_chmod(
uid_t owner
gid_t group
enum vtype type
mode_t newmode
const struct puffs_cred *pcr
)
int
puffs_access_times(
uid_t owner
gid_t group
mode_t file_mode
int va_utimes_null
const struct puffs_cred *pcr
)
)
family of functions fetch the uid or gid(s) from the given credential
cookie.
They return 0 for success or -1 for an error and set
errno.
An error happens when the credentials represent kernel or file system
credentials and do not contain an uid or gid(s).
For
puffs_cred_getgroups(),
the argument
gids
should point to an array with room for
*ngids
elements.
The
puffs_cred_is()
family of functions return 1 if the truth value of the function for
pcr
is true and 0 if it is false.
The function
puffs_cred_isjuggernaut()
is true if
pcr
describes superuser, kernel or file system credentials.
puffs_access()
is equivalent to the kernel
vaccess(
)
function.
The arguments specify current information of the file to be
tested with the exception of
access_mode
,
which is a combination of
PUFFS_VREAD
,
PUFFS_VWRITE
and
PUFFS_VEXEC
indicating the desired file access mode.
The rest of the functions provide UFS semantics for operations.
puffs_access_chown()
checks if it is permissible to chown a file with the current uid
and gid to the new uid and gid with the credentials of
pcr
.
puffs_access_chmod()
checks against permission to chmod a file of type
type
to the mode
newmode
.
Finally,
puffs_access_times()
checks if it is allowable to update the timestamps of a file.
The argument
va_utimes_null
signals if the flags
VA_UTIMES_NULL
was set in
va_vaflags
of
struct vattr.
If coming from a path where this information is unavailable, passing
0 as this argument restricts the permission of modification to the
owner and superuser.
Otherwise the function checks for write permissions to the node and
returns success if the caller has write permissions.