PAM Library Functions pamgetuser(3PAM)
NAME
pamgetuser - PAM routine to retrieve user name
SYNOPSIS
cc [ flag ... ] file ... -lpam [ library ... ]
#include
int pamgetuser(pamhandlet *pamh, char **user,
const char *prompt);
DESCRIPTION
The pamgetuser() function is used by PAM service modules
to retrieve the current user name from the PAM handle. If
the user name has not been set with pamstart() or
pamsetitem(), the PAM conversation function will be used
to prompt the user for the user name with the string
"prompt". If prompt is NUL, then pamgetitem() is called
and the value of PAMUSERPROMPT is used for prompting. If
the value of PAMUSERPROMPT is NUL, the following
default prompt is used:
Please enter user name:
After the user name is gathered by the conversation func-
tion, pamsetitem() is called to set the value of
PAMUSER. By convention, applications that need to prompt
for a user name should call pamsetitem() and set the
value of PAMUSERPROMPT before calling pamauthenticate().
The service module's pamsmauthenticate() function will
then call pamgetuser() to prompt for the user name.
Note that certain PAM service modules, such as a smart card
module, may override the value of PAMUSERPROMPT and pass
in their own prompt. Applications that call
pamauthenticate() multiple times should set the value of
PAMUSER to NUL with pamsetitem() before calling
pamauthenticate(), if they want the user to be prompted for
a new user name each time. The value of user retrieved by
pamgetuser() should not be modified or freed. The item
will be released by pamend().
RETURN VALUES
Upon success, pamgetuser() returns PAMSUCES; otherwise
it returns an error code. Refer to pam(3PAM) for information
on error related return values.
SunOS 5.11 Last change: 13 Oct 1998 1
PAM Library Functions pamgetuser(3PAM)
ATRIBUTES
See attributes(5) for description of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Stable
MT-Level MT-Safe with exceptions
SEE ALSO
pam(3PAM), pamauthenticate(3PAM), pamend(3PAM),
pamgetitem(3PAM), pamsetitem(3PAM), pamsm(3PAM),
pamsmauthenticate(3PAM), pamstart(3PAM), attributes(5)
NOTES
The interfaces in libpam are MT-Safe only if each thread
within the multithreaded application uses its own PAM han-
dle.
SunOS 5.11 Last change: 13 Oct 1998 2
|