HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

p
priv_str_to_set(3) priv_str_to_set(3)
NAME
priv_str_to_set(), priv_set_to_str() - privilege name to set conversion function
SYNOPSIS
#include <sys/types.h>
#include <sys/privileges.h>
priv_set_t * priv_str_to_set(const char *
priv_list,
const char *
delimiter,
char **
index_ptr);
char *priv_set_to_str(const priv_set_t *
priv_vec,
char
delimiter,
int
flag);
Parameters
priv_str_to_set()
priv_list The list of privilege names, passed as a string, separated by one or more characters
from delimiter. It may also contain the compound privileges (basic, basicroot, and pol-
icy).
delimiter Separates the privileges in priv_list.
index_ptr If an error occurs while parsing the list of privilege names, the char pointer pointed
to by index_ptr is set to point to the remainder of the string after the error occurred,
so long as index_ptr is not a NULL pointer.
priv_set_to_str()
delimiter Separates the individual privilege names by any of the specified characters. If delim-
iter is a NULL character, the default delimiter of comma (
,) is used.
flag Bit mask with the following bit positions defined: PRIV_STR_LIT ,
PRIV_STR_SHORT. Exactly one of the two flags must be passed. When flag is
PRIV_STR_SHORT, the resulting string uses the compound privileges
BASIC,
BASICPOLICY , and POLICY to arrive at a short representation.
priv_vec Specifies privilege set.
DESCRIPTION
priv_str_to_set Conversion
priv_str_to_set()
converts a list of privilege names to a privilege set.
priv_list is a string consisting of privilege names and/or compound privileges. The individual elements in
the string are separated by one or more characters of delimiter .
Any privilege in the list priv_list can be optionally preceded by an exclamation mark (
!
) to be interpreted
as removal. For example,
POLICY,!PRIV_CMPTREAD
means all privileges in the compound privilege
POLICY except the PRIV_CMPTREAD privilege.
The string is case-insensitive.
PRIV_ prefix is optional to a privilege name. For example,
PRIV_CMPTREAD, CmptRead, and Priv_CmPTReaD all have the same meaning.
priv_list is interpreted left to right, so the string
DACREAD,!DACREAD is the same as an empty list of
privileges, while !DACREAD,DACREAD is the same as DACREAD.
For a list of valid privileges (both individual privileges and compound privileges), see privileges(5).
priv_set_to_str Conversion
priv_set_to_str() converts a privilege set to a string of privilege names separated by the character
specified by delimiter .
RETURN VALUE
priv_set_to_str() and priv_str_to_set()
return the following values:
pointer
Successful completions. Returns a non-null pointer. The caller of
priv_str_to_set() is
responsible for freeing the result using the privset_free(). The caller of
168 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: December 2007 Update