issetugid(2) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

issetugid(2)

issetugid(2)                     System Calls                     issetugid(2)

NAME
       issetugid - determine if current executable is running setuid or setgid

SYNOPSIS
       #include <unistd.h>

       int issetugid(void);

DESCRIPTION
       The  issetugid()  function  enables library functions to guarantee safe
       behavior when used in setuid or setgid programs or  programs  that  run
       with more privileges after a successful exec(2). Some library functions
       might  be passed insufficient information and not know whether the cur‐
       rent program was started setuid or setgid because a higher level  call‐
       ing  code might have made changes to the uid, euid, gid, or egid. These
       low-level library functions are therefore unable to determine  if  they
       are being run with elevated or normal privileges.


       The  issetugid()  function can be used to determine if a value returned
       from a getenv(3C) call can be used safely. It is often not safe to  use
       such  a value because the status of the effective uid is not known. The
       secure_getenv(3C) function provides a simple way to do this.


       The result of a call to issetugid() is unaffected by calls to setuid(),
       setgid(), or other such calls. In case of a call to fork(2), the  child
       process inherits the same status.


       The  value returned by issetugid() is affected only by the execution of
       a new process via the calls listed on the exec(2)  or  spawn(2)  manual
       pages.  If  a child process executes a new executable file, a new isse‐
       tugid() value will be based on the existing process's uid,  euid,  gid,
       and egid permissions and on the modes of the executable file. The isse‐
       tugid() function will return 1 in the new process if any of the follow‐
       ing are true:

           o      The new executable file modes are setuid or setgid.


           o      The  existing process is executing the new image with uid !=
                  euid, or an egid that is not either gid or one of the user's
                  supplementary group ids.


           o      The permitted privilege set before the call to the  exec  or
                  spawn  function  is not a superset of the inheritable set at
                  that time.


           o      The parent process is a profile shell, and the child process
                  has a uid or privileges that differ from its parent process.
                  See PRIV_PFEXEC in the getpflags(2) man page.



       Otherwise, issetugid() will return 0 when called in the new process.

RETURN VALUES
       The issetugid() function returns 1 if the process was  made  setuid  or
       setgid as the result of the last or a previous call to execve(). Other‐
       wise it returns 0.

ERRORS
       The  issetugid()  function is always successful. No return value is re‐
       served to indicate an error.

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE  VALUE  _  Interface StabilityCommitted _ MT-LevelAsync-Signal-
       Safe


SEE ALSO
       exec(2),  fork(2),  getuid(2),  setuid(2),  getenv(3C),  attributes(7),
       privileges(7)

HISTORY
       The issetugid() function first appeared in OpenBSD 2.0. It was added to
       Solaris in the Solaris 9 release.

Oracle Solaris 11.4               30 Jan 2023                     issetugid(2)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3