Debian Codegraph @

module.html

raw
1 <html>
2 <body>
3
4 <h2><a href="cvm.html">CVM</a></h2>
5
6 <h1>CVM Module Library</h1>
7
8 <p>To write a module using the CVM module library, you must provide
9 the following items:</p>
10
11 <dl>
12
13 <dt><tt>int cvm_module_init(void)</tt> <dd>This function is called once
14 when the CVM starts up.
15
16 <dt><tt>int cvm_module_lookup(void)</tt> <dd>This function is used to
17 retrieve the stored credentials for the named user. If the named user
18 does not exist, this function must return <tt>CVME_PERMFAIL</tt> (value
19 100). Before this function is called, the input request is read and the
20 account name is parsed into <tt>cvm_account_name</tt>, the domain name
21 into <tt>cvm_account_domain</tt>, and the credentials are parsed into
22 <tt>cvm_credentials</tt>.
23
24 <dt><tt>int cvm_module_authenticate(void)</tt> <dd>The main
25 authentication verification function. This function is not called when
26 the module is operating in lookup mode. If authentication fails, this
27 function must return <tt>CVME_PERMFAIL</tt> (value 100).
28
29 <dt><tt>int cvm_module_results(void)</tt> <dd>This function is used to
30 provide the lookup results to the client. All required facts must be
31 set by this function: <tt>cvm_fact_username</tt>,
32 <tt>cvm_fact_userid</tt>, <tt>cvm_fact_groupid</tt>,
33 <tt>cvm_fact_directory</tt>, and <tt>cvm_fact_shell</tt>. The following
34 facts may optional be set as well: <tt>cvm_fact_realname</tt>,
35 <tt>cvm_fact_groupname</tt>, <tt>cvm_fact_sys_username</tt>,
36 <tt>cvm_fact_sys_directory</tt>, and <tt>cvm_fact_domain</tt>. All of
37 these will be sent to the client automatically by the invoking module
38 framework, with the optional facts being sent only if they have been
39 set. If any other facts are to be returned to the client, send them in
40 this function with <tt>cvm_module_fact_str(unsigned number, const char*
41 data)</tt> or <tt>cvm_module_fact_uint(unsigned number, unsigned
42 data)</tt>.
43
44 <dt><tt>void cvm_module_stop(void)</tt> <dd>This routine is called once
45 when the CVM is shut down.
46
47 </dl>
48
49 <p>If any function fails due to a temporary error (read error, out of
50 memory, connection failed, etc), it must return a non-zero <a
51 href="errors.html">error code</a> (other than <tt>CVME_PERMFAIL</tt>).
52 Otherwise, return zero.</p>
53
54 <p>The credentials sent from the client are accessable through the
55 global <tt>cvm_credentials</tt> array (type <tt>str</tt>), which is
56 indexed by the credential type number.</p>
57
58 <p><b>NOTE:</b> The functions supplied by the module must never exit
59 except on fatal errors. If any memory is allocated in the course of
60 processing a request, it must either be freed or reallocated on the next
61 invocation.</p>
62
63 <p>Each module will implement at least one type of credential validation
64 (ie plain text, CRAM, etc). Modules are not obligated to implement
65 multiple types of validation, but may do so by examinimg which types of
66 credentials are present in the input. The invoker will choose which
67 modules to invoke depending on what type of credentials it needs
68 validated.</p>
69
70 </body>
71 </html>