# phpman > man > PAM_END(3)

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



## NAME
       pam_end - termination of PAM transaction

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

       **int** **pam**___**end(pam**___**handle**___**t** *****_pamh_**,** **int** _pam_status_**);**

## DESCRIPTION
       The **pam**___**end** function terminates the PAM transaction and is the last function an application
       should call in the PAM context. Upon return the handle _pamh_ is no longer valid and all memory
       associated with it will be invalid.

       The _pam_status_ argument should be set to the value returned to the application by the last
       PAM library call.

       The value taken by _pam_status_ is used as an argument to the module specific callback
       function, **cleanup()** (See **pam**___**set**___**[data**(3)](https://www.chedong.com/phpMan.php/man/data/3/markdown) and **pam**___**get**___**[data**(3)](https://www.chedong.com/phpMan.php/man/data/3/markdown)). In this way the module can be
       given notification of the pass/fail nature of the tear-down process, and perform any last
       minute tasks that are appropriate to the module before it is unlinked. This argument can be
       logically OR'd with _PAM_DATA_SILENT_ to indicate to indicate that the module should not treat
       the call too seriously. It is generally used to indicate that the current closing of the
       library is in a [**fork**(2)](https://www.chedong.com/phpMan.php/man/fork/2/markdown)ed process, and that the parent will take care of cleaning up things
       that exist outside of the current process space (files etc.).

       This function _free_'s all memory for items associated with the **pam**___**set**___**[item**(3)](https://www.chedong.com/phpMan.php/man/item/3/markdown) and
       **pam**___**get**___**[item**(3)](https://www.chedong.com/phpMan.php/man/item/3/markdown) functions. Pointers associated with such objects are not valid anymore after
       **pam**___**end** was called.

## RETURN VALUES
       PAM_SUCCESS
           Transaction was successful terminated.

       PAM_SYSTEM_ERR
           System error, for example a NULL pointer was submitted as PAM handle or the function was
           called by a module.

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



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