pamfunc
Test Pluggable Authentication Module (PAM) configuration
TLDR
Apply the specified arithmetic function with n as the second argument to each sample in the specified PAM image
Apply the specified bit string function with n as the second argument to each sample in the specified PAM image
SYNOPSIS
pamfunc [-h] [-s] function-name
PARAMETERS
-h, --help
Display usage summary and exit
-s, --synopsis
Output only function synopsis line (for shell completion)
DESCRIPTION
pamfunc is a utility in the Linux-PAM package that creates boilerplate C code skeletons for PAM (Pluggable Authentication Modules) service module functions. PAM provides a flexible, pluggable framework for authentication, account management, session handling, and password services on Linux and Unix-like systems.
Developers use pamfunc to quickly generate standardized function templates, such as pam_sm_authenticate, pam_sm_acct_mgmt, or pam_sm_open_func. The output includes necessary #include directives, the function prototype with correct parameters (like pam_handle_t *, const char *, etc.), return type (int), and basic structure with PAM_SUCCESS and error handling stubs marked for customization.
This tool accelerates PAM module development by enforcing API compliance and reducing errors from manual coding. Output is sent to stdout, so users typically redirect it to files and combine multiple functions into a complete module source, then compile with PAM headers.
CAVEATS
Always redirects output to files (e.g., pamfunc func > file.c); provides minimal skeleton only—requires manual implementation of logic, error handling, and full module assembly with Makefile.
EXAMPLE USAGE
pamfunc pam_sm_authenticate > auth.c
pamfunc -s pam_sm_setcred
SUPPORTED FUNCTIONS
Common: pam_sm_authenticate, pam_sm_acct_mgmt, pam_sm_open_func, pam_sm_close_func, pam_sm_chauthtok. Run pamfunc -h for full list.
HISTORY
Introduced in Linux-PAM 0.76 (2002) by Dmitry V. Levin as part of the open-source PAM project, evolving with PAM API standards for easier module authoring.
SEE ALSO
pam(8), pamtester(8), pam_modules(8)


