xref: /freebsd/contrib/openpam/include/security/pam_appl.h (revision 35c0a8c449fd2b7f75029ebed5e10852240f0865)
1 /*-
2  * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
3  * Copyright (c) 2004-2017 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 
36 #ifndef SECURITY_PAM_APPL_H_INCLUDED
37 #define SECURITY_PAM_APPL_H_INCLUDED
38 
39 #include <security/pam_types.h>
40 #include <security/pam_constants.h>
41 #include <security/openpam_attr.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * XSSO 4.2.1, 6
49  */
50 
51 int
52 pam_acct_mgmt(pam_handle_t *_pamh,
53 	int _flags)
54 	OPENPAM_NONNULL((1));
55 
56 int
57 pam_authenticate(pam_handle_t *_pamh,
58 	int _flags)
59 	OPENPAM_NONNULL((1));
60 
61 int
62 pam_chauthtok(pam_handle_t *_pamh,
63 	int _flags)
64 	OPENPAM_NONNULL((1));
65 
66 int
67 pam_close_session(pam_handle_t *_pamh,
68 	int _flags)
69 	OPENPAM_NONNULL((1));
70 
71 int
72 pam_end(pam_handle_t *_pamh,
73 	int _status);
74 
75 int
76 pam_get_data(const pam_handle_t *_pamh,
77 	const char *_module_data_name,
78 	const void **_data)
79 	OPENPAM_NONNULL((1,2,3));
80 
81 int
82 pam_get_item(const pam_handle_t *_pamh,
83 	int _item_type,
84 	const void **_item)
85 	OPENPAM_NONNULL((1,3));
86 
87 int
88 pam_get_user(pam_handle_t *_pamh,
89 	const char **_user,
90 	const char *_prompt)
91 	OPENPAM_NONNULL((1,2));
92 
93 const char *
94 pam_getenv(pam_handle_t *_pamh,
95 	const char *_name)
96 	OPENPAM_NONNULL((1,2));
97 
98 char **
99 pam_getenvlist(pam_handle_t *_pamh)
100 	OPENPAM_NONNULL((1));
101 
102 int
103 pam_open_session(pam_handle_t *_pamh,
104 	int _flags)
105 	OPENPAM_NONNULL((1));
106 
107 int
108 pam_putenv(pam_handle_t *_pamh,
109 	const char *_namevalue)
110 	OPENPAM_NONNULL((1,2));
111 
112 int
113 pam_set_data(pam_handle_t *_pamh,
114 	const char *_module_data_name,
115 	void *_data,
116 	void (*_cleanup)(pam_handle_t *_pamh,
117 		void *_data,
118 		int _pam_end_status))
119 	OPENPAM_NONNULL((1,2));
120 
121 int
122 pam_set_item(pam_handle_t *_pamh,
123 	int _item_type,
124 	const void *_item)
125 	OPENPAM_NONNULL((1));
126 
127 int
128 pam_setcred(pam_handle_t *_pamh,
129 	int _flags)
130 	OPENPAM_NONNULL((1));
131 
132 int
133 pam_start(const char *_service,
134 	const char *_user,
135 	const struct pam_conv *_pam_conv,
136 	pam_handle_t **_pamh)
137 	OPENPAM_NONNULL((4));
138 
139 const char *
140 pam_strerror(const pam_handle_t *_pamh,
141 	int _error_number);
142 
143 /*
144  * Single Sign-On extensions
145  */
146 #if 0
147 int
148 pam_authenticate_secondary(pam_handle_t *_pamh,
149 	char *_target_username,
150 	char *_target_module_type,
151 	char *_target_authn_domain,
152 	char *_target_supp_data,
153 	char *_target_module_authtok,
154 	int _flags);
155 
156 int
157 pam_get_mapped_authtok(pam_handle_t *_pamh,
158 	const char *_target_module_username,
159 	const char *_target_module_type,
160 	const char *_target_authn_domain,
161 	size_t *_target_authtok_len,
162 	unsigned char **_target_module_authtok);
163 
164 int
165 pam_get_mapped_username(pam_handle_t *_pamh,
166 	const char *_src_username,
167 	const char *_src_module_type,
168 	const char *_src_authn_domain,
169 	const char *_target_module_type,
170 	const char *_target_authn_domain,
171 	char **_target_module_username);
172 
173 int
174 pam_set_mapped_authtok(pam_handle_t *_pamh,
175 	const char *_target_module_username,
176 	size_t _target_authtok_len,
177 	unsigned char *_target_module_authtok,
178 	const char *_target_module_type,
179 	const char *_target_authn_domain);
180 
181 int
182 pam_set_mapped_username(pam_handle_t *_pamh,
183 	char *_src_username,
184 	char *_src_module_type,
185 	char *_src_authn_domain,
186 	char *_target_module_username,
187 	char *_target_module_type,
188 	char *_target_authn_domain);
189 #endif /* 0 */
190 
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 #endif /* !SECURITY_PAM_APPL_H_INCLUDED */
196