1PAM_GET_AUTHTOK(3) Linux-PAM Manual PAM_GET_AUTHTOK(3)
2
3
4
6 pam_get_authtok - get authentication token
7
9 #include <security/pam_ext.h>
10
11 int pam_get_authtok(pam_handle_t *pamh, int item, const char **authtok,
12 const char *prompt);
13
14 int pam_get_authtok_noverify(pam_handle_t *pamh, const char **authtok,
15 const char *prompt);
16
17 int pam_get_authtok_verify(pam_handle_t *pamh, const char **authtok,
18 const char *prompt);
19
21 The pam_get_authtok function returns the cached authentication token,
22 or prompts the user if no token is currently cached. It is intended for
23 internal use by Linux-PAM and PAM service modules. Upon successful
24 return, authtok contains a pointer to the value of the authentication
25 token. Note, this is a pointer to the actual data and should not be
26 free()´ed or over-written!
27
28 The prompt argument specifies a prompt to use if no token is cached. If
29 a NULL pointer is given, pam_get_authtok uses pre-defined prompts.
30
31 The following values are supported for item:
32
33 PAM_AUTHTOK
34 Returns the current authentication token. Called from
35 pam_sm_chauthtok(3) pam_get_authtok will ask the user to confirm
36 the new token by retyping it. If a prompt was specified, "Retype"
37 will be used as prefix.
38
39 PAM_OLDAUTHTOK
40 Returns the previous authentication token when changing
41 authentication tokens.
42
43 The pam_get_authtok_noverify function can only be used for changing the
44 password (from pam_sm_chauthtok(3)). It returns the cached
45 authentication token, or prompts the user if no token is currently
46 cached. The difference to pam_get_authtok is, that this function does
47 not ask a second time for the password to verify it. Upon successful
48 return, authtok contains a pointer to the value of the authentication
49 token. Note, this is a pointer to the actual data and should not be
50 free()´ed or over-written!
51
52 The pam_get_authtok_verify function can only be used to verify a
53 password for mistypes gotten by pam_get_authtok_noverify(3). This
54 function asks a second time for the password and verify it with the
55 password provided by authtok argument. In case of an error, the value
56 of authtok is undefined. Else this argument will point to the actual
57 data and should not be free()´ed or over-written!
58
60 pam_get_authtok honours the following module options:
61
62 try_first_pass
63 Before prompting the user for their password, the module first
64 tries the previous stacked module´s password in case that satisfies
65 this module as well.
66
67 use_first_pass
68 The argument use_first_pass forces the module to use a previous
69 stacked modules password and will never prompt the user - if no
70 password is available or the password is not appropriate, the user
71 will be denied access.
72
73 use_authtok
74 When password changing enforce the module to set the new token to
75 the one provided by a previously stacked password module. If no
76 token is available token changing will fail.
77
78 authtok_type=XXX
79 The default action is for the module to use the following prompts
80 when requesting passwords: "New UNIX password: " and "Retype UNIX
81 password: ". The example word UNIX can be replaced with this
82 option, by default it is empty.
83
85 PAM_AUTH_ERR
86 Authentication token could not be retrieved.
87
88 PAM_AUTHTOK_ERR
89 New authentication could not be retrieved.
90
91 PAM_SUCCESS
92 Authentication token was successfully retrieved.
93
94 PAM_SYSTEM_ERR
95 No space for an authentication token was provided.
96
97 PAM_TRY_AGAIN
98 New authentication tokens mismatch.
99
101 pam(8)
102
104 The pam_get_authtok function is a Linux-PAM extensions.
105
106
107
108Linux-PAM Manual 11/10/2009 PAM_GET_AUTHTOK(3)