CVM

CVM Module Library

To write a module using the CVM module library, you must provide three items:

const unsigned credential_count
Set this global to the number of credentials required from the client.
const char* credentials[X], where X is the same as credential_count above
Pointers to the credentials read from the client are stored in this array.
int authenticate(void)
The main authentication verification routine.
Before authenticate() is called, the input data stream is read and the account name is parsed into account_name and the credentials are parsed into credentials. The service name is also available as service_name.

If authentication fails, the module must return CVME_PERMFAIL (value 100). If there was a temporary error, return any other non-zero number error code. Otherwise, return zero after setting fact_username, fact_userid, fact_groupid, fact_directory, and fact_shell, which will be automatically sent to the client when authenticate() completes. fact_realname, fact_groupname, fact_sys_username, and fact_sys_directory will also be sent if they are set. If any other facts are to be returned to the client, send them with fact_str(int number, const char* data) or fact_uint(int number, unsigned data).

NOTE: authenticate() must never exit except on fatal errors. If it allocates any memory, it must either be freed, or reallocated on the next invocation.