MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Standard C Library Functions                        ucredget(3C)



NAME
     ucredget,   ucredfree,    ucredgeteuid,    ucredgetruid,
     ucredgetsuid,  ucredgetegid, ucredgetrgid, ucredgetsgid,
     ucredgetgroups,       ucredgetprivset,       ucredgetpid,
     ucredgetprojid,      ucredgetzoneid,      ucredgetpflags,
     ucredgetlabel, ucredsize - user credential functions

SYNOPSIS
     #include 

     ucredt *ucredget(pidt pid);


     void ucredfree(ucredt *uc);


     uidt ucredgeteuid(const ucredt *uc);


     uidt ucredgetruid(const ucredt *uc);


     uidt ucredgetsuid(const ucredt *uc);


     gidt ucredgetegid(const ucredt *uc);


     gidt ucredgetrgid(const ucredt *uc);


     gidt ucredgetsgid(const ucredt *uc);


     int ucredgetgroups(const ucredt *uc, const gidt **groups);


     const privsett *ucredgetprivset(const ucredt *uc,
          privptypet set);


     pidt ucredgetpid(const ucredt *uc);


     projidt ucredgetprojid(const ucredt *uc);


     zoneidt ucredgetzoneid(const ucredt *uc);


     uintt ucredgetpflags(const ucredt *uc, uintt flags);




SunOS 5.11           Last change: 4 Apr 2008                    1






Standard C Library Functions                        ucredget(3C)



     mlabelt *ucredgetlabel(const ucredt *uc);


     sizet ucredsize(void);


DESCRIPTION
     These functions return or act on a user credential, ucredt.
     User  credentials  are  returned  by  various  functions and
     describe the credentials of a process. Information about the
     process  can  then  be  obtained by calling the access func-
     tions. Access functions can fail if the underlying mechanism
     did not return sufficient information.


     The ucredget() function returns the user credential of  the
     specified  pid  or NUL if none can be obtained. A pid value
     of PMYID returns information about the calling process. The
     return  value  is  dynamically  allocated  and must be freed
     using ucredfree().


     The   ucredgeteuid(),   ucredgetruid(),   ucredgetsuid(),
     ucredgetegid(),  ucredgetrgid(), and ucredgetsgid() func-
     tions return the effective UID, real UID, saved UID,  effec-
     tive  GID,  real  GID, saved GID, respectively, or -1 if the
     user credential does not contain sufficient information.


     The ucredgetgroups() function stores a pointer to the group
     list  in  the  gidt * pointed to by the second argument and
     returns the number of groups in the list. It returns  -1  if
     the information is not available. The returned group list is
     valid until ucredfree() is called on  the  user  credential
     given as argument.


     The ucredgetpid() function returns the process  ID  of  the
     process  or  -1 if the process ID is not available. The pro-
     cess ID returned in a user credential is only guaranteed  to
     be  correct  in a very limited number of cases when returned
     by doorucred(3C) and ucredget(). In all other  cases,  the
     process  in  question might have handed of the file descrip-
     tor, the process might have exited or executed another  pro-
     gram,  or  the  process  ID might have been reused by a com-
     pletely unrelated process after the original program exited.


     The ucredgetprojid() function returns the project ID of the
     process or -1 if the project ID is not available.





SunOS 5.11           Last change: 4 Apr 2008                    2






Standard C Library Functions                        ucredget(3C)



     The ucredgetzoneid() function returns the zone  ID  of  the
     process or -1 if the zone ID is not available.


     The  ucredgetprivset()  function  returns   the   specified
     privilege  set  specified  as  second  argument,  or NUL if
     either the requested information is  not  available  or  the
     privilege set name is invalid. The returned privilege set is
     valid until ucredfree() is called  on  the  specified  user
     credential.


     The ucredgetpflags() function  returns  the  value  of  the
     specified  privilege  flags  from  the  ucred  structure, or
     (uintt)-1 if none was present.


     The ucredgetlabel()  function  returns  the  value  of  the
     label,  or  NUL if the label is not available. The returned
     label is valid until ucredfree() is called on the specified
     user credential. This function is available only if the sys-
     tem is configured with Trusted Extensions.


     The ucredfree() function frees the memory allocated for the
     specified user credential.


     The  ucredsize()  function  returns  sizeof(ucredt).  This
     value is constant only until the next boot, at which time it
     could change. The  ucredsize()  function  can  be  used  to
     determine the size of the buffer needed to receive a creden-
     tial option with SORECVUCRED. See socket.h(3HEAD).

RETURN VALUES
     See DESCRIPTION.

ERORS
     The ucredget() function will fail if:

     EAGAIN    There is not enough memory available  to  allocate
               sufficient  memory  to hold a user credential. The
               application can try again later.


     EACES    The caller does not have sufficient privileges  to
               examine the target process.


     EMFILE    The calling process cannot open any more files.
     ENFILE




SunOS 5.11           Last change: 4 Apr 2008                    3






Standard C Library Functions                        ucredget(3C)



     ENOMEM    The physical limits of the system are exceeded  by
               the  memory  allocation  needed  to  hold  a  user
               credential.


     ESRCH     The target process does not exist.



     The ucredgetprivset() function will fail if:

     EINVAL    The privilege set argument is invalid.



     The ucredgetlabel() function will fail if:

     EINVAL    The label is not present.



     The   ucredgeteuid(),   ucredgetruid(),   ucredgetsuid(),
     ucredgetegid(),      ucredgetrgid(),      ucredgetsgid(),
     ucredgetgroups(),  ucredgetpflags(),   ucredgetprivset(),
     ucredgetprojid(),   ucredgetpid(),   and  ucredgetlabel()
     functions will fail if:

     EINVAL    The requested user  credential  attribute  is  not
               available in the specified user credential.


ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Interface Stability          Committed                   
    
     MT-Level                     MT-Safe                     
    


SEE ALSO
     getpflags(2), getppriv(2), doorucred(3C), getpeerucred(3C),
     privset(3C),   socket.h(3HEAD),  attributes(5),  labels(5),
     privileges(5)





SunOS 5.11           Last change: 4 Apr 2008                    4



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™