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
44extern "C" {
45#endif
46
47/*
48 * XSSO 4.2.1, 6
49 */
50
51int
52pam_acct_mgmt(pam_handle_t *_pamh,
53	int _flags)
54	OPENPAM_NONNULL((1));
55
56int
57pam_authenticate(pam_handle_t *_pamh,
58	int _flags)
59	OPENPAM_NONNULL((1));
60
61int
62pam_chauthtok(pam_handle_t *_pamh,
63	int _flags)
64	OPENPAM_NONNULL((1));
65
66int
67pam_close_session(pam_handle_t *_pamh,
68	int _flags)
69	OPENPAM_NONNULL((1));
70
71int
72pam_end(pam_handle_t *_pamh,
73	int _status);
74
75int
76pam_get_data(const pam_handle_t *_pamh,
77	const char *_module_data_name,
78	const void **_data)
79	OPENPAM_NONNULL((1,2,3));
80
81int
82pam_get_item(const pam_handle_t *_pamh,
83	int _item_type,
84	const void **_item)
85	OPENPAM_NONNULL((1,3));
86
87int
88pam_get_user(pam_handle_t *_pamh,
89	const char **_user,
90	const char *_prompt)
91	OPENPAM_NONNULL((1,2));
92
93const char *
94pam_getenv(pam_handle_t *_pamh,
95	const char *_name)
96	OPENPAM_NONNULL((1,2));
97
98char **
99pam_getenvlist(pam_handle_t *_pamh)
100	OPENPAM_NONNULL((1));
101
102int
103pam_open_session(pam_handle_t *_pamh,
104	int _flags)
105	OPENPAM_NONNULL((1));
106
107int
108pam_putenv(pam_handle_t *_pamh,
109	const char *_namevalue)
110	OPENPAM_NONNULL((1,2));
111
112int
113pam_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
121int
122pam_set_item(pam_handle_t *_pamh,
123	int _item_type,
124	const void *_item)
125	OPENPAM_NONNULL((1));
126
127int
128pam_setcred(pam_handle_t *_pamh,
129	int _flags)
130	OPENPAM_NONNULL((1));
131
132int
133pam_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
139const char *
140pam_strerror(const pam_handle_t *_pamh,
141	int _error_number);
142
143/*
144 * Single Sign-On extensions
145 */
146#if 0
147int
148pam_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
156int
157pam_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
164int
165pam_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
173int
174pam_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
181int
182pam_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