To write a module using the CVM module library, you must provide a single routine, void authenticate(void). Before this routine is called, the input data stream is read and the account name is parsed into account_name. The service name is also available as service_name. To retrieve the next credential from the input data, call const char* cred_string(void). This routine will terminate the module if no more credentials are available.
If authentication fails, the module must exit 100. If there was a temporary error, exit 111. Otherwise, set 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).