xref: /freebsd/contrib/openpam/doc/man/pam_conv.3 (revision 49e56509dbc8fd972cf527b2966bf56ce9c0726e)
1ee02aaa9SDag-Erling Smørgrav.\"-
231c521e9SDag-Erling Smørgrav.\" Copyright (c) 2002-2003 Networks Associates Technology, Inc.
3*49e56509SDag-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*49e56509SDag-Erling Smørgrav.\" $OpenPAM: pam_conv.3 939 2017-04-30 21:36:50Z des $
36ee02aaa9SDag-Erling Smørgrav.\"
37*49e56509SDag-Erling Smørgrav.Dd April 30, 2017
38ee02aaa9SDag-Erling Smørgrav.Dt PAM_CONV 3
39ee02aaa9SDag-Erling Smørgrav.Os
40ee02aaa9SDag-Erling Smørgrav.Sh NAME
41ee02aaa9SDag-Erling Smørgrav.Nm pam_conv
42ee02aaa9SDag-Erling Smørgrav.Nd PAM conversation system
43ee02aaa9SDag-Erling Smørgrav.Sh LIBRARY
44ee02aaa9SDag-Erling Smørgrav.Lb libpam
45ee02aaa9SDag-Erling Smørgrav.Sh SYNOPSIS
46ee02aaa9SDag-Erling Smørgrav.In security/pam_appl.h
47ee02aaa9SDag-Erling Smørgrav.Bd -literal
48ee02aaa9SDag-Erling Smørgravstruct pam_message {
49ee02aaa9SDag-Erling Smørgrav	int      msg_style;
50ee02aaa9SDag-Erling Smørgrav	char    *msg;
51ee02aaa9SDag-Erling Smørgrav};
52ee02aaa9SDag-Erling Smørgrav
53ee02aaa9SDag-Erling Smørgravstruct pam_response {
54ee02aaa9SDag-Erling Smørgrav	char    *resp;
55ee02aaa9SDag-Erling Smørgrav	int      resp_retcode;
56ee02aaa9SDag-Erling Smørgrav};
57ee02aaa9SDag-Erling Smørgrav
58ee02aaa9SDag-Erling Smørgravstruct pam_conv {
59ee02aaa9SDag-Erling Smørgrav	int     (*conv)(int, const struct pam_message **,
60ee02aaa9SDag-Erling Smørgrav	    struct pam_response **, void *);
61ee02aaa9SDag-Erling Smørgrav	void    *appdata_ptr;
62ee02aaa9SDag-Erling Smørgrav};
63ee02aaa9SDag-Erling Smørgrav.Ed
64ee02aaa9SDag-Erling Smørgrav.Sh DESCRIPTION
65ee02aaa9SDag-Erling SmørgravThe PAM library uses an application-defined callback to communicate
66ee02aaa9SDag-Erling Smørgravwith the user.
67ee02aaa9SDag-Erling SmørgravThis callback is specified by the
68ee02aaa9SDag-Erling Smørgrav.Vt struct pam_conv
69ee02aaa9SDag-Erling Smørgravpassed to
70ee02aaa9SDag-Erling Smørgrav.Fn pam_start
71ee02aaa9SDag-Erling Smørgravat the start of the transaction.
72ee02aaa9SDag-Erling SmørgravIt is also possible to set or change the conversation function at any
73ee02aaa9SDag-Erling Smørgravpoint during a PAM transaction by changing the value of the
74ee02aaa9SDag-Erling Smørgrav.Dv PAM_CONV
75ee02aaa9SDag-Erling Smørgravitem.
76ee02aaa9SDag-Erling Smørgrav.Pp
77ee02aaa9SDag-Erling SmørgravThe conversation function's first argument specifies the number of
78ee02aaa9SDag-Erling Smørgravmessages (up to
79d64f4044SDag-Erling Smørgrav.Dv PAM_MAX_NUM_MSG )
80ee02aaa9SDag-Erling Smørgravto process.
81e10ae022SDag-Erling SmørgravThe second argument is a pointer to an array of pointers to
82e10ae022SDag-Erling Smørgrav.Vt pam_message
83e10ae022SDag-Erling Smørgravstructures containing the actual messages.
84ee02aaa9SDag-Erling Smørgrav.Pp
85ee02aaa9SDag-Erling SmørgravEach message can have one of four types, specified by the
86ee02aaa9SDag-Erling Smørgrav.Va msg_style
87ee02aaa9SDag-Erling Smørgravmember of
88ee02aaa9SDag-Erling Smørgrav.Vt struct pam_message :
89ee02aaa9SDag-Erling Smørgrav.Bl -tag -width 18n
90ee02aaa9SDag-Erling Smørgrav.It Dv PAM_PROMPT_ECHO_OFF
91ee02aaa9SDag-Erling SmørgravDisplay a prompt and accept the user's response without echoing it to
92ee02aaa9SDag-Erling Smørgravthe terminal.
93ee02aaa9SDag-Erling SmørgravThis is commonly used for passwords.
94ee02aaa9SDag-Erling Smørgrav.It Dv PAM_PROMPT_ECHO_ON
95ee02aaa9SDag-Erling SmørgravDisplay a prompt and accept the user's response, echoing it to the
96ee02aaa9SDag-Erling Smørgravterminal.
97ee02aaa9SDag-Erling SmørgravThis is commonly used for login names and one-time passphrases.
98ee02aaa9SDag-Erling Smørgrav.It Dv PAM_ERROR_MSG
99ee02aaa9SDag-Erling SmørgravDisplay an error message.
100ee02aaa9SDag-Erling Smørgrav.It Dv PAM_TEXT_INFO
101ee02aaa9SDag-Erling SmørgravDisplay an informational message.
102ee02aaa9SDag-Erling Smørgrav.El
103ee02aaa9SDag-Erling Smørgrav.Pp
104ee02aaa9SDag-Erling SmørgravIn each case, the prompt or message to display is pointed to by the
105ee02aaa9SDag-Erling Smørgrav.Va msg
106ee02aaa9SDag-Erling Smørgravmember of
107ee02aaa9SDag-Erling Smørgrav.Vt struct pam_message .
108ee02aaa9SDag-Erling SmørgravIt can be up to
109ee02aaa9SDag-Erling Smørgrav.Dv PAM_MAX_MSG_SIZE
110ee02aaa9SDag-Erling Smørgravcharacters long, including the terminating NUL.
111ee02aaa9SDag-Erling Smørgrav.Pp
112ee02aaa9SDag-Erling SmørgravOn success, the conversation function should allocate and fill a
113ee02aaa9SDag-Erling Smørgravcontiguous array of
114ee02aaa9SDag-Erling Smørgrav.Vt struct pam_response ,
115ee02aaa9SDag-Erling Smørgravone for each message that was passed in.
116ee02aaa9SDag-Erling SmørgravA pointer to the user's response to each message (or
117ee02aaa9SDag-Erling Smørgrav.Dv NULL
118ee02aaa9SDag-Erling Smørgravin the case of informational or error messages) should be stored in
119ee02aaa9SDag-Erling Smørgravthe
120ee02aaa9SDag-Erling Smørgrav.Va resp
121ee02aaa9SDag-Erling Smørgravmember of the corresponding
122ee02aaa9SDag-Erling Smørgrav.Vt struct pam_response .
123ee02aaa9SDag-Erling SmørgravEach response can be up to
124ee02aaa9SDag-Erling Smørgrav.Dv PAM_MAX_RESP_SIZE
125ee02aaa9SDag-Erling Smørgravcharacters long, including the terminating NUL.
126ee02aaa9SDag-Erling Smørgrav.Pp
127ee02aaa9SDag-Erling SmørgravThe
128ee02aaa9SDag-Erling Smørgrav.Va resp_retcode
129ee02aaa9SDag-Erling Smørgravmember of
130ee02aaa9SDag-Erling Smørgrav.Vt struct pam_response
131ee02aaa9SDag-Erling Smørgravis unused and should be set to zero.
132ee02aaa9SDag-Erling Smørgrav.Pp
133ee02aaa9SDag-Erling SmørgravThe conversation function should store a pointer to this array in the
134ee02aaa9SDag-Erling Smørgravlocation pointed to by its third argument.
135ee02aaa9SDag-Erling SmørgravIt is the caller's responsibility to release both this array and the
136ee02aaa9SDag-Erling Smørgravresponses themselves, using
137ee02aaa9SDag-Erling Smørgrav.Xr free 3 .
138ee02aaa9SDag-Erling SmørgravIt is the conversation function's responsibility to ensure that it is
139ee02aaa9SDag-Erling Smørgravlegal to do so.
140ee02aaa9SDag-Erling Smørgrav.Pp
141ee02aaa9SDag-Erling SmørgravThe
142ee02aaa9SDag-Erling Smørgrav.Va appdata_ptr
143ee02aaa9SDag-Erling Smørgravmember of
144ee02aaa9SDag-Erling Smørgrav.Vt struct pam_conv
145ee02aaa9SDag-Erling Smørgravis passed unmodified to the conversation function as its fourth and
146ee02aaa9SDag-Erling Smørgravfinal argument.
147ee02aaa9SDag-Erling Smørgrav.Pp
148ee02aaa9SDag-Erling SmørgravOn failure, the conversation function should release any resources it
149ee02aaa9SDag-Erling Smørgravhas allocated, and return one of the predefined PAM error codes.
150ee02aaa9SDag-Erling Smørgrav.Sh RETURN VALUES
151ee02aaa9SDag-Erling SmørgravThe conversation function should return one of the following values:
152ee02aaa9SDag-Erling Smørgrav.Bl -tag -width 18n
153ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_BUF_ERR
154ee02aaa9SDag-Erling SmørgravMemory buffer error.
155ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_CONV_ERR
156ee02aaa9SDag-Erling SmørgravConversation failure.
157ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_SUCCESS
158ee02aaa9SDag-Erling SmørgravSuccess.
159ee02aaa9SDag-Erling Smørgrav.It Bq Er PAM_SYSTEM_ERR
160ee02aaa9SDag-Erling SmørgravSystem error.
161ee02aaa9SDag-Erling Smørgrav.El
162ee02aaa9SDag-Erling Smørgrav.Sh SEE ALSO
163ee02aaa9SDag-Erling Smørgrav.Xr openpam_nullconv 3 ,
164347c3b1eSDag-Erling Smørgrav.Xr openpam_ttyconv 3 ,
165ee02aaa9SDag-Erling Smørgrav.Xr pam 3 ,
166ee02aaa9SDag-Erling Smørgrav.Xr pam_error 3 ,
167ee02aaa9SDag-Erling Smørgrav.Xr pam_get_item 3 ,
168ee02aaa9SDag-Erling Smørgrav.Xr pam_info 3 ,
169ee02aaa9SDag-Erling Smørgrav.Xr pam_prompt 3 ,
170ee02aaa9SDag-Erling Smørgrav.Xr pam_set_item 3 ,
171ee02aaa9SDag-Erling Smørgrav.Xr pam_start 3
172ee02aaa9SDag-Erling Smørgrav.Sh STANDARDS
173ee02aaa9SDag-Erling Smørgrav.Rs
174ee02aaa9SDag-Erling Smørgrav.%T "X/Open Single Sign-On Service (XSSO) - Pluggable Authentication Modules"
175ee02aaa9SDag-Erling Smørgrav.%D "June 1997"
176ee02aaa9SDag-Erling Smørgrav.Re
177ee02aaa9SDag-Erling Smørgrav.Sh AUTHORS
178ee02aaa9SDag-Erling SmørgravThe OpenPAM library and this manual page were developed for the
179ee02aaa9SDag-Erling SmørgravFreeBSD Project by ThinkSec AS and Network Associates Laboratories,
180347c3b1eSDag-Erling Smørgravthe Security Research Division of Network Associates, Inc.\& under
181ee02aaa9SDag-Erling SmørgravDARPA/SPAWAR contract N66001-01-C-8035
182ee02aaa9SDag-Erling Smørgrav.Pq Dq CBOSS ,
183ee02aaa9SDag-Erling Smørgravas part of the DARPA CHATS research program.
1842f3ed619SDag-Erling Smørgrav.Pp
1852f3ed619SDag-Erling SmørgravThe OpenPAM library is maintained by
186f3b0ac34SDag-Erling Smørgrav.An Dag-Erling Sm\(/orgrav Aq Mt des@des.no .
187