United States-English |
|
|
HP-UX Reference > Ppriv_str_to_set(3)HP-UX 11i Version 3: February 2007 |
|
NAMEpriv_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); Parameterspriv_str_to_set()
priv_set_to_str()
DESCRIPTIONpriv_str_to_set Conversionpriv_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). RETURN VALUEpriv_set_to_str() and priv_str_to_set() return the following values:
ERRORSIf any of the following conditions occur, the functions fail and set errno.
EXAMPLES#include <stdio.h> #include <sys/types.h> #include <sys/privileges.h> #define priv_list "PRIV_CHOWN,PRIV_CHROOT,PRIV_DACREAD" main() { char *index; priv_set_t * priv_vector; if ( (priv_vector = priv_str_to_set( priv_list, NULL, &index)) == NULL ) { perror("priv_str_to_set Failed"); if (index) printf("Invalid privilege name starting at %s\n", index); exit(1); } printf("The privileges in the given privilege vector are %s\n", priv_set_to_str( priv_vector, NULL, PRIV_STR_SHORT) ); } |
Printable version | ||
|