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