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