NAME
privileges: priv_addset(), priv_delset(), priv_ismember(), priv_isobserved(), privset_add(), privset_alloc(), privset_copy(), privset_del(), privset_empty(), privset_fill(), privset_free(), privset_intersect(), privset_inverse(), privset_isempty(), privset_isequal(), privset_isfull(), privset_ismember(), privset_issubset(), privset_subtract(), privset_union() — privilege manipulation operations for checking and debugging purposes
SYNOPSIS
#include <sys/types.h>
#include <sys/privileges.h>
int priv_addset(priv_set_t *privp, const char *privname);
int priv_delset(priv_set_t *privp, const char *privname);
int priv_ismember(priv_set_t *privpi, char *privname);
int priv_isobserved(const char *privname);
void privset_add(priv_set_t *dstp, priv_t privid);
priv_set_t *privset_alloc();
void privset_copy(const priv_set_t *srcp, priv_set_t *dstp);
void privset_del(priv_set_t *privp, priv_t num);
void privset_empty(priv_set_t *privp);
void privset_fill(priv_set_t *privp);
void privset_free(priv_set_t *privp);
void privset_intersect(const priv_set_t *srcp, priv_set_t *dstp);
void privset_inverse(priv_set_t *privp);
int privset_isempty(const priv_set_t *privp);
int privset_isequal(const priv_set_t *srcp,const priv_set_t *dstp);
int privset_isfull(const priv_set_t *privp);
int privset_ismember(const priv_set_t *privp, priv_t privid);
int privset_issubset(const priv_set_t *srcp, const priv_set_t *dstp);
void privset_subtract(priv_set_t *srcp, priv_set_t *dstp);
void privset_union(const priv_set_t *srcp, priv_set_t *dstp);
Parameters
- dstp
const pointer
to
priv_set_t
type; points to the destination privilege set.
- num
int
type; specifies a privilege by number.
- privid
priv_t
type; contains the ID of the privilege to be acted upon.
- privname
const char pointer
type; string that contains the name of the privilege
to be acted upon.
- privp
Pointer to
priv_set_t
type; points to the privilege set to be acted upon.
- srcp
const pointer
to
priv_set_t
type; points to the source privilege set.
DESCRIPTION
- priv_addset()
Adds the privilege
privname
to the privilege set referred to by
privp.
- priv_delset()
Removes the privilege
privname
from the privilege set referred to by
privp.
- priv_ismember()
Check whether the named privilege
privname
is a member of the privilege set
privp.
- priv_isobserved()
Checks whether the calling process observes the named privilege
privname
See
privileges.5
for more information on when a process observes a privilege.
- privset_add()
Adds the privilege
privid
to the privilege set referred to by
dstp.
- privset_alloc()
Allocates memory for a privilege set of type
priv_set_t,
but does not initialize the space.
The space allocated by this routine should be released
using the
privset_free()
routine.
- privset_copy()
Copies the privilege set referred to by
srcp
to the privilege set referred to by
dstp.
- privset_del()
Removes the privilege specified by
num
from the privilege set referred to by
privp.
- privset_empty()
Clears all privileges from
privp.
- privset_fill()
Assigns all privileges, including those not currently define on the system, to
the privilege set
privp.
- privset_free()
Deallocates the space used by the privilege set referred to by
privp.
If
privp
is
NULL,
no action occurs.
- privset_intersect()
Finds the privileges that the privilege sets
srcp
and
dstp
have in common and places the results in the privilege set
dstp.
- privset_inverse()
Inverts the privilege set pointed to by
privp.
- privset_isempty()
Checks whether the privilege set
privp
is the empty set.
- privset_isequal()
Checks whether the privilege sets
srcp
and
dstp
are equal sets.
- privset_isfull()
Check whether the privilege set
privp
is the full set of privileges.
A full set of privileges is a set with all bits set,
regardless of whether the privilege is currently defined on the system.
- privset_ismember()
Check whether the privilege
privid
is a member of the privilege set
privp.
- privset_issubset()
Checks whether the privilege set
srcp
is a subset of the privilege set
dstp.
- privset_subtract()
Subtracts the privilege set referred to by
srcp
from the privilege set referred to by
dstp.
- privset_union()
Checks the privileges in the privilege sets
srcp
and
dstp
and puts any privilege that is in either set into
dstp.
RETURN VALUE
priv_addset(),
priv_delset(),
and
privset_delset()
return the following values:
- 0
Successful completion.
- -1
Function failed.
errno
is set to indicate the error.
privset_isempty(),
privset_isequal(),
privset_isfull(),
priv_ismember(),
priv_isobserved(),
and
privset_issubset()
return the following values:
- n!=0
Non-zero number.
Condition is TRUE.
- 0
Condition is FALSE.
errno
is set to indicate the error.
privset_alloc()
returns the following values:
- pointer
Successful completions.
Returns a non-null pointer to the allocated space.
- NULL pointer
Function failed.
Returns a null pointer and sets
errno
to indicate the error .
ERRORS
If any of the following conditions occur, the functions fail and set
errno.
- ENOMEM
Insufficient memory available to allocate space to hold a privilege set.
The application can try again later.
- EINVAL
Invalid argument.