CINXE.COM

issetugid(2) - OpenBSD manual pages

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="/mandoc.css" type="text/css" media="all"> <title>issetugid(2) - OpenBSD manual pages</title> </head> <body> <header> <section> <h1><a href="https://www.openbsd.org/">OpenBSD</a> manual page server</h1> </section> <form role="search" action="/" method="get" autocomplete="off" autocapitalize="none"> <fieldset> <legend>Manual Page Search Parameters</legend> <label>Search query: <input type="search" name="query" value="issetugid" size="40"> </label> <button type="submit" name="apropos" value="0">man</button> <button type="submit" name="apropos" value="1">apropos</button> <br/> <select name="sec" aria-label="Manual section"> <option value="0">All Sections</option> <option value="1">1 - General Commands</option> <option value="2" selected="selected">2 - System Calls</option> <option value="3">3 - Library Functions</option> <option value="3p">3p - Perl Library</option> <option value="4">4 - Device Drivers</option> <option value="5">5 - File Formats</option> <option value="6">6 - Games</option> <option value="7">7 - Miscellaneous Information</option> <option value="8">8 - System Manager's Manual</option> <option value="9">9 - Kernel Developer's Manual</option> </select> <select name="arch" aria-label="CPU architecture"> <option value="default" selected="selected">All Architectures</option> <option>amd64</option> <option>alpha</option> <option>armv7</option> <option>arm64</option> <option>hppa</option> <option>i386</option> <option>landisk</option> <option>loongson</option> <option>luna88k</option> <option>macppc</option> <option>mips64</option> <option>octeon</option> <option>powerpc64</option> <option>riscv64</option> <option>sparc64</option> <option>amiga</option> <option>arc</option> <option>armish</option> <option>arm32</option> <option>atari</option> <option>aviion</option> <option>beagle</option> <option>cats</option> <option>hppa64</option> <option>hp300</option> <option>ia64</option> <option>mac68k</option> <option>mvme68k</option> <option>mvme88k</option> <option>mvmeppc</option> <option>palm</option> <option>pc532</option> <option>pegasos</option> <option>pmax</option> <option>powerpc</option> <option>sgi</option> <option>socppc</option> <option>solbourne</option> <option>sparc</option> <option>sun3</option> <option>vax</option> <option>wgrisc</option> <option>x68k</option> <option>zaurus</option> </select> <select name="manpath" aria-label="Manual path"> <option selected="selected">OpenBSD-current</option> <option>OpenBSD-7.6</option> <option>OpenBSD-7.5</option> <option>OpenBSD-7.4</option> <option>OpenBSD-7.3</option> <option>OpenBSD-7.2</option> <option>OpenBSD-7.1</option> <option>OpenBSD-7.0</option> <option>OpenBSD-6.9</option> <option>OpenBSD-6.8</option> <option>OpenBSD-6.7</option> <option>OpenBSD-6.6</option> <option>OpenBSD-6.5</option> <option>OpenBSD-6.4</option> <option>OpenBSD-6.3</option> <option>OpenBSD-6.2</option> <option>OpenBSD-6.1</option> <option>OpenBSD-6.0</option> <option>OpenBSD-5.9</option> <option>OpenBSD-5.8</option> <option>OpenBSD-5.7</option> <option>OpenBSD-5.6</option> <option>OpenBSD-5.5</option> <option>OpenBSD-5.4</option> <option>OpenBSD-5.3</option> <option>OpenBSD-5.2</option> <option>OpenBSD-5.1</option> <option>OpenBSD-5.0</option> <option>OpenBSD-4.9</option> <option>OpenBSD-4.8</option> <option>OpenBSD-4.7</option> <option>OpenBSD-4.6</option> <option>OpenBSD-4.5</option> <option>OpenBSD-4.4</option> <option>OpenBSD-4.3</option> <option>OpenBSD-4.2</option> <option>OpenBSD-4.1</option> <option>OpenBSD-4.0</option> <option>OpenBSD-3.9</option> <option>OpenBSD-3.8</option> <option>OpenBSD-3.7</option> <option>OpenBSD-3.6</option> <option>OpenBSD-3.5</option> <option>OpenBSD-3.4</option> <option>OpenBSD-3.3</option> <option>OpenBSD-3.2</option> <option>OpenBSD-3.1</option> <option>OpenBSD-3.0</option> <option>OpenBSD-2.9</option> <option>OpenBSD-2.8</option> <option>OpenBSD-2.7</option> <option>OpenBSD-2.6</option> <option>OpenBSD-2.5</option> <option>OpenBSD-2.4</option> <option>OpenBSD-2.3</option> <option>OpenBSD-2.2</option> </select> </fieldset> </form> </header> <hr> <div class="head" role="doc-pageheader" aria-label="Manual header line"><span class="head-ltitle">ISSETUGID(2)</span> <span class="head-vol">System Calls Manual</span> <span class="head-rtitle">ISSETUGID(2)</span></div> <main class="manual-text"> <section class="Sh"> <h2 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h2> <p class="Pp"><code class="Nm">issetugid</code> &#x2014; <span class="Nd" role="doc-subtitle">is current executable running setuid or setgid</span></p> </section> <section class="Sh"> <h2 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h2> <p class="Pp"><code class="In">#include &lt;<a class="In">unistd.h</a>&gt;</code></p> <p class="Pp"><var class="Ft">int</var> <br/> <code class="Fn">issetugid</code>(<var class="Fa" style="white-space: nowrap;">void</var>);</p> </section> <section class="Sh"> <h2 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h2> <p class="Pp">The <a class="permalink" href="#issetugid"><code class="Fn" id="issetugid">issetugid</code></a>() function returns 1 if the process was made setuid or setgid as the result of the last or other previous <a class="permalink" href="#execve"><code class="Fn" id="execve">execve</code></a>() system calls. Otherwise it returns 0.</p> <p class="Pp">This system call exists so that library routines (inside libtermlib, libc, or other libraries) can guarantee safe behavior when used inside setuid or setgid programs. Some library routines may be passed insufficient information and hence not know whether the current program was started setuid or setgid because higher level calling code may have made changes to the uid, euid, gid, or egid. Hence these low-level library routines are unable to determine if they are being run with elevated or normal privileges.</p> <p class="Pp" id="getenv">In particular, it is wise to use this call to determine if a pathname returned from a <a class="permalink" href="#getenv"><code class="Fn">getenv</code></a>() call may safely be used to <a class="permalink" href="#open"><code class="Fn" id="open">open</code></a>() the specified file. Quite often this is not wise because the status of the effective uid is not known.</p> <p class="Pp" id="issetugid~2">The <a class="permalink" href="#issetugid~2"><code class="Fn">issetugid</code></a>() system call's result is unaffected by calls to <a class="permalink" href="#setuid"><code class="Fn" id="setuid">setuid</code></a>(), <a class="permalink" href="#setgid"><code class="Fn" id="setgid">setgid</code></a>(), or other such calls. In case of a <a class="permalink" href="#fork"><code class="Fn" id="fork">fork</code></a>(), the child process inherits the same status.</p> <p class="Pp" id="issetugid~3">The status of <a class="permalink" href="#issetugid~3"><code class="Fn">issetugid</code></a>() is only affected by <a class="permalink" href="#execve~2"><code class="Fn" id="execve~2">execve</code></a>(). If a child process executes a new executable file, a new issetugid status will be determined. This status is based on the existing process's uid, euid, gid, and egid permissions and on the modes of the executable file. If the new executable file modes are setuid or setgid, or if the existing process is executing the new image with uid != euid or gid != egid, the new process will be considered issetugid.</p> </section> <section class="Sh"> <h2 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h2> <p class="Pp">The <code class="Fn">issetugid</code>() function is always successful, and no return value is reserved to indicate an error.</p> </section> <section class="Sh"> <h2 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE ALSO</a></h2> <p class="Pp"><a class="Xr" href="/execve.2" aria-label="execve, section 2">execve(2)</a>, <a class="Xr" href="/setegid.2" aria-label="setegid, section 2">setegid(2)</a>, <a class="Xr" href="/seteuid.2" aria-label="seteuid, section 2">seteuid(2)</a>, <a class="Xr" href="/setgid.2" aria-label="setgid, section 2">setgid(2)</a>, <a class="Xr" href="/setuid.2" aria-label="setuid, section 2">setuid(2)</a>, <a class="Xr" href="/getenv.3" aria-label="getenv, section 3">getenv(3)</a></p> </section> <section class="Sh"> <h2 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h2> <p class="Pp">The <code class="Fn">issetugid</code>() function call first appeared in <span class="Ux">OpenBSD 2.0</span>.</p> </section> </main> <div class="foot" role="doc-pagefooter" aria-label="Manual footer line"><span class="foot-left"></span><span class="foot-date">September 10, 2015</span> <span class="foot-os">OpenBSD-current</span></div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10