# phpman > man > pam_get_item(3)

[PAM_GET_ITEM(3)](https://www.chedong.com/phpMan.php/man/PAMGETITEM/3/markdown)                           Linux-PAM Manual                           [PAM_GET_ITEM(3)](https://www.chedong.com/phpMan.php/man/PAMGETITEM/3/markdown)



## NAME
       pam_get_item - getting PAM information

## SYNOPSIS
       **#include** **<security/pam**___**modules.h>**

       **int** **pam**___**get**___**item(const** **pam**___**handle**___**t** *****_pamh_**,** **int** _item_type_**,** **const** **void** ******_item_**);**

## DESCRIPTION
       The **pam**___**get**___**item** function allows applications and PAM service modules to access and retrieve
       PAM information of _item_type_. Upon successful return, _item_ contains a pointer to the value of
       the corresponding item. Note, this is a pointer to the _actual_ data and should **not** be
       _free()_'ed or over-written! The following values are supported for _item_type_:

       PAM_SERVICE
           The service name (which identifies that PAM stack that the PAM functions will use to
           authenticate the program).

       PAM_USER
           The username of the entity under whose identity service will be given. That is, following
           authentication, _PAM_USER_ identifies the local entity that gets to use the service. Note,
           this value can be mapped from something (eg., "anonymous") to something else (eg.
           "guest119") by any module in the PAM stack. As such an application should consult the
           value of _PAM_USER_ after each call to a PAM function.

       PAM_USER_PROMPT
           The string used when prompting for a user's name. The default value for this string is a
           localized version of "login: ".

       PAM_TTY
           The terminal name: prefixed by /dev/ if it is a device file; for graphical, X-based,
           applications the value for this item should be the _$DISPLAY_ variable.

       PAM_RUSER
           The requesting user name: local name for a locally requesting user or a remote user name
           for a remote requesting user.

           Generally an application or module will attempt to supply the value that is most strongly
           authenticated (a local account before a remote one. The level of trust in this value is
           embodied in the actual authentication stack associated with the application, so it is
           ultimately at the discretion of the system administrator.

           _PAM_RUSER@PAM_RHOST_ should always identify the requesting user. In some cases, _PAM_RUSER_
           may be NULL. In such situations, it is unclear who the requesting entity is.

       PAM_RHOST
           The requesting hostname (the hostname of the machine from which the _PAM_RUSER_ entity is
           requesting service). That is _PAM_RUSER@PAM_RHOST_ does identify the requesting user. In
           some applications, _PAM_RHOST_ may be NULL. In such situations, it is unclear where the
           authentication request is originating from.

       PAM_AUTHTOK
           The authentication token (often a password). This token should be ignored by all module
           functions besides **pam**___**sm**___**[authenticate**(3)](https://www.chedong.com/phpMan.php/man/authenticate/3/markdown) and **pam**___**sm**___**[chauthtok**(3)](https://www.chedong.com/phpMan.php/man/chauthtok/3/markdown). In the former function
           it is used to pass the most recent authentication token from one stacked module to
           another. In the latter function the token is used for another purpose. It contains the
           currently active authentication token.

       PAM_OLDAUTHTOK
           The old authentication token. This token should be ignored by all module functions except
           **pam**___**sm**___**[chauthtok**(3)](https://www.chedong.com/phpMan.php/man/chauthtok/3/markdown).

       PAM_CONV
           The pam_conv structure. See **pam**___**[conv**(3)](https://www.chedong.com/phpMan.php/man/conv/3/markdown).

       The following additional items are specific to Linux-PAM and should not be used in portable
       applications:

       PAM_FAIL_DELAY
           A function pointer to redirect centrally managed failure delays. See **pam**___**fail**___**[delay**(3)](https://www.chedong.com/phpMan.php/man/delay/3/markdown).

       PAM_XDISPLAY
           The name of the X display. For graphical, X-based applications the value for this item
           should be the _$DISPLAY_ variable. This value may be used independently of _PAM_TTY_ for
           passing the name of the display.

       PAM_XAUTHDATA
           A pointer to a structure containing the X authentication data required to make a
           connection to the display specified by _PAM_XDISPLAY_, if such information is necessary.
           See **pam**___**xauth**___**[data**(3)](https://www.chedong.com/phpMan.php/man/data/3/markdown).

       PAM_AUTHTOK_TYPE
           The default action is for the module to use the following prompts when requesting
           passwords: "New UNIX password: " and "Retype UNIX password: ". The example word _UNIX_ can
           be replaced with this item, by default it is empty. This item is used by
           **pam**___**get**___**[authtok**(3)](https://www.chedong.com/phpMan.php/man/authtok/3/markdown).

       If a service module wishes to obtain the name of the user, it should not use this function,
       but instead perform a call to **pam**___**get**___**[user**(3)](https://www.chedong.com/phpMan.php/man/user/3/markdown).

       Only a service module is privileged to read the authentication tokens, PAM_AUTHTOK and
       PAM_OLDAUTHTOK.

## RETURN VALUES
       PAM_BAD_ITEM
           The application attempted to set an undefined or inaccessible item.

       PAM_BUF_ERR
           Memory buffer error.

       PAM_PERM_DENIED
           The value of _item_ was NULL.

       PAM_SUCCESS
           Data was successful updated.

       PAM_SYSTEM_ERR
           The _pam_handle_t_ passed as first argument was invalid.

## SEE ALSO
       **pam**___**set**___**[item**(3)](https://www.chedong.com/phpMan.php/man/item/3/markdown), **pam**___**[strerror**(3)](https://www.chedong.com/phpMan.php/man/strerror/3/markdown)



Linux-PAM Manual                             06/08/2020                              [PAM_GET_ITEM(3)](https://www.chedong.com/phpMan.php/man/PAMGETITEM/3/markdown)
