CVM

CVM Client Library

The CVM client library defines the following functions:

int cvm_authenticate(const char* module, const char** credentials)

This is the main entry point to the library. Simply set up the account name and credentials as an array with a trailing NULL pointer and call authenticate. The function will return 0 if authentication succeeded and an error code otherwise.

If authentication succeeds, this routine automatically retrieves cvm_fact_username, cvm_fact_userid, cvm_fact_groupid, cvm_fact_directory, and cvm_fact_shell. cvm_fact_realname, cvm_fact_groupname, cvm_fact_sys_username, and cvm_fact_sys_directory are also set if they were present in the results.

int cvm_fact_str(int number, const char** data)

Retrieves a fact from the data returned by the module as a NUL-terminated string. Returns zero if the fact was present, and CVME_NOFACT otherwise. Successive calls to this function with the same number return subsequent facts if more than one instance of the fact was present.

int cvm_fact_uint(int number, unsigned long* data)

Retrieves a fact from the data returned by the module as an unsigned integer. Returns zero if the fact was present and was an unsigned integer. Returns CVME_BAD_MODDATA if the fact was present but was not an unsigned integer. Successive calls to this function with the same number return subsequent facts if more than one instance of the fact was present.