Previous section.

X/Open Single Sign-on Service (XSSO) -<br> Pluggable Authentication Modules

X/Open Single Sign-on Service (XSSO) -
Pluggable Authentication Modules
Copyright © 1997 The Open Group


pam_sm_authenticate - service provider implementation for pam_authenticate


#include <security/pam_appl.h>
#include <security/pam_modules.h>

int pam_sm_authenticate( pam_handle_t *pamh, int flags, int argc, const char **argv );


In response to a call to pam_authenticate(), the PAM framework calls pam_sm_authenticate() from the modules listed in the PAM configuration. The authentication provider supplies the back-end functionality for this interface function.

The function, pam_sm_authenticate(), is called to verify the identity of the current user. The user is usually required to enter a password or similar authentication token depending upon the authentication scheme configured within the system. The user in question is typically specified by a prior call to pam_start(), and is referenced by the authentication handle, pamh.

If the user is unknown to the authentication service, the service module should mask this error and continue to prompt the user for a password. It should then return the error, [PAM_USER_UNKNOWN].

Before returning, pam_sm_authenticate() should call pam_get_item() and retrieve PAM_AUTHTOK. If it has not been set before (that is, the value is NULL), pam_sm_authenticate() should set it to the password entered by the user using pam_set_item().

An authentication module may save the authentication status (success or reason for failure) as state in the authentication handle using pam_set_data(). This information is intended for use by pam_setcred().

Modules should not retry the authentication in the event of a failure. Applications handle authentication retries. To limit the number of retries, modules may maintain an internal retry count and return a [PAM_MAXTRIES] error.

The arguments for pam_sm_authenticate() are:

pamh (in)

The PAM authentication handle, obtained from a previous call to pam_start().

flags (in)

The following flags may be passed in to pam_sm_authenticate():


The authentication service should not generate any messages.


The authentication service should return [PAM_AUTH_ERR] if the user has a null authentication token.

argc (in)

The argc argument represents the number of module options defined in the PAM configuration.

argv (in)

Specifies the module options, which are interpreted and processed by the authentication module. Refer to the specific module manual pages for the various available options. If any unknown option is passed in, the module should log the error and ignore the option.


The following PAM status codes shall be returned:


Successful completion.


The user could not be authenticated.


No account for the present user.


Cannot access authentication data because of insufficient credentials.


Cannot retrieve authentication information.


Ignore underlying authentication module regardless of whether the control flag is required, optional, or sufficient.


Conversation failure.


Error in underlying service module.


The module can return this error to limit the number of retries.


The caller does not possess the required authority.


System error.


Memory buffer error.

[??] Some characters or strings that appear in the printed document are not easily representable using HTML.

Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.

Contents Next section Index