xref: /titanic_50/usr/src/lib/libsldap/common/llib-lsldap (revision 70818f5837509317d1f5dac4d82d7b5a2d547c29)
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 2006 Sun Microsystems, Inc.  All rights reserved.
26 * Use is subject to license terms.
27 */
28#pragma ident	"%Z%%M%	%I%	%E% SMI"
29
30#include <stdio.h>
31#include <sys/types.h>
32#include <lber.h>
33#include <ldap.h>
34#include "ns_sldap.h"
35
36
37/*
38 * Simplified LDAP Naming APIs
39 */
40int __ns_ldap_list(
41	const char *service,
42	const char *filter,
43	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
44			      char **realfilter, const void *userdata),
45	const char * const *attribute,
46	const ns_cred_t *cred,
47	const int flags,
48	ns_ldap_result_t ** result,
49	ns_ldap_error_t ** errorp,
50	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
51	const void *userdata);
52
53int  __ns_ldap_addAttr(
54	const char *service,
55	const char *dn,
56	const ns_ldap_attr_t * const *attr,
57	const ns_cred_t *cred,
58	const int flags,
59	ns_ldap_error_t **errorp);
60
61int __ns_ldap_delAttr(
62	const char *service,
63	const char *dn,
64	const ns_ldap_attr_t * const *attr,
65	const ns_cred_t *cred,
66	const int flags,
67	ns_ldap_error_t **errorp);
68
69int  __ns_ldap_repAttr(
70	const char *service,
71	const char *dn,
72	const ns_ldap_attr_t * const *attr,
73	const ns_cred_t *cred,
74	const int flags,
75	ns_ldap_error_t **errorp);
76
77int  __ns_ldap_addEntry(
78	const char *service,
79	const char *dn,
80	const ns_ldap_entry_t *entry,
81	const ns_cred_t *cred,
82	const int flags,
83	ns_ldap_error_t **errorp);
84
85int  __ns_ldap_addTypedEntry(
86	const char *servicetype,
87	const char *basedn,
88	const void *data,
89	const int  create,
90	const ns_cred_t *cred,
91	const int flags,
92	ns_ldap_error_t **errorp);
93
94int __ns_ldap_delEntry(
95	const char *service,
96	const char *dn,
97	const ns_cred_t *cred,
98	const int flags,
99	ns_ldap_error_t **errorp);
100
101int __ns_ldap_firstEntry(
102	const char *service,
103	const char *filter,
104	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
105			      char **realfilter, const void *userdata),
106	const char * const *attribute,
107	const ns_cred_t *cred,
108	const int flags,
109	void **cookie,
110	ns_ldap_result_t ** result,
111	ns_ldap_error_t **errorp,
112	const void *userdata);
113
114int  __ns_ldap_nextEntry(
115	void *cookie,
116	ns_ldap_result_t ** result,
117	ns_ldap_error_t **errorp);
118
119int  __ns_ldap_endEntry(
120	void **cookie,
121	ns_ldap_error_t **errorp);
122
123int __ns_ldap_freeResult(
124	ns_ldap_result_t **result);
125
126int __ns_ldap_freeError(
127	ns_ldap_error_t **errorp);
128
129int __ns_ldap_freeCookie(
130	void **cookie);
131
132int  __ns_ldap_uid2dn(
133	const char *uid,
134	char **userDN,
135	const ns_cred_t *cred,
136	ns_ldap_error_t ** errorp);
137
138int  __ns_ldap_host2dn(
139	const char *host,
140	const char *domain,
141	char **hostDN,
142	const ns_cred_t *cred,
143	ns_ldap_error_t ** errorp);
144
145int  __ns_ldap_dn2domain(
146	const char *dn,
147	char **domain,
148	const ns_cred_t *cred,
149	ns_ldap_error_t **errorp);
150
151int __ns_ldap_auth(
152	const ns_cred_t *cred,
153	const int flag,
154	ns_ldap_error_t **errorp,
155	LDAPControl **serverctrls,
156	LDAPControl **clientctrls);
157
158int __ns_ldap_err2str(
159	int err,
160	char **strmsg);
161
162int __ns_ldap_setParam(
163	const ParamIndexType type,
164	const void *data,
165	ns_ldap_error_t **errorp);
166
167int __ns_ldap_getParam(
168	const ParamIndexType type,
169	void ***data,
170	ns_ldap_error_t **errorp);
171
172int __ns_ldap_freeParam(
173	void ***data);
174
175char **__ns_ldap_getAttr(
176	const ns_ldap_entry_t *entry,
177	const char *attrname);
178
179int __s_api_prepend_automountmapname_to_dn(
180	const char *service,
181	char **basedn,
182	ns_ldap_error_t ** errorp);
183
184char *__s_api_get_canonical_name(
185	ns_ldap_entry_t *entry,
186	ns_ldap_attr_t *attrptr,
187	int case_ignore);
188
189void __ns_ldap_setServer(
190	int set);
191
192ns_ldap_error_t *__ns_ldap_LoadConfiguration(
193	void);
194
195ns_ldap_error_t *__ns_ldap_DumpConfiguration(
196	char *file);
197
198ns_ldap_error_t *__ns_ldap_DumpLdif(
199	char *filename);
200
201ns_ldap_error_t *__ns_ldap_print_config(
202	int verbose);
203
204void __ns_ldap_default_config(
205	void);
206
207int __ns_ldap_download(
208	const char *profile,
209	char *addr,
210	char *baseDN,
211	ns_ldap_error_t **errorp);
212
213int __ns_ldap_check_dns_preq(
214	int foreground,
215	int mode_verbose,
216	int mode_quiet,
217	const char *fname,
218	ns_ldap_self_gssapi_config_t config,
219	ns_ldap_error_t **errpp);
220
221int __ns_ldap_check_gssapi_preq(
222	int foreground,
223	int mode_verbose,
224	int mode_quiet,
225	ns_ldap_self_gssapi_config_t config,
226	ns_ldap_error_t **errpp);
227
228int __ns_ldap_check_all_preq(
229	int foreground,
230	int mode_verbose,
231	int mode_quiet,
232	ns_ldap_self_gssapi_config_t config,
233	ns_ldap_error_t **errpp);
234