xref: /titanic_44/usr/src/lib/libsldap/common/llib-lsldap (revision ea8dc4b6d2251b437950c0056bc626b311c73c27)
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/* LINTLIBRARY */
23/* PROTOLIB1 */
24
25/*
26 * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
27 * Use is subject to license terms.
28 */
29#pragma ident	"%Z%%M%	%I%	%E% SMI"
30
31#include <stdio.h>
32#include <sys/types.h>
33#include <lber.h>
34#include <ldap.h>
35#include "ns_sldap.h"
36
37
38/*
39 * Simplified LDAP Naming APIs
40 */
41int __ns_ldap_list(
42	const char *service,
43	const char *filter,
44	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
45			      char **realfilter, const void *userdata),
46	const char * const *attribute,
47	const ns_cred_t *cred,
48	const int flags,
49	ns_ldap_result_t ** result,
50	ns_ldap_error_t ** errorp,
51	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
52	const void *userdata);
53
54int  __ns_ldap_addAttr(
55	const char *service,
56	const char *dn,
57	const ns_ldap_attr_t * const *attr,
58	const ns_cred_t *cred,
59	const int flags,
60	ns_ldap_error_t **errorp);
61
62int __ns_ldap_delAttr(
63	const char *service,
64	const char *dn,
65	const ns_ldap_attr_t * const *attr,
66	const ns_cred_t *cred,
67	const int flags,
68	ns_ldap_error_t **errorp);
69
70int  __ns_ldap_repAttr(
71	const char *service,
72	const char *dn,
73	const ns_ldap_attr_t * const *attr,
74	const ns_cred_t *cred,
75	const int flags,
76	ns_ldap_error_t **errorp);
77
78int  __ns_ldap_addEntry(
79	const char *service,
80	const char *dn,
81	const ns_ldap_entry_t *entry,
82	const ns_cred_t *cred,
83	const int flags,
84	ns_ldap_error_t **errorp);
85
86int  __ns_ldap_addTypedEntry(
87	const char *servicetype,
88	const char *basedn,
89	const void *data,
90	const int  create,
91	const ns_cred_t *cred,
92	const int flags,
93	ns_ldap_error_t **errorp);
94
95int __ns_ldap_delEntry(
96	const char *service,
97	const char *dn,
98	const ns_cred_t *cred,
99	const int flags,
100	ns_ldap_error_t **errorp);
101
102int __ns_ldap_firstEntry(
103	const char *service,
104	const char *filter,
105	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
106			      char **realfilter, const void *userdata),
107	const char * const *attribute,
108	const ns_cred_t *cred,
109	const int flags,
110	void **cookie,
111	ns_ldap_result_t ** result,
112	ns_ldap_error_t **errorp,
113	const void *userdata);
114
115int  __ns_ldap_nextEntry(
116	void *cookie,
117	ns_ldap_result_t ** result,
118	ns_ldap_error_t **errorp);
119
120int  __ns_ldap_endEntry(
121	void **cookie,
122	ns_ldap_error_t **errorp);
123
124int __ns_ldap_freeResult(
125	ns_ldap_result_t **result);
126
127int __ns_ldap_freeError(
128	ns_ldap_error_t **errorp);
129
130int __ns_ldap_freeCookie(
131	void **cookie);
132
133int  __ns_ldap_uid2dn(
134	const char *uid,
135	char **userDN,
136	const ns_cred_t *cred,
137	ns_ldap_error_t ** errorp);
138
139int  __ns_ldap_host2dn(
140	const char *host,
141	const char *domain,
142	char **hostDN,
143	const ns_cred_t *cred,
144	ns_ldap_error_t ** errorp);
145
146int  __ns_ldap_dn2domain(
147	const char *dn,
148	char **domain,
149	const ns_cred_t *cred,
150	ns_ldap_error_t **errorp);
151
152int __ns_ldap_auth(
153	const ns_cred_t *cred,
154	const int flag,
155	ns_ldap_error_t **errorp,
156	LDAPControl **serverctrls,
157	LDAPControl **clientctrls);
158
159int __ns_ldap_err2str(
160	int err,
161	char **strmsg);
162
163int __ns_ldap_setParam(
164	const ParamIndexType type,
165	const void *data,
166	ns_ldap_error_t **errorp);
167
168int __ns_ldap_getParam(
169	const ParamIndexType type,
170	void ***data,
171	ns_ldap_error_t **errorp);
172
173int __ns_ldap_freeParam(
174	void ***data);
175
176char **__ns_ldap_getAttr(
177	const ns_ldap_entry_t *entry,
178	const char *attrname);
179
180int __s_api_prepend_automountmapname_to_dn(
181	const char *service,
182	char **basedn,
183	ns_ldap_error_t ** errorp);
184
185char *__s_api_get_canonical_name(
186	ns_ldap_entry_t *entry,
187	ns_ldap_attr_t *attrptr,
188	int case_ignore);
189