xref: /freebsd/contrib/openpam/doc/man/pam_conv.3 (revision 3ba4c8c81a28de3e00ccf6d7f92c6f8e58bef456)
1ee02aaa9SDag-Erling Smørgrav.\"-
231c521e9SDag-Erling Smørgrav.\" Copyright (c) 2002-2003 Networks Associates Technology, Inc.
349e56509SDag-Erling Smørgrav.\" Copyright (c) 2004-2017 Dag-Erling Smørgrav
4ee02aaa9SDag-Erling Smørgrav.\" All rights reserved.
5ee02aaa9SDag-Erling Smørgrav.\"
6ee02aaa9SDag-Erling Smørgrav.\" This software was developed for the FreeBSD Project by ThinkSec AS and
7ee02aaa9SDag-Erling Smørgrav.\" Network Associates Laboratories, the Security Research Division of
8ee02aaa9SDag-Erling Smørgrav.\" Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
9ee02aaa9SDag-Erling Smørgrav.\" ("CBOSS"), as part of the DARPA CHATS research program.
10ee02aaa9SDag-Erling Smørgrav.\"
11ee02aaa9SDag-Erling Smørgrav.\" Redistribution and use in source and binary forms, with or without
12ee02aaa9SDag-Erling Smørgrav.\" modification, are permitted provided that the following conditions
13ee02aaa9SDag-Erling Smørgrav.\" are met:
14ee02aaa9SDag-Erling Smørgrav.\" 1. Redistributions of source code must retain the above copyright
15ee02aaa9SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer.
16ee02aaa9SDag-Erling Smørgrav.\" 2. Redistributions in binary form must reproduce the above copyright
17ee02aaa9SDag-Erling Smørgrav.\"    notice, this list of conditions and the following disclaimer in the
18ee02aaa9SDag-Erling Smørgrav.\"    documentation and/or other materials provided with the distribution.
19ee02aaa9SDag-Erling Smørgrav.\" 3. The name of the author may not be used to endorse or promote
20ee02aaa9SDag-Erling Smørgrav.\"    products derived from this software without specific prior written
21ee02aaa9SDag-Erling Smørgrav.\"    permission.
22ee02aaa9SDag-Erling Smørgrav.\"
23ee02aaa9SDag-Erling Smørgrav.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24ee02aaa9SDag-Erling Smørgrav.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ee02aaa9SDag-Erling Smørgrav.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ee02aaa9SDag-Erling Smørgrav.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27ee02aaa9SDag-Erling Smørgrav.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ee02aaa9SDag-Erling Smørgrav.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ee02aaa9SDag-Erling Smørgrav.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ee02aaa9SDag-Erling Smørgrav.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ee02aaa9SDag-Erling Smørgrav.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ee02aaa9SDag-Erling Smørgrav.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ee02aaa9SDag-Erling Smørgrav.\" SUCH DAMAGE.
34ee02aaa9SDag-Erling Smørgrav.\"
35*3ba4c8c8SDag-Erling Smørgrav.Dd June 27, 2023
36ee02aaa9SDag-Erling Smørgrav.Dt PAM_CONV 3
37ee02aaa9SDag-Erling Smørgrav.Os
38ee02aaa9SDag-Erling Smørgrav.Sh NAME
39ee02aaa9SDag-Erling Smørgrav.Nm pam_conv
40ee02aaa9SDag-Erling Smørgrav.Nd PAM conversation system
41ee02aaa9SDag-Erling Smørgrav.Sh LIBRARY
42ee02aaa9SDag-Erling Smørgrav.Lb libpam
43ee02aaa9SDag-Erling Smørgrav.Sh SYNOPSIS
44ee02aaa9SDag-Erling Smørgrav.In security/pam_appl.h
45ee02aaa9SDag-Erling Smørgrav.Bd -literal
46ee02aaa9SDag-Erling Smørgravstruct pam_message {
47ee02aaa9SDag-Erling Smørgrav	int      msg_style;
48ee02aaa9SDag-Erling Smørgrav	char    *msg;
49ee02aaa9SDag-Erling Smørgrav};
50ee02aaa9SDag-Erling Smørgrav
51ee02aaa9SDag-Erling Smørgravstruct pam_response {
52ee02aaa9SDag-Erling Smørgrav	char    *resp;
53ee02aaa9SDag-Erling Smørgrav	int      resp_retcode;
54ee02aaa9SDag-Erling Smørgrav};
55ee02aaa9SDag-Erling Smørgrav
56ee02aaa9SDag-Erling Smørgravstruct pam_conv {
57ee02aaa9SDag-Erling Smørgrav	int     (*conv)(int, const struct pam_message **,
58ee02aaa9SDag-Erling Smørgrav	    struct pam_response **, void *);
59ee02aaa9SDag-Erling Smørgrav	void    *appdata_ptr;
60ee02aaa9SDag-Erling Smørgrav};
61ee02aaa9SDag-Erling Smørgrav.Ed
62ee02aaa9SDag-Erling Smørgrav.Sh DESCRIPTION
63ee02aaa9SDag-Erling SmørgravThe PAM library uses an application-defined callback to communicate
64ee02aaa9SDag-Erling Smørgravwith the user.
65ee02aaa9SDag-Erling SmørgravThis callback is specified by the
66ee02aaa9SDag-Erling Smørgrav.Vt struct pam_conv
67ee02aaa9SDag-Erling Smørgravpassed to
68ee02aaa9SDag-Erling Smørgrav.Fn pam_start
69ee02aaa9SDag-Erling Smørgravat the start of the transaction.
70ee02aaa9SDag-Erling SmørgravIt is also possible to set or change the conversation function at any
71ee02aaa9SDag-Erling Smørgravpoint during a PAM transaction by changing the value of the
72ee02aaa9SDag-Erling Smørgrav.Dv PAM_CONV
73ee02aaa9SDag-Erling Smørgravitem.
74ee02aaa9SDag-Erling Smørgrav.Pp
75ee02aaa9SDag-Erling SmørgravThe conversation function's first argument specifies the number of
76ee02aaa9SDag-Erling Smørgravmessages (up to
77d64f4044SDag-Erling Smørgrav.Dv PAM_MAX_NUM_MSG )
78ee02aaa9SDag-Erling Smørgravto process.
79e10ae022SDag-Erling SmørgravThe second argument is a pointer to an array of pointers to
80e10ae022SDag-Erling Smørgrav.Vt pam_message
81e10ae022SDag-Erling Smørgravstructures containing the actual messages.
82ee02aaa9SDag-Erling Smørgrav.Pp
83ee02aaa9SDag-Erling SmørgravEach message can have one of four types, specified by the
84ee02aaa9SDag-Erling Smørgrav.Va msg_style
85ee02aaa9SDag-Erling Smørgravmember of
86ee02aaa9SDag-Erling Smørgrav.Vt struct pam_message :
87ee02aaa9SDag-Erling Smørgrav.Bl -tag -width 18n
88ee02aaa9SDag-Erling Smørgrav.It Dv PAM_PROMPT_ECHO_OFF
89ee02aaa9SDag-Erling SmørgravDisplay a prompt and accept the user's response without echoing it to
90ee02aaa9SDag-Erling Smørgravthe terminal.
91ee02aaa9SDag-Erling SmørgravThis is commonly used for passwords.
92ee02aaa9SDag-Erling Smørgrav.It Dv PAM_PROMPT_ECHO_ON
93ee02aaa9SDag-Erling SmørgravDisplay a prompt and accept the user's response, echoing it to the
94ee02aaa9SDag-Erling Smørgravterminal.
95ee02aaa9SDag-Erling SmørgravThis is commonly used for login names and one-time passphrases.
96ee02aaa9SDag-Erling Smørgrav.It Dv PAM_ERROR_MSG
97ee02aaa9SDag-Erling SmørgravDisplay an error message.
98ee02aaa9SDag-Erling Smørgrav.It Dv PAM_TEXT_INFO
99ee02aaa9SDag-Erling SmørgravDisplay an informational message.
100ee02aaa9SDag-Erling Smørgrav.El
101ee02aaa9SDag-Erling Smørgrav.Pp
102ee02aaa9SDag-Erling SmørgravIn each case, the prompt or message to display is pointed to by the
103ee02aaa9SDag-Erling Smørgrav.Va msg
104ee02aaa9SDag-Erling Smørgravmember of
105ee02aaa9SDag-Erling Smørgrav.Vt struct pam_message .
106ee02aaa9SDag-Erling SmørgravIt can be up to
107ee02aaa9SDag-Erling Smørgrav.Dv PAM_MAX_MSG_SIZE
108ee02aaa9SDag-Erling Smørgravcharacters long, including the terminating NUL.
109ee02aaa9SDag-Erling Smørgrav.Pp
110ee02aaa9SDag-Erling SmørgravOn success, the conversation function should allocate and fill a
111ee02aaa9SDag-Erling Smørgravcontiguous array of
112ee02aaa9SDag-Erling Smørgrav.Vt struct pam_response ,
113ee02aaa9SDag-Erling Smørgravone for each message that was passed in.
114ee02aaa9SDag-Erling SmørgravA pointer to the user's response to each message (or
115ee02aaa9SDag-Erling Smørgrav.Dv NULL
116ee02aaa9SDag-Erling Smørgravin the case of informational or error messages) should be stored in
117ee02aaa9SDag-Erling Smørgravthe
118ee02aaa9SDag-Erling Smørgrav.Va resp
119ee02aaa9SDag-Erling Smørgravmember of the corresponding
120ee02aaa9SDag-Erling Smørgrav.Vt struct pam_response .
121ee02aaa9SDag-Erling SmørgravEach response can be up to
122ee02aaa9SDag-Erling Smørgrav.Dv PAM_MAX_RESP_SIZE
123ee02aaa9SDag-Erling Smørgravcharacters long, including the terminating NUL.
124ee02aaa9SDag-Erling Smørgrav.Pp
125ee02aaa9SDag-Erling SmørgravThe
126ee02aaa9SDag-Erling Smørgrav.Va resp_retcode
127ee02aaa9SDag-Erling Smørgravmember of
128ee02aaa9SDag-Erling Smørgrav.Vt struct pam_response
129ee02aaa9SDag-Erling Smørgravis unused and should be set to zero.
130ee02aaa9SDag-Erling Smørgrav.Pp
131ee02aaa9SDag-Erling SmørgravThe conversation function should store a pointer to this array in the
132ee02aaa9SDag-Erling Smørgravlocation pointed to by its third argument.
133ee02aaa9SDag-Erling SmørgravIt is the caller's responsibility to release both this array and the
134ee02aaa9SDag-Erling Smørgravresponses themselves, using
135ee02aaa9SDag-Erling Smørgrav.Xr free 3 .
136ee02aaa9SDag-Erling SmørgravIt is the conversation function's responsibility to ensure that it is
137ee02aaa9SDag-Erling Smørgravlegal to do so.
138ee02aaa9SDag-Erling Smørgrav.Pp
139ee02aaa9SDag-Erling SmørgravThe
140ee02aaa9SDag-Erling Smørgrav.Va appdata_ptr
141ee02aaa9SDag-Erling Smørgravmember of
142ee02aaa9SDag-Erling Smørgrav.Vt struct pam_conv
143ee02aaa9SDag-Erling Smørgravis passed unmodified to the conversation function as its fourth and
144ee02aaa9SDag-Erling Smørgravfinal argument.
145ee02aaa9SDag-Erling Smørgrav.Pp
146ee02aaa9SDag-Erling SmørgravOn failure, the conversation function should release any resources it
147ee02aaa9SDag-Erling Smørgravhas allocated, and return one of the predefined PAM error codes.
148ee02aaa9SDag-Erling Smørgrav.Sh RETURN VALUES
149ee02aaa9SDag-Erling SmørgravThe conversation function should return one of the following values:
150ee02aaa9SDag-Erling Smørgrav.Bl -tag -width 18n
151ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_BUF_ERR
152ee02aaa9SDag-Erling SmørgravMemory buffer error.
153ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_CONV_ERR
154ee02aaa9SDag-Erling SmørgravConversation failure.
155ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_SUCCESS
156ee02aaa9SDag-Erling SmørgravSuccess.
157ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_SYSTEM_ERR
158ee02aaa9SDag-Erling SmørgravSystem error.
159ee02aaa9SDag-Erling Smørgrav.El
160ee02aaa9SDag-Erling Smørgrav.Sh SEE ALSO
161ee02aaa9SDag-Erling Smørgrav.Xr openpam_nullconv 3 ,
162347c3b1eSDag-Erling Smørgrav.Xr openpam_ttyconv 3 ,
163ee02aaa9SDag-Erling Smørgrav.Xr pam 3 ,
164ee02aaa9SDag-Erling Smørgrav.Xr pam_error 3 ,
165ee02aaa9SDag-Erling Smørgrav.Xr pam_get_item 3 ,
166ee02aaa9SDag-Erling Smørgrav.Xr pam_info 3 ,
167ee02aaa9SDag-Erling Smørgrav.Xr pam_prompt 3 ,
168ee02aaa9SDag-Erling Smørgrav.Xr pam_set_item 3 ,
169ee02aaa9SDag-Erling Smørgrav.Xr pam_start 3
170ee02aaa9SDag-Erling Smørgrav.Sh STANDARDS
171ee02aaa9SDag-Erling Smørgrav.Rs
172ee02aaa9SDag-Erling Smørgrav.%T "X/Open Single Sign-On Service (XSSO) - Pluggable Authentication Modules"
173ee02aaa9SDag-Erling Smørgrav.%D "June 1997"
174ee02aaa9SDag-Erling Smørgrav.Re
175ee02aaa9SDag-Erling Smørgrav.Sh AUTHORS
176ee02aaa9SDag-Erling SmørgravThe OpenPAM library and this manual page were developed for the
177ee02aaa9SDag-Erling SmørgravFreeBSD Project by ThinkSec AS and Network Associates Laboratories,
178347c3b1eSDag-Erling Smørgravthe Security Research Division of Network Associates, Inc.\& under
179ee02aaa9SDag-Erling SmørgravDARPA/SPAWAR contract N66001-01-C-8035
180ee02aaa9SDag-Erling Smørgrav.Pq Dq CBOSS ,
181ee02aaa9SDag-Erling Smørgravas part of the DARPA CHATS research program.
1822f3ed619SDag-Erling Smørgrav.Pp
1832f3ed619SDag-Erling SmørgravThe OpenPAM library is maintained by
184f3b0ac34SDag-Erling Smørgrav.An Dag-Erling Sm\(/orgrav Aq Mt des@des.no .
185