libexplain  1.4.D001
Functions
libexplain/have_permission.c File Reference
#include <libexplain/ac/sys/param.h>
#include <libexplain/ac/sys/stat.h>
#include <libexplain/ac/unistd.h>
#include <libexplain/buffer/dac.h>
#include <libexplain/buffer/file_type.h>
#include <libexplain/buffer/gettext.h>
#include <libexplain/buffer/gid.h>
#include <libexplain/buffer/group_permission_ignored.h>
#include <libexplain/buffer/others_permission_ignored.h>
#include <libexplain/buffer/others_permission.h>
#include <libexplain/buffer/rwx.h>
#include <libexplain/buffer/uid.h>
#include <libexplain/capability.h>
#include <libexplain/gettext.h>
#include <libexplain/group_in_groups.h>
#include <libexplain/have_permission.h>
#include <libexplain/option.h>
#include <libexplain/translate.h>

Go to the source code of this file.

Functions

static int explain_have_permission (const struct stat *st, const explain_have_identity_t *hip, int wanted)
static void owner_permission_mode_used (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip)
static void owner_permission_mode_ignored (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip)
static void group_permission_mode_used (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip)
static int explain_explain_permission (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip, int wanted)
int explain_have_read_permission (const struct stat *st, const explain_have_identity_t *hip)
int explain_explain_read_permission (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip)
int explain_have_write_permission (const struct stat *st, const explain_have_identity_t *hip)
int explain_explain_write_permission (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip)
int explain_have_execute_permission (const struct stat *st, const explain_have_identity_t *hip)
int explain_explain_execute_permission (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip)
int explain_have_search_permission (const struct stat *st, const explain_have_identity_t *hip)
int explain_explain_search_permission (explain_string_buffer_t *sb, const struct stat *st, const explain_have_identity_t *hip)
int explain_have_inode_permission (const struct stat *st, const explain_have_identity_t *hip)
const char * explain_have_identity_kind_of_uid (const explain_have_identity_t *hip)
const char * explain_have_identity_kind_of_gid (const explain_have_identity_t *hip)
void explain_have_identity_init (explain_have_identity_t *hip)

Function Documentation

int explain_explain_execute_permission ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_explain_execute_permission function may be used to explain why the current process (does not) have execute permissions on an inode.

Parameters:
sbThe string buffer to print into.
stThe stat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 374 of file have_permission.c.

static int explain_explain_permission ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip,
int  wanted 
) [static]

Definition at line 226 of file have_permission.c.

int explain_explain_read_permission ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_explain_read_permission function may be used to explain why the current process (does not) have read permissions on an inode.

Parameters:
sbThe string buffer to print into.
stThe stat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 315 of file have_permission.c.

int explain_explain_search_permission ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_explain_search_permission function may be used to explain why the current process (does not) have search permissions on an inode.

Parameters:
sbThe string buffer to print into.
stThe stat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 410 of file have_permission.c.

int explain_explain_write_permission ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_explain_write_permission function may be used to explain why the current process (does not) have write permissions on an inode.

Parameters:
sbThe string buffer to print into.
stThe stat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 340 of file have_permission.c.

int explain_have_execute_permission ( const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_have_execute_permission function may be used to test whether or not the current process has execute permissions on an inode.

Parameters:
ststat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 355 of file have_permission.c.

The explain_have_identity_init function may be used to initialise an ID to the process effective ID.

Parameters:
idThe identity to be initialised.

Definition at line 465 of file have_permission.c.

The explain_have_identity_kind_of_gid is used to obtain a string describing the kind of GID in the identity.

Parameters:
hipThe identity of interest
Returns:
One of "real GID" or "effective GID", suitably translated.

Definition at line 451 of file have_permission.c.

The explain_have_identity_kind_of_uid is used to obtain a string describing the kind of UID in the identity.

Parameters:
hipThe identity of interest
Returns:
One of "real UID" or "effective UID", suitably translated.

Definition at line 437 of file have_permission.c.

int explain_have_inode_permission ( const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_have_inode_permission function may be used to test whether or not the current process has inode changing permissions (utimes, chmod, etc) to an inode.

Parameters:
ststat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 427 of file have_permission.c.

static int explain_have_permission ( const struct stat *  st,
const explain_have_identity_t hip,
int  wanted 
) [static]

Definition at line 42 of file have_permission.c.

int explain_have_read_permission ( const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_have_read_permission function may be used to test whether or not the current process has read permissions on an inode.

Parameters:
ststat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 305 of file have_permission.c.

int explain_have_search_permission ( const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_have_search_permission function may be used to test whether or not the current process has search permissions on an inode.

Parameters:
ststat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 398 of file have_permission.c.

int explain_have_write_permission ( const struct stat *  st,
const explain_have_identity_t hip 
)

The explain_have_write_permission function may be used to test whether or not the current process has write permissions on an inode.

Parameters:
ststat structure containing information about the file.
hipThe user/process identity to check against.
Returns:
int; nonzero(true) if have permission, zero (false) if not.

Definition at line 330 of file have_permission.c.

static void group_permission_mode_used ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip 
) [static]

Definition at line 175 of file have_permission.c.

static void owner_permission_mode_ignored ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip 
) [static]

Definition at line 124 of file have_permission.c.

static void owner_permission_mode_used ( explain_string_buffer_t sb,
const struct stat *  st,
const explain_have_identity_t hip 
) [static]

Definition at line 73 of file have_permission.c.