NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | RETURN VALUES | SEE ALSO | NOTES
#include <tsol/prof.h>profstr_t * getprofstrbyname(char * name , int src);
These functions are used to obtain entries describing Trusted Solaris user profiles from the tsolprof NIS+ database or the /etc/security/tsol/tsoluser file.
getprofstrbyname() searches for information for a profile with the specified profile name given by the parameter name .
The functions setprofstr() , getprofstr() , and endprofstr() are used to enumerate profile entries from the database. setprofstr() sets (or resets) the enumeration to the beginning of the set of Trusted Solaris profile entries. This function should be called before the first call to getprofstr() . A call to getprofstrbyname() leaves the enumeration position in an indeterminate state. If the stayopen flag is non-zero, the system may keep allocated resources such as open file descriptors until a subsequent call to endprofstr() .
Successive calls to getprofstr() return either successive entries or return NULL , indicating the end of the enumeration.
endprofstr() may be called to indicate that the caller expects to do no further profile strry retrieval operations; the system may then deallocate resources it was using. It is still allowed, but possibly less efficient, for the process to call more profile string retrieval functions after calling endprofstr() .
The functions getprofstrbyname() and getprofstr() are reentrant interfaces that allocate memory to store returned results, and are safe for use in both single-threaded and multithreaded applications. The function free_profstr() should be used to free the pointers returned by either getprofstrbyname() or getprofstr() .
The parameter name must be a pointer to the profile name in the form of a null-terminated character-string.
The parameter
src
may be set to any of
TSOL_SRC_FILES
,
TSOL_SRC_NISPLUS
, or
TSOL_SRC_SWITCH
, which are defined in
<tsol/tsol.h>
. For most applications the
src
parameter should be set to
TSOL_SRC_SWITCH
, indicating that the system should use the
/etc/nsswitch.conf
file to determine the ultimate source of the database. However, in
certain administrative application, it may be prudent to use the
TSOL_SRC_FILES
option to for a read from the
/etc/security/tsol/tsoluser
file or the
TSOL_SRC_NISPLUS
option to force a read from the
tsoluser
NIS+ database.
The function
putprofstr()
replaces an existing profile entry or adds a new entry if the profile name does not already exist. Currently the
src
parameter is treated as
TSOL_SRC_NISPLUS
, forcing all information to
be written to the
NIS+
table. Use of files or of
nsswitch.conf(4)
may be supported in future releases.
For enumeration in multithreaded applications, the position within the enumeration is a process-wide property shared by all threads. setprofstr() may be used in a multithreaded application but resets the enumeration position for all threads. If multiple threads interleave calls to getprofstr() , the threads enumerate disjoint subsets of the tsolprof(4) database.
User entries are represented by the struct profstr_t structure defined in <tsol/prof.h> :
typedef struct profstr_t { char name; /* name of profile */ char desc; /* description */ char auths; /* comma separated list of authorization numbers */ char actions; /* semicolon separated action descriptions */ char cmds; /* semicolon separated command descriptions */ } profstr_t;
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Availability | SUNWtsu |
MT-Level | MT-Safe |
The function getprofstrbyname() returns a pointer to a profstr_t if it successfully locates the requested entry; otherwise it returns NULL .
The function getprofstr() returns a pointer to a profstr_t if it successfully enumerates an entry; otherwise it returns NULL , indicating the end of the enumeration.
The function putprofstr() returns 0 on success.
Programs that use the interfaces described here cannot be linked statically since the implementation of these functions employ dynamic loading and linking of shared objects at run time.
When compiling multithreaded applications, see Intro(3) , Notes On Multithread Applications , for information about the use of the _REENTRANT flag.
NAME | SYNOPSIS | DESCRIPTION | ATTRIBUTES | RETURN VALUES | SEE ALSO | NOTES