1pam_get_user(3PAM) PAM Library Functions pam_get_user(3PAM)
2
3
4
6 pam_get_user - PAM routine to retrieve user name
7
9 cc [ flag ... ] file ... -lpam [ library ... ]
10 #include <security/pam_appl.h>
11
12
13
14 int pam_get_user(pam_handle_t *pamh, char **user,
15 const char *prompt);
16
17
19 The pam_get_user() function is used by PAM service modules to retrieve
20 the current user name from the PAM handle. If the user name has not
21 been set with pam_start() or pam_set_item(), the PAM conversation
22 function will be used to prompt the user for the user name with the
23 string "prompt". If prompt is NULL, then pam_get_item() is called and
24 the value of PAM_USER_PROMPT is used for prompting. If the value of
25 PAM_USER_PROMPT is NULL, the following default prompt is used:
26
27 Please enter user name:
28
29
30
31
32 After the user name is gathered by the conversation function,
33 pam_set_item() is called to set the value of PAM_USER. By convention,
34 applications that need to prompt for a user name should call
35 pam_set_item() and set the value of PAM_USER_PROMPT before calling
36 pam_authenticate(). The service module's pam_sm_authenticate() function
37 will then call pam_get_user() to prompt for the user name.
38
39
40 Note that certain PAM service modules, such as a smart card module,
41 may override the value of PAM_USER_PROMPT and pass in their own
42 prompt. Applications that call pam_authenticate() multiple times should
43 set the value of PAM_USER to NULL with pam_set_item() before calling
44 pam_authenticate(), if they want the user to be prompted for a new user
45 name each time. The value of user retrieved by pam_get_user() should
46 not be modified or freed. The item will be released by pam_end().
47
49 Upon success, pam_get_user() returns PAM_SUCCESS; otherwise it returns
50 an error code. Refer to pam(3PAM) for information on error related
51 return values.
52
54 See attributes(5) for description of the following attributes:
55
56
57
58
59 ┌─────────────────────────────┬─────────────────────────────┐
60 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
61 ├─────────────────────────────┼─────────────────────────────┤
62 │Interface Stability │ Stable │
63 ├─────────────────────────────┼─────────────────────────────┤
64 │MT-Level │MT-Safe with exceptions │
65 └─────────────────────────────┴─────────────────────────────┘
66
68 pam(3PAM), pam_authenticate(3PAM), pam_end(3PAM), pam_get_item(3PAM),
69 pam_set_item(3PAM), pam_sm(3PAM), pam_sm_authenticate(3PAM),
70 pam_start(3PAM), attributes(5)
71
73 The interfaces in libpam are MT-Safe only if each thread within the
74 multithreaded application uses its own PAM handle.
75
76
77
78SunOS 5.11 13 Oct 1998 pam_get_user(3PAM)