File: module.html

package info (click to toggle)
cvm 0.11-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 492 kB
  • ctags: 215
  • sloc: ansic: 1,777; makefile: 48; sh: 12
file content (46 lines) | stat: -rw-r--r-- 1,928 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<body>

<h2><a href="cvm.html">CVM</a></h2>

<h1>CVM Module Library</h1>

<p>To write a module using the CVM module library, you must provide
the following items:<dl>

<dt><tt>const unsigned cvm_credential_count</tt> <dd>Set this global
to the number of credentials required from the client.

<dt><tt>const char* cvm_credentials[X]</tt>, where X is the same as
<tt>credential_count</tt> above <dd>Pointers to the credentials read
from the client are stored in this array.

<dt><tt>int cvm_auth_init(void)</tt> <dd>This routine is called once
when the CVM starts up.

<dt><tt>int cvm_authenticate(void)</tt> <dd>The main authentication
verification routine.

</dl>
Before <tt>cvm_authenticate()</tt> is called, the input data stream is
read and the account name is parsed into <tt>cvm_account_name</tt>,
the domain name into <tt>cvm_account_domain</tt>, and the credentials
are parsed into <tt>cvm_credentials</tt>.</p>

<p>If authentication fails, the module must return
<tt>CVME_PERMFAIL</tt> (value 100).  If there was a temporary error,
return any other non-zero number <a href="errors.html">error code</a>.
Otherwise, return zero after setting <tt>cvm_fact_username</tt>,
<tt>cvm_fact_userid</tt>, <tt>cvm_fact_groupid</tt>,
<tt>cvm_fact_directory</tt>, and <tt>cvm_fact_shell</tt>, which will
be automatically sent to the client when <tt>authenticate()</tt>
completes.  <tt>cvm_fact_realname</tt>, <tt>cvm_fact_groupname</tt>,
<tt>cvm_fact_sys_username</tt>, <tt>cvm_fact_sys_directory</tt>, and
<tt>cvm_fact_domain</tt> will also be sent if they are set.  If any
other facts are to be returned to the client, send them with
<tt>cvm_fact_str(int number, const char* data)</tt> or
<tt>cvm_fact_uint(int number, unsigned data)</tt>.</p>

<p><b>NOTE:</b> <tt>cvm_authenticate()</tt> must never exit except on
fatal errors.  If it allocates any memory, it must either be freed or
reallocated on the next invocation.</p>