logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

pam_get_user - get user name

Description

The pam_get_user function returns the name of the user specified by pam_start(3). If no user was specified it returns what pam_get_item(pamh,PAM_USER,...); would have returned. If this is NULL it obtains the username via the pam_conv(3) mechanism, it prompts the user with the first non-NULL string in the following list: • The prompt argument passed to the function. • What is returned by pam_get_item (pamh, PAM_USER_PROMPT, ... ); • The default prompt: "login: " By whatever means the username is obtained, a pointer to it is returned as the contents of *user. Note, this memory should not be free()'d or modified by the module. This function sets the PAM_USER item associated with the pam_set_item(3) and pam_get_item(3) functions.

Name

pam_get_user - get user name

Return Values

PAM_SUCCESS User name was successful retrieved. PAM_SYSTEM_ERR A NULL pointer was submitted. PAM_CONV_ERR The conversation method supplied by the application failed to obtain the username. PAM_BUF_ERR Memory buffer error. PAM_ABORT Error resuming an old conversation. PAM_CONV_AGAIN The conversation method supplied by the application is waiting for an event.

See Also

pam_end(3), pam_get_item(3), pam_set_item(3), pam_strerror(3) Linux-PAM 07/03/2025 PAM_GET_USER(3)

Synopsis

#include<security/pam_modules.h>intpam_get_user(constpam_handle_t*pamh,constchar**user,constchar*prompt);

See Also