| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>GCredentials: GIO Reference Manual</title> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> |
| <link rel="home" href="index.html" title="GIO Reference Manual"> |
| <link rel="up" href="networking.html" title="Low-level network support"> |
| <link rel="prev" href="GUnixFDMessage.html" title="GUnixFDMessage"> |
| <link rel="next" href="GUnixCredentialsMessage.html" title="GUnixCredentialsMessage"> |
| <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)"> |
| <link rel="stylesheet" href="style.css" type="text/css"> |
| </head> |
| <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> |
| <td width="100%" align="left" class="shortcuts"> |
| <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> |
| <a href="#GCredentials.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> |
| <a href="#GCredentials.object-hierarchy" class="shortcut">Object Hierarchy</a></span> |
| </td> |
| <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| <td><a accesskey="u" href="networking.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> |
| <td><a accesskey="p" href="GUnixFDMessage.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| <td><a accesskey="n" href="GUnixCredentialsMessage.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> |
| </tr></table> |
| <div class="refentry"> |
| <a name="GCredentials"></a><div class="titlepage"></div> |
| <div class="refnamediv"><table width="100%"><tr> |
| <td valign="top"> |
| <h2><span class="refentrytitle"><a name="GCredentials.top_of_page"></a>GCredentials</span></h2> |
| <p>GCredentials — An object containing credentials</p> |
| </td> |
| <td class="gallery_image" valign="top" align="right"></td> |
| </tr></table></div> |
| <div class="refsect1"> |
| <a name="GCredentials.functions"></a><h2>Functions</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="functions_return"> |
| <col class="functions_name"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-new" title="g_credentials_new ()">g_credentials_new</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-to-string" title="g_credentials_to_string ()">g_credentials_to_string</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-get-native" title="g_credentials_get_native ()">g_credentials_get_native</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-set-native" title="g_credentials_set_native ()">g_credentials_set_native</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-is-same-user" title="g_credentials_is_same_user ()">g_credentials_is_same_user</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">uid_t</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-get-unix-user" title="g_credentials_get_unix_user ()">g_credentials_get_unix_user</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-set-unix-user" title="g_credentials_set_unix_user ()">g_credentials_set_unix_user</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">pid_t</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="GCredentials.html#g-credentials-get-unix-pid" title="g_credentials_get_unix_pid ()">g_credentials_get_unix_pid</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="GCredentials.other"></a><h2>Types and Values</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="name"> |
| <col class="description"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="datatype_keyword"> </td> |
| <td class="function_name"><a class="link" href="GCredentials.html#GCredentials-struct" title="GCredentials">GCredentials</a></td> |
| </tr> |
| <tr> |
| <td class="datatype_keyword">enum</td> |
| <td class="function_name"><a class="link" href="GCredentials.html#GCredentialsType" title="enum GCredentialsType">GCredentialsType</a></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="GCredentials.object-hierarchy"></a><h2>Object Hierarchy</h2> |
| <pre class="screen"> <a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> |
| <span class="lineart">╰──</span> GCredentials |
| </pre> |
| </div> |
| <div class="refsect1"> |
| <a name="GCredentials.includes"></a><h2>Includes</h2> |
| <pre class="synopsis">#include <gio/gio.h> |
| </pre> |
| </div> |
| <div class="refsect1"> |
| <a name="GCredentials.description"></a><h2>Description</h2> |
| <p>The <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> type is a reference-counted wrapper for native |
| credentials. This information is typically used for identifying, |
| authenticating and authorizing other processes.</p> |
| <p>Some operating systems supports looking up the credentials of the |
| remote peer of a communication endpoint - see e.g. |
| <a class="link" href="GSocket.html#g-socket-get-credentials" title="g_socket_get_credentials ()"><code class="function">g_socket_get_credentials()</code></a>.</p> |
| <p>Some operating systems supports securely sending and receiving |
| credentials over a Unix Domain Socket, see |
| <a class="link" href="GUnixCredentialsMessage.html" title="GUnixCredentialsMessage"><span class="type">GUnixCredentialsMessage</span></a>, <a class="link" href="GUnixConnection.html#g-unix-connection-send-credentials" title="g_unix_connection_send_credentials ()"><code class="function">g_unix_connection_send_credentials()</code></a> and |
| <a class="link" href="GUnixConnection.html#g-unix-connection-receive-credentials" title="g_unix_connection_receive_credentials ()"><code class="function">g_unix_connection_receive_credentials()</code></a> for details.</p> |
| <p>On Linux, the native credential type is a struct ucred - see the |
| unix(7) man page for details. This corresponds to |
| <a class="link" href="GCredentials.html#G-CREDENTIALS-TYPE-LINUX-UCRED:CAPS"><code class="literal">G_CREDENTIALS_TYPE_LINUX_UCRED</code></a>.</p> |
| <p>On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native |
| credential type is a struct cmsgcred. This corresponds |
| to <a class="link" href="GCredentials.html#G-CREDENTIALS-TYPE-FREEBSD-CMSGCRED:CAPS"><code class="literal">G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED</code></a>.</p> |
| <p>On NetBSD, the native credential type is a struct unpcbid. |
| This corresponds to <a class="link" href="GCredentials.html#G-CREDENTIALS-TYPE-NETBSD-UNPCBID:CAPS"><code class="literal">G_CREDENTIALS_TYPE_NETBSD_UNPCBID</code></a>.</p> |
| <p>On OpenBSD, the native credential type is a struct sockpeercred. |
| This corresponds to <a class="link" href="GCredentials.html#G-CREDENTIALS-TYPE-OPENBSD-SOCKPEERCRED:CAPS"><code class="literal">G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED</code></a>.</p> |
| <p>On Solaris (including OpenSolaris and its derivatives), the native |
| credential type is a ucred_t. This corresponds to |
| <a class="link" href="GCredentials.html#G-CREDENTIALS-TYPE-SOLARIS-UCRED:CAPS"><code class="literal">G_CREDENTIALS_TYPE_SOLARIS_UCRED</code></a>.</p> |
| </div> |
| <div class="refsect1"> |
| <a name="GCredentials.functions_details"></a><h2>Functions</h2> |
| <div class="refsect2"> |
| <a name="g-credentials-new"></a><h3>g_credentials_new ()</h3> |
| <pre class="programlisting"><a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> * |
| g_credentials_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre> |
| <p>Creates a new <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> object with credentials matching the |
| the current process.</p> |
| <div class="refsect3"> |
| <a name="g-credentials-new.returns"></a><h4>Returns</h4> |
| <p> A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a>. Free with <a href="../gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-credentials-to-string"></a><h3>g_credentials_to_string ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> * |
| g_credentials_to_string (<em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>);</pre> |
| <p>Creates a human-readable textual representation of <em class="parameter"><code>credentials</code></em> |
| |
| that can be used in logging and debug messages. The format of the |
| returned string may change in future GLib release.</p> |
| <div class="refsect3"> |
| <a name="g-credentials-to-string.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> object.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-credentials-to-string.returns"></a><h4>Returns</h4> |
| <p> A string that should be freed with <a href="../glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-credentials-get-native"></a><h3>g_credentials_get_native ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a> |
| g_credentials_get_native (<em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>, |
| <em class="parameter"><code><a class="link" href="GCredentials.html#GCredentialsType" title="enum GCredentialsType"><span class="type">GCredentialsType</span></a> native_type</code></em>);</pre> |
| <p>Gets a pointer to native credentials of type <em class="parameter"><code>native_type</code></em> |
| from |
| <em class="parameter"><code>credentials</code></em> |
| .</p> |
| <p>It is a programming error (which will cause an warning to be |
| logged) to use this method if there is no <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> support for |
| the OS or if <em class="parameter"><code>native_type</code></em> |
| isn't supported by the OS.</p> |
| <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p> |
| <div class="refsect3"> |
| <a name="g-credentials-get-native.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>native_type</p></td> |
| <td class="parameter_description"><p>The type of native credentials to get.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-credentials-get-native.returns"></a><h4>Returns</h4> |
| <p> The pointer to native credentials or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the |
| operation there is no <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> support for the OS or if |
| <em class="parameter"><code>native_type</code></em> |
| isn't supported by the OS. Do not free the returned |
| data, it is owned by <em class="parameter"><code>credentials</code></em> |
| .</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-credentials-set-native"></a><h3>g_credentials_set_native ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_credentials_set_native (<em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>, |
| <em class="parameter"><code><a class="link" href="GCredentials.html#GCredentialsType" title="enum GCredentialsType"><span class="type">GCredentialsType</span></a> native_type</code></em>, |
| <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> native</code></em>);</pre> |
| <p>Copies the native credentials of type <em class="parameter"><code>native_type</code></em> |
| from <em class="parameter"><code>native</code></em> |
| |
| into <em class="parameter"><code>credentials</code></em> |
| .</p> |
| <p>It is a programming error (which will cause an warning to be |
| logged) to use this method if there is no <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> support for |
| the OS or if <em class="parameter"><code>native_type</code></em> |
| isn't supported by the OS.</p> |
| <div class="refsect3"> |
| <a name="g-credentials-set-native.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>native_type</p></td> |
| <td class="parameter_description"><p>The type of native credentials to set.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>native</p></td> |
| <td class="parameter_description"><p> A pointer to native credentials. </p></td> |
| <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL must not be passed as the value in, out, in-out; or as a return value."><span class="acronym">not nullable</span></acronym>]</span></td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-credentials-is-same-user"></a><h3>g_credentials_is_same_user ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| g_credentials_is_same_user (<em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>, |
| <em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *other_credentials</code></em>, |
| <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> |
| <p>Checks if <em class="parameter"><code>credentials</code></em> |
| and <em class="parameter"><code>other_credentials</code></em> |
| is the same user.</p> |
| <p>This operation can fail if <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> is not supported on the |
| the OS.</p> |
| <div class="refsect3"> |
| <a name="g-credentials-is-same-user.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>other_credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>error</p></td> |
| <td class="parameter_description"><p>Return location for error or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-credentials-is-same-user.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>credentials</code></em> |
| and <em class="parameter"><code>other_credentials</code></em> |
| has the same |
| user, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise or if <em class="parameter"><code>error</code></em> |
| is set.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-credentials-get-unix-user"></a><h3>g_credentials_get_unix_user ()</h3> |
| <pre class="programlisting"><span class="returnvalue">uid_t</span> |
| g_credentials_get_unix_user (<em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>, |
| <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> |
| <p>Tries to get the UNIX user identifier from <em class="parameter"><code>credentials</code></em> |
| . This |
| method is only available on UNIX platforms.</p> |
| <p>This operation can fail if <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> is not supported on the |
| OS or if the native credentials type does not contain information |
| about the UNIX user.</p> |
| <div class="refsect3"> |
| <a name="g-credentials-get-unix-user.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>error</p></td> |
| <td class="parameter_description"><p>Return location for error or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-credentials-get-unix-user.returns"></a><h4>Returns</h4> |
| <p> The UNIX user identifier or -1 if <em class="parameter"><code>error</code></em> |
| is set.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-credentials-set-unix-user"></a><h3>g_credentials_set_unix_user ()</h3> |
| <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> |
| g_credentials_set_unix_user (<em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>, |
| <em class="parameter"><code><span class="type">uid_t</span> uid</code></em>, |
| <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> |
| <p>Tries to set the UNIX user identifier on <em class="parameter"><code>credentials</code></em> |
| . This method |
| is only available on UNIX platforms.</p> |
| <p>This operation can fail if <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> is not supported on the |
| OS or if the native credentials type does not contain information |
| about the UNIX user. It can also fail if the OS does not allow the |
| use of "spoofed" credentials.</p> |
| <div class="refsect3"> |
| <a name="g-credentials-set-unix-user.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>uid</p></td> |
| <td class="parameter_description"><p>The UNIX user identifier to set.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>error</p></td> |
| <td class="parameter_description"><p>Return location for error or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-credentials-set-unix-user.returns"></a><h4>Returns</h4> |
| <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>uid</code></em> |
| was set, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if error is set.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-credentials-get-unix-pid"></a><h3>g_credentials_get_unix_pid ()</h3> |
| <pre class="programlisting"><span class="returnvalue">pid_t</span> |
| g_credentials_get_unix_pid (<em class="parameter"><code><a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> *credentials</code></em>, |
| <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre> |
| <p>Tries to get the UNIX process identifier from <em class="parameter"><code>credentials</code></em> |
| . This |
| method is only available on UNIX platforms.</p> |
| <p>This operation can fail if <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> is not supported on the |
| OS or if the native credentials type does not contain information |
| about the UNIX process ID.</p> |
| <div class="refsect3"> |
| <a name="g-credentials-get-unix-pid.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>credentials</p></td> |
| <td class="parameter_description"><p>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>error</p></td> |
| <td class="parameter_description"><p>Return location for error or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-credentials-get-unix-pid.returns"></a><h4>Returns</h4> |
| <p> The UNIX process ID, or -1 if <em class="parameter"><code>error</code></em> |
| is set.</p> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-36.html#api-index-2.36">2.36</a></p> |
| </div> |
| </div> |
| <div class="refsect1"> |
| <a name="GCredentials.other_details"></a><h2>Types and Values</h2> |
| <div class="refsect2"> |
| <a name="GCredentials-struct"></a><h3>GCredentials</h3> |
| <pre class="programlisting">typedef struct _GCredentials GCredentials;</pre> |
| <p>The <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> structure contains only private data and |
| should only be accessed using the provided API.</p> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GCredentialsType"></a><h3>enum GCredentialsType</h3> |
| <p>Enumeration describing different kinds of native credential types.</p> |
| <div class="refsect3"> |
| <a name="GCredentialsType.members"></a><h4>Members</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="300px" class="enum_members_name"> |
| <col class="enum_members_description"> |
| <col width="200px" class="enum_members_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-CREDENTIALS-TYPE-INVALID:CAPS"></a>G_CREDENTIALS_TYPE_INVALID</p></td> |
| <td class="enum_member_description"> |
| <p>Indicates an invalid native credential type.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-CREDENTIALS-TYPE-LINUX-UCRED:CAPS"></a>G_CREDENTIALS_TYPE_LINUX_UCRED</p></td> |
| <td class="enum_member_description"> |
| <p>The native credentials type is a struct ucred.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-CREDENTIALS-TYPE-FREEBSD-CMSGCRED:CAPS"></a>G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED</p></td> |
| <td class="enum_member_description"> |
| <p>The native credentials type is a struct cmsgcred.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-CREDENTIALS-TYPE-OPENBSD-SOCKPEERCRED:CAPS"></a>G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED</p></td> |
| <td class="enum_member_description"> |
| <p>The native credentials type is a struct sockpeercred. Added in 2.30.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-CREDENTIALS-TYPE-SOLARIS-UCRED:CAPS"></a>G_CREDENTIALS_TYPE_SOLARIS_UCRED</p></td> |
| <td class="enum_member_description"> |
| <p>The native credentials type is a ucred_t. Added in 2.40.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="enum_member_name"><p><a name="G-CREDENTIALS-TYPE-NETBSD-UNPCBID:CAPS"></a>G_CREDENTIALS_TYPE_NETBSD_UNPCBID</p></td> |
| <td class="enum_member_description"> |
| <p>The native credentials type is a struct unpcbid.</p> |
| </td> |
| <td class="enum_member_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <p class="since">Since: <a class="link" href="api-index-2-26.html#api-index-2.26">2.26</a></p> |
| </div> |
| </div> |
| </div> |
| <div class="footer"> |
| <hr>Generated by GTK-Doc V1.25.1</div> |
| </body> |
| </html> |