xref: /titanic_41/usr/src/lib/libsldap/common/llib-lsldap (revision 49d3bc91e27cd871b950d56c01398fa2f2e12ab4)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/* LINTLIBRARY */
22/* PROTOLIB1 */
23
24/*
25 *Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
26 */
27
28#include <stdio.h>
29#include <sys/types.h>
30#include <lber.h>
31#include <ldap.h>
32#include "ns_sldap.h"
33
34
35/*
36 * Simplified LDAP Naming APIs
37 */
38int __ns_ldap_list(
39	const char *service,
40	const char *filter,
41	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
42			      char **realfilter, const void *userdata),
43	const char * const *attribute,
44	const ns_cred_t *cred,
45	const int flags,
46	ns_ldap_result_t ** result,
47	ns_ldap_error_t ** errorp,
48	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
49	const void *userdata);
50
51int __ns_ldap_list_sort(
52	const char *service,
53	const char *filter,
54	const char *sortattr,
55	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
56			      char **realfilter, const void *userdata),
57	const char * const *attribute,
58	const ns_cred_t *cred,
59	const int flags,
60	ns_ldap_result_t ** result,
61	ns_ldap_error_t ** errorp,
62	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
63	const void *userdata);
64
65int  __ns_ldap_addAttr(
66	const char *service,
67	const char *dn,
68	const ns_ldap_attr_t * const *attr,
69	const ns_cred_t *cred,
70	const int flags,
71	ns_ldap_error_t **errorp);
72
73int __ns_ldap_delAttr(
74	const char *service,
75	const char *dn,
76	const ns_ldap_attr_t * const *attr,
77	const ns_cred_t *cred,
78	const int flags,
79	ns_ldap_error_t **errorp);
80
81int  __ns_ldap_repAttr(
82	const char *service,
83	const char *dn,
84	const ns_ldap_attr_t * const *attr,
85	const ns_cred_t *cred,
86	const int flags,
87	ns_ldap_error_t **errorp);
88
89int  __ns_ldap_addEntry(
90	const char *service,
91	const char *dn,
92	const ns_ldap_entry_t *entry,
93	const ns_cred_t *cred,
94	const int flags,
95	ns_ldap_error_t **errorp);
96
97int  __ns_ldap_addTypedEntry(
98	const char *servicetype,
99	const char *basedn,
100	const void *data,
101	const int  create,
102	const ns_cred_t *cred,
103	const int flags,
104	ns_ldap_error_t **errorp);
105
106int __ns_ldap_delEntry(
107	const char *service,
108	const char *dn,
109	const ns_cred_t *cred,
110	const int flags,
111	ns_ldap_error_t **errorp);
112
113int __ns_ldap_firstEntry(
114	const char *service,
115	const char *filter,
116	const char *sortattr,
117	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
118			      char **realfilter, const void *userdata),
119	const char * const *attribute,
120	const ns_cred_t *cred,
121	const int flags,
122	void **cookie,
123	ns_ldap_result_t ** result,
124	ns_ldap_error_t **errorp,
125	const void *userdata);
126
127int  __ns_ldap_nextEntry(
128	void *cookie,
129	ns_ldap_result_t ** result,
130	ns_ldap_error_t **errorp);
131
132int  __ns_ldap_endEntry(
133	void **cookie,
134	ns_ldap_error_t **errorp);
135
136int __ns_ldap_freeResult(
137	ns_ldap_result_t **result);
138
139int __ns_ldap_freeError(
140	ns_ldap_error_t **errorp);
141
142int __ns_ldap_freeCookie(
143	void **cookie);
144
145int  __ns_ldap_uid2dn(
146	const char *uid,
147	char **userDN,
148	const ns_cred_t *cred,
149	ns_ldap_error_t ** errorp);
150
151int  __ns_ldap_host2dn(
152	const char *host,
153	const char *domain,
154	char **hostDN,
155	const ns_cred_t *cred,
156	ns_ldap_error_t ** errorp);
157
158int  __ns_ldap_dn2domain(
159	const char *dn,
160	char **domain,
161	const ns_cred_t *cred,
162	ns_ldap_error_t **errorp);
163
164int __ns_ldap_auth(
165	const ns_cred_t *cred,
166	const int flag,
167	ns_ldap_error_t **errorp,
168	LDAPControl **serverctrls,
169	LDAPControl **clientctrls);
170
171int __ns_ldap_err2str(
172	int err,
173	char **strmsg);
174
175int __ns_ldap_setParam(
176	const ParamIndexType type,
177	const void *data,
178	ns_ldap_error_t **errorp);
179
180int __ns_ldap_getParam(
181	const ParamIndexType type,
182	void ***data,
183	ns_ldap_error_t **errorp);
184
185int __ns_ldap_freeParam(
186	void ***data);
187
188char **__ns_ldap_getAttr(
189	const ns_ldap_entry_t *entry,
190	const char *attrname);
191
192int __s_api_prepend_automountmapname_to_dn(
193	const char *service,
194	char **basedn,
195	ns_ldap_error_t ** errorp);
196
197char *__s_api_get_canonical_name(
198	ns_ldap_entry_t *entry,
199	ns_ldap_attr_t *attrptr,
200	int case_ignore);
201
202void __ns_ldap_setServer(
203	int set);
204
205ns_ldap_error_t *__ns_ldap_LoadConfiguration(
206	void);
207
208ns_ldap_error_t *__ns_ldap_DumpConfiguration(
209	char *file);
210
211ns_ldap_error_t *__ns_ldap_DumpLdif(
212	char *filename);
213
214ns_ldap_error_t *__ns_ldap_print_config(
215	int verbose);
216
217void __ns_ldap_default_config(
218	void);
219
220int __ns_ldap_download(
221	const char *profile,
222	char *addr,
223	char *baseDN,
224	ns_ldap_error_t **errorp);
225
226int __ns_ldap_check_dns_preq(
227	int foreground,
228	int mode_verbose,
229	int mode_quiet,
230	const char *fname,
231	ns_ldap_self_gssapi_config_t config,
232	ns_ldap_error_t **errpp);
233
234int __ns_ldap_check_gssapi_preq(
235	int foreground,
236	int mode_verbose,
237	int mode_quiet,
238	ns_ldap_self_gssapi_config_t config,
239	ns_ldap_error_t **errpp);
240
241int __ns_ldap_check_all_preq(
242	int foreground,
243	int mode_verbose,
244	int mode_quiet,
245	ns_ldap_self_gssapi_config_t config,
246	ns_ldap_error_t **errpp);
247