priv_str_to_set man page on HP-UX

Printed from

priv_str_to_set(3)					    priv_str_to_set(3)

       priv_str_to_set(), priv_set_to_str() - privilege name to set conversion


	      priv_list	     The list of privilege names, passed as a  string,
			     separated	by  one or more characters from delim‐
			     iter.  It may also contain	 the  compound	privi‐
			     leges (basic, basicroot, and policy).

	      delimiter	     Separates the privileges in priv_list.

	      index_ptr	     If	 an  error  occurs  while  parsing the list of
			     privilege	names,	the  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.

	      delimiter	     Separates	the  individual privilege names by any
			     of the specified characters.  If delimiter	 is  a
			     NULL character, the default delimiter of comma is

	      flag	     Bit  mask	with  the  following   bit   positions
			     defined:  Exactly	one  of	 the two flags must be
			     passed.  When flag is the resulting  string  uses
			     the  compound privileges and to arrive at a short

	      priv_vec	     Specifies privilege set.

   priv_str_to_set Conversion
       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, means all
       privileges in the compound privilege except the privilege.

       The string is case-insensitive.	prefix	is  optional  to  a  privilege
       name.  For example, and all have the same meaning.

       priv_list is interpreted left to right, so the string is the same as an
       empty list of privileges, while is the same as

       For a list of valid privileges (both individual privileges and compound
       privileges), see privileges(5).

   priv_set_to_str Conversion
       converts	 a  privilege  set to a string of privilege names separated by
       the character specified by delimiter .

       and return the following values:

	      pointer	Successful completions.	 Returns a  non-null  pointer.
			The  caller  of	 is responsible for freeing the result
			using the The caller of is responsible for freeing the
			result using the

	      NULL pointer
			Function  failed.   Returns a null pointer and sets to
			indicate the error .

       If any of the following conditions occur, the functions fail and set

	      Cannot allocate enough memory for the given data.

	      One or more arguments are invalid.

       #include <stdio.h>
       #include <sys/types.h>
       #include <sys/privileges.h>

       #define priv_list "PRIV_CHOWN,PRIV_CHROOT,PRIV_DACREAD"

	 char *index;
	 priv_set_t * priv_vector;

	 if ( (priv_vector = priv_str_to_set( priv_list,
				 &index)) == NULL )
		 perror("priv_str_to_set Failed");
		 if (index)
		     printf("Invalid privilege name starting at %s\n", index);

	 printf("The privileges in the given privilege vector are %s\n",
		 priv_set_to_str( priv_vector, NULL, PRIV_STR_SHORT) );

       and are both part of the library.

       privset_free(3), privileges(5).


List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net