pam_get_item(3) — Linux manual page


PAM_GET_ITEM(3)               Linux-PAM Manual               PAM_GET_ITEM(3)

NAME         top

       pam_get_item - getting PAM informations

SYNOPSIS         top

       #include <security/pam_modules.h>

       int pam_get_item(const pam_handle_t *pamh, int item_type,
                        const void **item);

DESCRIPTION         top

       The pam_get_item function allows applications and PAM service modules
       to access and retrieve PAM informations 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

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

           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.

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

           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.

           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.

           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.

           The authentication token (often a password). This token should be
           ignored by all module functions besides pam_sm_authenticate(3)
           and pam_sm_chauthtok(3). 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.

           The old authentication token. This token should be ignored by all
           module functions except pam_sm_chauthtok(3).

           The pam_conv structure. See pam_conv(3).

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

           A function pointer to redirect centrally managed failure delays.
           See pam_fail_delay(3).

           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.

           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

           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

       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).

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

RETURN VALUES         top

           The application attempted to set an undefined or inaccessible

           Memory buffer error.

           The value of item was NULL.

           Data was successful updated.

           The pam_handle_t passed as first argument was invalid.

SEE ALSO         top

       pam_set_item(3), pam_strerror(3)

COLOPHON         top

       This page is part of the linux-pam (Pluggable Authentication Modules
       for Linux) project.  Information about the project can be found at 
       ⟨⟩.  If you have a bug report for this manual
       page, see ⟨//⟩.  This page was obtained from the
       tarball Linux-PAM-1.3.0.tar.bz2 fetched from
       ⟨⟩ on 2020-09-18.  If you discover
       any rendering problems in this HTML version of the page, or you
       believe there is a better or more up-to-date source for the page, or
       you have corrections or improvements to the information in this
       COLOPHON (which is not part of the original manual page), send a mail

Linux-PAM Manual                 04/01/2016                  PAM_GET_ITEM(3)

Pages that refer to this page: pam(3)pam_authenticate(3)pam_chauthtok(3)pam_conv(3)pam_end(3)pam_fail_delay(3)pam_get_user(3)pam_set_item(3)pam_start(3)pam_xauth_data(3)access.conf(5)