1.\" Generated from pam_getenvlist.c by gendoc.pl
2.Dd June 27, 2023
3.Dt PAM_GETENVLIST 3
4.Os
5.Sh NAME
6.Nm pam_getenvlist
7.Nd returns a list of all the PAM environment variables
8.Sh SYNOPSIS
9.In sys/types.h
10.In security/pam_appl.h
11.Ft "char **"
12.Fn pam_getenvlist "pam_handle_t *pamh"
13.Sh DESCRIPTION
14The
15.Fn pam_getenvlist
16function returns a copy of the given PAM context's
17environment list as a pointer to an array of strings.
18The last element in the array is
19.Dv NULL .
20The pointer is suitable for assignment to
21.Va environ .
22.Pp
23The array and the strings it lists are allocated using
24.Xr malloc 3 ,
25and
26should be released using
27.Xr free 3
28after use:
29.Pp
30.Bd -literal
31    char **envlist, **env;
32
33    envlist = environ;
34    environ = pam_getenvlist(pamh);
35    /* do something nifty */
36    for (env = environ; *env != NULL; env++)
37        free(*env);
38    free(environ);
39    environ = envlist;
40.Ed
41.Sh RETURN VALUES
42The
43.Fn pam_getenvlist
44function returns
45.Dv NULL
46on failure.
47.Sh SEE ALSO
48.Xr free 3 ,
49.Xr malloc 3 ,
50.Xr pam 3 ,
51.Xr pam_getenv 3 ,
52.Xr pam_putenv 3 ,
53.Xr pam_setenv 3 ,
54.Xr environ 7
55.Sh STANDARDS
56.Rs
57.%T "X/Open Single Sign-On Service (XSSO) - Pluggable Authentication Modules"
58.%D "June 1997"
59.Re
60.Sh AUTHORS
61The
62.Fn pam_getenvlist
63function and this manual page were
64developed for the
65.Fx
66Project by ThinkSec AS and Network Associates Laboratories, the
67Security Research Division of Network Associates, Inc.\& under
68DARPA/SPAWAR contract N66001-01-C-8035
69.Pq Dq CBOSS ,
70as part of the DARPA CHATS research program.
71.Pp
72The OpenPAM library is maintained by
73.An Dag-Erling Sm\(/orgrav Aq Mt des@des.no .
74