ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/authsys_create.htm

258 lines
6.0 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>authsys_create()--Create Authentication with OS Permission</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- RPCMST SCRIPT A converted by B2H R4.1 (346) (CMS) by PMHALL at -->
<!-- RCHVMW2 on 7 Oct 1998 at 23:43:14 -->
<!-- YYMMDD USERID Change description -->
<!-- Edited by Kersten Feb 02 -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--Java sync-link-->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<a name="Top_Of_Page"></a>
<h2>authsys_create()--Create Authentication with OS Permission</h2>
<div class="box" style="width: 70%;">
<br>
&nbsp;&nbsp;Syntax<br>
<!-- iddvc RMBR -->
<br>
<pre>
#include &lt;rpc/rpc.h&gt;
AUTH *authsys_create(const char *<em>host</em>,
const uid_t <em>uid</em>,
const gid_t <em>gid</em>,
const int <em>len</em>,
const gid_t *<em>aup_gids</em>);
</pre>
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Service Program Name: QZNFTRPC<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: No<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>authsys_create()</strong> function creates and returns an RPC
authentication handle that contains authentication information.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>host</strong> &nbsp;(Input)&nbsp;</dt>
<dd>A pointer to the name of the machine on which the permission was
created.<br><br></dd>
<dt><strong>uid</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The caller's effective user ID (UID).<br><br></dd>
<dt><strong>gid</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The caller's effective group ID (GID).<br><br></dd>
<dt><strong>len</strong> &nbsp;(Input)&nbsp;</dt>
<dd>The length of the group's array.<br><br></dd>
<dt><strong>aup_gids</strong> &nbsp;(Input)&nbsp;</dt>
<dd>A pointer to the counted array of groups to which the user belongs.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td valign="top"><em>auth</em></td>
<td valign="top">Upon successful completion, this API returns an RPC
authentication handle.</td>
</tr>
<tr>
<td valign="top"><em>NULL</em></td>
<td valign="top"><strong>authsys_create()</strong> was not successful. The
<em>errno</em> variable is set to indicate the reason.</td>
</tr>
</table>
<br>
<br>
<h3>Error Conditions</h3>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td valign="top"><em>[EINVAL]</em></td>
<td valign="top">An invalid <em>len</em> parameter was passed.</td>
</tr>
<tr>
<td valign="top"><em>[ENOMEM]</em></td>
<td valign="top">Storage allocation failed.</td>
</tr>
<tr>
<td valign="top"><em>[EUNKNOWN]</em></td>
<td valign="top">Unknown system state.</td>
</tr>
</table>
<br>
<br>
<h3>Error Messages</h3>
<table cellpadding="5" width="100%">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td width="15%" valign="top">CPIA1B0 I</td>
<td width="85%" valign="top">An authentication problem was encountered by one
of the TI-RPC APIs.</td>
</tr>
<tr>
<td valign="top">CPDA1C1 D</td>
<td valign="top">An authentication problem has occurred.</td>
</tr>
<tr>
<td valign="top">CPE3418 E</td>
<td valign="top">Possible APAR condition or hardware failure.</td>
</tr>
<tr>
<td valign="top">CPF3CF2 E</td>
<td valign="top">Error(s) occurred during running of &amp;1 API.</td>
</tr>
<tr>
<td valign="top">CPF9872 E</td>
<td valign="top">Program or service program &amp;1 in library &amp;2 ended.
Reason code &amp;3.</td>
</tr>
</table>
<br>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="authnone_create.htm">authnone_create()--Create Null
Authentication</a></li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example shows how <strong>authsys_create()</strong> is
used:</p>
<pre>
#include &lt;stdio.h&gt;
#include &lt;rpc/rpc.h&gt;
/* Define remote program number and version */
#define RMTPROGNUM (u_long)0x3fffffffL
#define RMTPROGVER (u_long)0x1
main()
{
CLIENT *client; /* The client handle */
char *host;
uid_t uid;
gid_t gid, *aup_gids;
int len;
/* Service request to host RPCSERVER_HOST */
client = clnt_create(&quot;RPCSERVER_HOST&quot;, RMTPROGNUM, RMTPROGVER,
&quot;tcp&quot;);
if (client == (CLIENT *)NULL) {
printf(&quot;Could not create client\n&quot;);
exit(1);
}
...
uid = geteuid();
gid = getegid();
len = getgroups(NGRPS, aup_gids));
/* Initialized the <strong>authsys_create()</strong>'s arguments before use */
client-&gt;cl_auth = <strong>authsys_create</strong>(host, uid, gid,
len, aup_gids);
if (client-&gt;cl_auth == (AUTH *)NULL) {
fprintf(stderr, &quot;<strong>authsys_create</strong> failed!!\n&quot;);
exit(1);
}
...
}
</pre>
<hr>
API introduced: V4R2
<hr>
<table cellpadding="2" cellspacing="2" align="center">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"rpc1.htm">Remote Procedure Call (RPC) APIs</a> | <a href="aplist.htm">APIs by
category</a></td>
</tr>
</table>
</body>
</html>