---
name: "pam_end"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/pam_end"
---

# pam\_end(3)

terminate the PAM transaction

## NAME

**pam\_end** – terminate the PAM transaction

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<security/pam\_appl.h\>**

*int*\

**pam\_end**(*pam\_handle\_t \*pamh*, *int status*);

## DESCRIPTION

The **pam\_end**() function terminates a PAM transaction and destroys the corresponding PAM context, releasing all resources allocated to it.

The *status* argument should be set to the error code returned by the last API call before the call to **pam\_end**().

## RETURN VALUES

The **pam\_end**() function returns one of the following values:

- \[PAM\_SUCCESS\]

  Success.

- \[PAM\_BAD\_HANDLE\]

  Invalid PAM handle.

## SEE ALSO

[pam(3)](/pam/3.md), [pam\_strerror(3)](/pam_strerror/3.md)

## STANDARDS

*X/Open Single Sign-On Service (XSSO) - Pluggable Authentication Modules*, June 1997.

## AUTHORS

The **pam\_end**() function and this manual page were developed for the FreeBSD Project by ThinkSec AS and Network Associates Laboratories, the Security Research Division of Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (“CBOSS”), as part of the DARPA CHATS research program.

The OpenPAM library is maintained by Dag-Erling Smørgrav ⟨*des@des.dev*⟩.
