1pam_open_session(3PAM) PAM Library Functions pam_open_session(3PAM)
2
3
4
6 pam_open_session, pam_close_session - perform PAM session creation and
7 termination operations
8
10 cc [ flag ... ] file ... -lpam [ library ... ]
11 #include <security/pam_appl.h>
12
13
14
15 int pam_open_session(pam_handle_t *pamh, int flags);
16
17
18 int pam_close_session(pam_handle_t *pamh, int flags);
19
20
22 The pam_open_session() function is called after a user has been suc‐
23 cessfully authenticated. See pam_authenticate(3PAM) and
24 pam_acct_mgmt(3PAM). It is used to notify the session modules that a
25 new session has been initiated. All programs that use the pam(3PAM)
26 library should invoke pam_open_session() when beginning a new session.
27 Upon termination of this activity, pam_close_session() should be
28 invoked to inform pam(3PAM) that the session has terminated.
29
30
31 The pamh argument is an authentication handle obtained by a prior call
32 to pam_start(). The following flag may be set in the flags field for
33 pam_open_session() and pam_close_session():
34
35 PAM_SILENT The session service should not generate any messages.
36
37
39 Upon successful completion, PAM_SUCCESS is returned. In addition to
40 the return values defined in pam(3PAM), the following value may be
41 returned on error:
42
43 PAM_SESSION_ERR Cannot make or remove an entry for the specified
44 session.
45
46
48 See attributes(5) for description of the following attributes:
49
50
51
52
53 ┌─────────────────────────────┬─────────────────────────────┐
54 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
55 ├─────────────────────────────┼─────────────────────────────┤
56 │Interface Stability │ Stable │
57 ├─────────────────────────────┼─────────────────────────────┤
58 │MT-Level │MT-Safe with exceptions │
59 └─────────────────────────────┴─────────────────────────────┘
60
62 getutxent(3C), pam(3PAM), pam_acct_mgmt(3PAM), pam_authenticate(3PAM),
63 pam_start(3PAM), attributes(5)
64
66 In many instances, the pam_open_session() and pam_close_session() calls
67 may be made by different processes. For example, in UNIX the login
68 process opens a session, while the init process closes the session. In
69 this case, UTMP/WTMP entries may be used to link the call to
70 pam_close_session() with an earlier call to pam_open_session(). This is
71 possible because UTMP/WTMP entries are uniquely identified by a combi‐
72 nation of attributes, including the user login name and device name,
73 which are accessible through the PAM handle, pamh. The call to
74 pam_open_session() should precede UTMP/WTMP entry management, and the
75 call to pam_close_session() should follow UTMP/WTMP exit management.
76
77
78 The interfaces in libpam are MT-Safe only if each thread within the
79 multithreaded application uses its own PAM handle.
80
81
82
83SunOS 5.11 13 Oct 1998 pam_open_session(3PAM)