1 /*-
2  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
3  * Copyright (c) 2004-2007 Dag-Erling Smørgrav
4  * All rights reserved.
5  *
6  * This software was developed for the FreeBSD Project by ThinkSec AS and
7  * Network Associates Laboratories, the Security Research Division of
8  * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035
9  * ("CBOSS"), as part of the DARPA CHATS research program.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. The name of the author may not be used to endorse or promote
20  *    products derived from this software without specific prior written
21  *    permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  * $Id: pam_appl.h 408 2007-12-21 11:36:24Z des $
36  */
37 
38 #ifndef SECURITY_PAM_APPL_H_INCLUDED
39 #define SECURITY_PAM_APPL_H_INCLUDED
40 
41 #include <security/pam_types.h>
42 #include <security/pam_constants.h>
43 #include <security/openpam_attr.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /*
50  * XSSO 4.2.1, 6
51  */
52 
53 int
54 pam_acct_mgmt(pam_handle_t *_pamh,
55 	int _flags)
56 	OPENPAM_NONNULL((1));
57 
58 int
59 pam_authenticate(pam_handle_t *_pamh,
60 	int _flags)
61 	OPENPAM_NONNULL((1));
62 
63 int
64 pam_chauthtok(pam_handle_t *_pamh,
65 	int _flags)
66 	OPENPAM_NONNULL((1));
67 
68 int
69 pam_close_session(pam_handle_t *_pamh,
70 	int _flags)
71 	OPENPAM_NONNULL((1));
72 
73 int
74 pam_end(pam_handle_t *_pamh,
75 	int _status)
76 	OPENPAM_NONNULL((1));
77 
78 int
79 pam_get_data(const pam_handle_t *_pamh,
80 	const char *_module_data_name,
81 	const void **_data)
82 	OPENPAM_NONNULL((1,2,3));
83 
84 int
85 pam_get_item(const pam_handle_t *_pamh,
86 	int _item_type,
87 	const void **_item)
88 	OPENPAM_NONNULL((1,3));
89 
90 int
91 pam_get_user(pam_handle_t *_pamh,
92 	const char **_user,
93 	const char *_prompt)
94 	OPENPAM_NONNULL((1,2));
95 
96 const char *
97 pam_getenv(pam_handle_t *_pamh,
98 	const char *_name)
99 	OPENPAM_NONNULL((1,2));
100 
101 char **
102 pam_getenvlist(pam_handle_t *_pamh)
103 	OPENPAM_NONNULL((1));
104 
105 int
106 pam_open_session(pam_handle_t *_pamh,
107 	int _flags)
108 	OPENPAM_NONNULL((1));
109 
110 int
111 pam_putenv(pam_handle_t *_pamh,
112 	const char *_namevalue)
113 	OPENPAM_NONNULL((1,2));
114 
115 int
116 pam_set_data(pam_handle_t *_pamh,
117 	const char *_module_data_name,
118 	void *_data,
119 	void (*_cleanup)(pam_handle_t *_pamh,
120 		void *_data,
121 		int _pam_end_status))
122 	OPENPAM_NONNULL((1,2));
123 
124 int
125 pam_set_item(pam_handle_t *_pamh,
126 	int _item_type,
127 	const void *_item)
128 	OPENPAM_NONNULL((1));
129 
130 int
131 pam_setcred(pam_handle_t *_pamh,
132 	int _flags)
133 	OPENPAM_NONNULL((1));
134 
135 int
136 pam_start(const char *_service,
137 	const char *_user,
138 	const struct pam_conv *_pam_conv,
139 	pam_handle_t **_pamh)
140 	OPENPAM_NONNULL((4));
141 
142 const char *
143 pam_strerror(const pam_handle_t *_pamh,
144 	int _error_number);
145 
146 /*
147  * Single Sign-On extensions
148  */
149 #if 0
150 int
151 pam_authenticate_secondary(pam_handle_t *_pamh,
152 	char *_target_username,
153 	char *_target_module_type,
154 	char *_target_authn_domain,
155 	char *_target_supp_data,
156 	char *_target_module_authtok,
157 	int _flags);
158 
159 int
160 pam_get_mapped_authtok(pam_handle_t *_pamh,
161 	const char *_target_module_username,
162 	const char *_target_module_type,
163 	const char *_target_authn_domain,
164 	size_t *_target_authtok_len,
165 	unsigned char **_target_module_authtok);
166 
167 int
168 pam_get_mapped_username(pam_handle_t *_pamh,
169 	const char *_src_username,
170 	const char *_src_module_type,
171 	const char *_src_authn_domain,
172 	const char *_target_module_type,
173 	const char *_target_authn_domain,
174 	char **_target_module_username);
175 
176 int
177 pam_set_mapped_authtok(pam_handle_t *_pamh,
178 	const char *_target_module_username,
179 	size_t _target_authtok_len,
180 	unsigned char *_target_module_authtok,
181 	const char *_target_module_type,
182 	const char *_target_authn_domain);
183 
184 int
185 pam_set_mapped_username(pam_handle_t *_pamh,
186 	char *_src_username,
187 	char *_src_module_type,
188 	char *_src_authn_domain,
189 	char *_target_module_username,
190 	char *_target_module_type,
191 	char *_target_authn_domain);
192 #endif /* 0 */
193 
194 #ifdef __cplusplus
195 }
196 #endif
197 
198 #endif /* !SECURITY_PAM_APPL_H_INCLUDED */
199