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 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 
27 #ifndef	_NS_SLDAP_H
28 #define	_NS_SLDAP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdio.h>
37 #include <sys/types.h>
38 #include <lber.h>
39 #include <ldap.h>
40 
41 /*
42  * Version
43  */
44 #define	NS_LDAP_VERSION		NS_LDAP_VERSION_2
45 #define	NS_LDAP_VERSION_1	"1.0"
46 #define	NS_LDAP_VERSION_2	"2.0"
47 
48 /*
49  * Flags
50  */
51 #define	NS_LDAP_HARD		  0x001
52 #define	NS_LDAP_ALL_RES		  0x002
53 
54 /* Search Referral Option */
55 typedef enum SearchRef {
56 	NS_LDAP_FOLLOWREF	= 0x004,
57 	NS_LDAP_NOREF		= 0x008
58 } SearchRef_t;
59 
60 typedef enum ScopeType {
61 	NS_LDAP_SCOPE_BASE	= 0x010,
62 	NS_LDAP_SCOPE_ONELEVEL	= 0x020,
63 	NS_LDAP_SCOPE_SUBTREE	= 0x040
64 } ScopeType_t;
65 
66 /*
67  * BE VERY CAREFUL. DO NOT USE FLAG NS_LDAP_KEEP_CONN UNLESS YOU MUST
68  * IN libsldap.so.1 THERE IS NO CONNECTION GARBAGE COLLECTION AND IF
69  * THIS FLAG GETS USED THERE MIGHT BE A CONNECTION LEAK. CURRENTLY THIS
70  * IS ONLY SUPPORTED FOR LIST AND INTENDED FOR APPLICATIONS LIKE AUTOMOUNTER
71  */
72 
73 #define	NS_LDAP_KEEP_CONN	  0x080
74 #define	NS_LDAP_NEW_CONN	  0x400
75 #define	NS_LDAP_NOMAP		  0x800
76 
77 #define	NS_LDAP_PAGE_CTRL	  0x1000
78 #define	NS_LDAP_NO_PAGE_CTRL	  0x0000
79 
80 /*
81  * NS_LDAP_NOT_CVT_DN is needed when attribute mapping is used
82  * to retrieve the DN in LDAP and DN is not to be converted when
83  * being passed back to the application. See __ns_ldap_uid2dn()
84  * and __ns_ldap_host2dn() for such usage.
85  */
86 #define	NS_LDAP_NOT_CVT_DN	0x2000
87 
88 /*
89  * Authentication Information
90  */
91 typedef enum CredLevel {
92 	NS_LDAP_CRED_ANON	= 0,
93 	NS_LDAP_CRED_PROXY	= 1,
94 	NS_LDAP_CRED_SELF	= 2
95 } CredLevel_t;
96 
97 typedef enum AuthType {
98 	NS_LDAP_AUTH_NONE	= 0,
99 	NS_LDAP_AUTH_SIMPLE	= 1,
100 	NS_LDAP_AUTH_SASL	= 2,
101 	NS_LDAP_AUTH_TLS	= 3,	/* implied SASL usage */
102 	NS_LDAP_AUTH_ATLS	= 4	/* implied SASL usage */
103 } AuthType_t;
104 
105 typedef enum TlsType {
106 	NS_LDAP_TLS_NONE	= 0,
107 	NS_LDAP_TLS_SIMPLE	= 1,
108 	NS_LDAP_TLS_SASL	= 2
109 } TlsType_t;
110 
111 typedef enum SaslMech {
112 	NS_LDAP_SASL_NONE	= 0,	/* No SASL mechanism */
113 	NS_LDAP_SASL_CRAM_MD5	= 1,
114 	NS_LDAP_SASL_DIGEST_MD5	= 2,
115 	NS_LDAP_SASL_EXTERNAL	= 3,	/* currently not supported */
116 	NS_LDAP_SASL_GSSAPI	= 4,
117 	NS_LDAP_SASL_SPNEGO	= 5	/* currently not supported */
118 } SaslMech_t;
119 
120 typedef enum SaslOpt {
121 	NS_LDAP_SASLOPT_NONE	= 0,
122 	NS_LDAP_SASLOPT_INT	= 1,
123 	NS_LDAP_SASLOPT_PRIV	= 2
124 } SaslOpt_t;
125 
126 typedef enum PrefOnly {
127 	NS_LDAP_PREF_FALSE	= 0,
128 	NS_LDAP_PREF_TRUE	= 1
129 } PrefOnly_t;
130 
131 typedef struct UnixCred {
132 	char	*userID;	/* Unix ID number */
133 	char	*passwd;	/* password */
134 } UnixCred_t;
135 
136 typedef struct CertCred {
137 	char	*path;		/* certificate path */
138 	char	*passwd;	/* password */
139 	char	*nickname;	/* nickname */
140 } CertCred_t;
141 
142 typedef struct ns_auth {
143 	AuthType_t	type;
144 	TlsType_t	tlstype;
145 	SaslMech_t	saslmech;
146 	SaslOpt_t	saslopt;
147 } ns_auth_t;
148 
149 typedef struct ns_cred {
150 	ns_auth_t	auth;
151 	char		*hostcertpath;
152 	union {
153 		UnixCred_t	unix_cred;
154 		CertCred_t	cert_cred;
155 	} cred;
156 } ns_cred_t;
157 
158 
159 typedef struct LineBuf {
160 	char *str;
161 	int len;
162 	int alloc;
163 } LineBuf;
164 
165 /*
166  * Configuration Information
167  */
168 
169 typedef enum {
170 	NS_LDAP_FILE_VERSION_P		= 0,
171 	NS_LDAP_BINDDN_P		= 1,
172 	NS_LDAP_BINDPASSWD_P		= 2,
173 	NS_LDAP_SERVERS_P		= 3,
174 	NS_LDAP_SEARCH_BASEDN_P		= 4,
175 	NS_LDAP_AUTH_P			= 5,
176 /*
177  * NS_LDAP_TRANSPORT_SEC_P is only left in for backward compatibility
178  * with version 1 clients and their configuration files.  The only
179  * supported value is NS_LDAP_SEC_NONE.  No application should be
180  * using this parameter type (either through getParam or setParam.
181  */
182 	NS_LDAP_TRANSPORT_SEC_P		= 6,
183 	NS_LDAP_SEARCH_REF_P		= 7,
184 	NS_LDAP_DOMAIN_P		= 8,
185 	NS_LDAP_EXP_P			= 9,
186 	NS_LDAP_CERT_PATH_P		= 10,
187 	NS_LDAP_CERT_PASS_P		= 11,
188 	NS_LDAP_SEARCH_DN_P		= 12,
189 	NS_LDAP_SEARCH_SCOPE_P		= 13,
190 	NS_LDAP_SEARCH_TIME_P		= 14,
191 	NS_LDAP_SERVER_PREF_P		= 15,
192 	NS_LDAP_PREF_ONLY_P		= 16,
193 	NS_LDAP_CACHETTL_P		= 17,
194 	NS_LDAP_PROFILE_P		= 18,
195 	NS_LDAP_CREDENTIAL_LEVEL_P	= 19,
196 	NS_LDAP_SERVICE_SEARCH_DESC_P	= 20,
197 	NS_LDAP_BIND_TIME_P		= 21,
198 	NS_LDAP_ATTRIBUTEMAP_P		= 22,
199 	NS_LDAP_OBJECTCLASSMAP_P	= 23,
200 	NS_LDAP_CERT_NICKNAME_P		= 24,
201 	NS_LDAP_SERVICE_AUTH_METHOD_P	= 25,
202 	NS_LDAP_SERVICE_CRED_LEVEL_P	= 26,
203 	NS_LDAP_HOST_CERTPATH_P		= 27,
204 /*
205  * The following entry (max ParamIndexType) is an internal
206  * placeholder.  It must be the last (and highest value)
207  * entry in this eNum.  Please update accordingly.
208  */
209 	NS_LDAP_MAX_PIT_P		= 28
210 
211 } ParamIndexType;
212 
213 /*
214  * NONE - No self / SASL/GSSAPI configured
215  * ONLY - Only self / SASL/GSSAPI configured
216  * MIXED - self / SASL/GSSAPI is mixed with other types of configuration
217  */
218 typedef enum {
219 	NS_LDAP_SELF_GSSAPI_CONFIG_NONE = 0,
220 	NS_LDAP_SELF_GSSAPI_CONFIG_ONLY = 1,
221 	NS_LDAP_SELF_GSSAPI_CONFIG_MIXED = 2
222 } ns_ldap_self_gssapi_config_t;
223 
224 /*
225  * __ns_ldap_*() return codes
226  */
227 typedef enum {
228 	NS_LDAP_SUCCESS		= 0, /* success, no info in errorp */
229 	NS_LDAP_OP_FAILED	= 1, /* failed operation, no info in errorp */
230 	NS_LDAP_NOTFOUND	= 2, /* entry not found, no info in errorp */
231 	NS_LDAP_MEMORY		= 3, /* memory failure, no info in errorp */
232 	NS_LDAP_CONFIG		= 4, /* config problem, detail in errorp */
233 	NS_LDAP_PARTIAL		= 5, /* partial result, detail in errorp */
234 	NS_LDAP_INTERNAL	= 7, /* LDAP error, detail in errorp */
235 	NS_LDAP_INVALID_PARAM	= 8, /* LDAP error, no info in errorp */
236 	NS_LDAP_SUCCESS_WITH_INFO
237 				= 9  /* success, with info in errorp */
238 } ns_ldap_return_code;
239 
240 /*
241  * Detailed error code for NS_LDAP_CONFIG
242  */
243 typedef enum {
244 	NS_CONFIG_SYNTAX	= 0,	/* syntax error */
245 	NS_CONFIG_NODEFAULT	= 1,	/* no default value */
246 	NS_CONFIG_NOTLOADED	= 2,	/* configuration not loaded */
247 	NS_CONFIG_NOTALLOW	= 3,	/* operation requested not allowed */
248 	NS_CONFIG_FILE		= 4,	/* configuration file problem */
249 	NS_CONFIG_CACHEMGR	= 5	/* error with door to ldap_cachemgr */
250 } ns_ldap_config_return_code;
251 
252 /*
253  * Detailed error code for NS_LDAP_PARTIAL
254  */
255 typedef enum {
256 	NS_PARTIAL_TIMEOUT	= 0,	/* partial results due to timeout */
257 	NS_PARTIAL_OTHER	= 1	/* error encountered */
258 } ns_ldap_partial_return_code;
259 
260 /*
261  * For use by __ns_ldap_addTypedEntry() for publickey serivicetype
262  */
263 typedef enum {
264 	NS_HOSTCRED_FALSE = 0,
265 	NS_HOSTCRED_TRUE  = 1
266 } hostcred_t;
267 
268 /*
269  * Detailed password status
270  */
271 typedef enum {
272 	NS_PASSWD_GOOD			= 0,	/* password is good */
273 	NS_PASSWD_ABOUT_TO_EXPIRE	= 1,	/* password is good but */
274 						/* about to expire */
275 	NS_PASSWD_CHANGE_NEEDED		= 2,	/* good but need to be */
276 						/* changed immediately */
277 	NS_PASSWD_EXPIRED		= 3,	/* password expired */
278 	NS_PASSWD_RETRY_EXCEEDED	= 4,	/* exceed retry limit; */
279 						/* account is locked */
280 	NS_PASSWD_CHANGE_NOT_ALLOWED	= 5,	/* can only be changed */
281 						/* by the administrator */
282 	NS_PASSWD_INVALID_SYNTAX	= 6,	/* can not be changed: */
283 						/* new password has */
284 						/* invalid syntax -- */
285 						/* same value as attr */
286 						/* cn, sn, uid, etc. */
287 	NS_PASSWD_TOO_SHORT		= 7,	/* can not be changed: */
288 						/* new password has */
289 						/* less chars than */
290 						/* required */
291 	NS_PASSWD_IN_HISTORY		= 8,	/* can not be changed: */
292 						/* reuse old password  */
293 	NS_PASSWD_WITHIN_MIN_AGE	= 9 	/* can not be changed: */
294 						/* within minimum age  */
295 } ns_ldap_passwd_status_t;
296 
297 /*
298  * Password management information structure
299  *
300  * This structure is different from AcctUsableResponse_t structure in
301  * that this structure holds result of users account mgmt information when
302  * an ldap bind is done with user name and user password.
303  */
304 typedef struct ns_ldap_passwd_mgmt {
305 	ns_ldap_passwd_status_t
306 		status;			/* password status */
307 	int	sec_until_expired;	/* seconds until expired, */
308 					/* valid if status is */
309 					/* NS_PASSWD_ABOUT_TO_EXPIRE */
310 } ns_ldap_passwd_mgmt_t;
311 
312 /*
313  * LDAP V3 control flag for account management - Used for account management
314  * when no password is provided
315  */
316 #define	NS_LDAP_ACCOUNT_USABLE_CONTROL	"1.3.6.1.4.1.42.2.27.9.5.8"
317 
318 /*
319  * Structure for holding the response returned by server for
320  * NS_LDAP_ACCOUNT_USABLE_CONTROL control when account is not available.
321  */
322 typedef struct AcctUsableMoreInfo {
323 	int inactive;
324 	int reset;
325 	int expired;
326 	int rem_grace;
327 	int sec_b4_unlock;
328 } AcctUsableMoreInfo_t;
329 
330 /*
331  * Structure used to hold the response from the server for
332  * NS_LDAP_ACCOUNT_USABLE_CONTROL control. The ASN1 notation is as below:
333  *
334  * ACCOUNT_USABLE_RESPONSE::= CHOICE {
335  * is_available		[0] INTEGER, seconds before expiration
336  * is_not_available	[1] More_info
337  * }
338  *
339  * More_info::= SEQUENCE {
340  * inactive		[0] BOOLEAN DEFAULT FALSE,
341  * reset		[1] BOOLEAN DEFAULT FALSE,
342  * expired		[2] BOOLEAN DEFAULT FALSE,
343  * remaining_grace	[3] INTEGER OPTIONAL,
344  * seconds_before_unlock[4] INTEGER OPTIONAL
345  * }
346  *
347  * This structure is different from ns_ldap_passwd_mgmt_t structure in
348  * that this structure holds result of users account mgmt information when
349  * pam_ldap doesn't have the users password and proxy agent is used for
350  * obtaining the account management information.
351  */
352 typedef struct AcctUsableResponse {
353 	int choice;
354 	union {
355 		int seconds_before_expiry;
356 		AcctUsableMoreInfo_t more_info;
357 	} AcctUsableResp;
358 } AcctUsableResponse_t;
359 
360 /*
361  * Simplified LDAP Naming API result structure
362  */
363 typedef struct ns_ldap_error {
364 	int	status;				/* LDAP error code */
365 	char	*message;			/* LDAP error message */
366 	ns_ldap_passwd_mgmt_t	pwd_mgmt;	/* LDAP password */
367 						/* management info */
368 } ns_ldap_error_t;
369 
370 typedef struct	 ns_ldap_attr {
371 	char	*attrname;			/* attribute name */
372 	uint_t	value_count;
373 	char	**attrvalue;			/* attribute values */
374 } ns_ldap_attr_t;
375 
376 typedef struct ns_ldap_entry {
377 	uint_t		attr_count;		/* number of attributes */
378 	ns_ldap_attr_t	**attr_pair;		/* attributes pairs */
379 	struct ns_ldap_entry *next;		/* next entry */
380 } ns_ldap_entry_t;
381 
382 typedef struct ns_ldap_result {
383 	uint_t	entries_count;		/* number of entries */
384 	ns_ldap_entry_t	*entry;		/* data */
385 } ns_ldap_result_t;
386 
387 /*
388  * structures for the conversion routines used by typedAddEntry()
389  */
390 
391 typedef struct _ns_netgroups {
392 	char  *name;
393 	char  **triplet;
394 	char  **netgroup;
395 } _ns_netgroups_t;
396 
397 typedef struct _ns_netmasks {
398 	char *netnumber;
399 	char *netmask;
400 } _ns_netmasks_t;
401 
402 typedef struct _ns_bootp {
403 	char *name;
404 	char **param;
405 } _ns_bootp_t;
406 
407 typedef struct _ns_ethers {
408 	char *name;
409 	char *ether;
410 } _ns_ethers_t;
411 
412 typedef struct _ns_pubkey {
413 	char *name;
414 	hostcred_t hostcred;
415 	char *pubkey;
416 	char *privkey;
417 } _ns_pubkey_t;
418 
419 typedef struct _ns_alias {
420 	char *alias;
421 	char **member;
422 } _ns_alias_t;
423 
424 typedef struct _ns_automount {
425 	char *mapname;
426 	char *key;
427 	char *value;
428 } _ns_automount_t;
429 
430 /*
431  * return values for the callback function in __ns_ldap_list()
432  */
433 #define	NS_LDAP_CB_NEXT	0	/* get the next entry */
434 #define	NS_LDAP_CB_DONE	1	/* done */
435 
436 /*
437  * Input values for the type specified in __ns_ldap_addTypedEntry()
438  * and __ns_ldap_delTypedEntry()
439  */
440 
441 #define	NS_LDAP_TYPE_PASSWD	"passwd"
442 #define	NS_LDAP_TYPE_GROUP	"group"
443 #define	NS_LDAP_TYPE_HOSTS	"hosts"
444 #define	NS_LDAP_TYPE_IPNODES	"ipnodes"
445 #define	NS_LDAP_TYPE_PROFILE	"prof_attr"
446 #define	NS_LDAP_TYPE_RPC	"rpc"
447 #define	NS_LDAP_TYPE_PROTOCOLS	"protocols"
448 #define	NS_LDAP_TYPE_NETWORKS	"networks"
449 #define	NS_LDAP_TYPE_NETGROUP	"netgroup"
450 #define	NS_LDAP_TYPE_ALIASES	"aliases"
451 #define	NS_LDAP_TYPE_SERVICES	"services"
452 #define	NS_LDAP_TYPE_ETHERS	"ethers"
453 #define	NS_LDAP_TYPE_SHADOW	"shadow"
454 #define	NS_LDAP_TYPE_NETMASKS	"netmasks"
455 #define	NS_LDAP_TYPE_AUTHATTR	"auth_attr"
456 #define	NS_LDAP_TYPE_EXECATTR	"exec_attr"
457 #define	NS_LDAP_TYPE_USERATTR	"user_attr"
458 #define	NS_LDAP_TYPE_PROJECT	"project"
459 #define	NS_LDAP_TYPE_PUBLICKEY	"publickey"
460 #define	NS_LDAP_TYPE_AUUSER	"audit_user"
461 #define	NS_LDAP_TYPE_BOOTPARAMS "bootparams"
462 #define	NS_LDAP_TYPE_AUTOMOUNT  "auto_"
463 #define	NS_LDAP_TYPE_TNRHDB	"tnrhdb"
464 #define	NS_LDAP_TYPE_TNRHTP	"tnrhtp"
465 
466 /*
467  * service descriptor/attribute mapping structure
468  */
469 
470 typedef struct ns_ldap_search_desc {
471 	char		*basedn;	/* search base dn */
472 	ScopeType_t	scope;		/* search scope */
473 	char		*filter;	/* search filter */
474 } ns_ldap_search_desc_t;
475 
476 typedef struct ns_ldap_attribute_map {
477 	char		*origAttr;	/* original attribute */
478 	char		**mappedAttr;	/* mapped attribute(s) */
479 } ns_ldap_attribute_map_t;
480 
481 typedef struct ns_ldap_objectclass_map {
482 	char		*origOC;	/* original objectclass */
483 	char		*mappedOC;	/* mapped objectclass */
484 } ns_ldap_objectclass_map_t;
485 
486 /* Opaque handle for batch API */
487 typedef struct ns_ldap_list_batch ns_ldap_list_batch_t;
488 
489 /*
490  * Simplified LDAP Naming APIs
491  */
492 int __ns_ldap_list(
493 	const char *service,
494 	const char *filter,
495 	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
496 			char **realfilter, const void *userdata),
497 	const char * const *attribute,
498 	const ns_cred_t *cred,
499 	const int flags,
500 	ns_ldap_result_t ** result,
501 	ns_ldap_error_t ** errorp,
502 	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
503 	const void *userdata);
504 
505 int __ns_ldap_list_batch_start(
506 	ns_ldap_list_batch_t **batch);
507 
508 int __ns_ldap_list_batch_add(
509 	ns_ldap_list_batch_t *batch,
510 	const char *service,
511 	const char *filter,
512 	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
513 			char **realfilter, const void *userdata),
514 	const char * const *attribute,
515 	const ns_cred_t *cred,
516 	const int flags,
517 	ns_ldap_result_t ** result,
518 	ns_ldap_error_t ** errorp,
519 	int *rcp,
520 	int (*callback)(const ns_ldap_entry_t *entry, const void *userdata),
521 	const void *userdata);
522 
523 int __ns_ldap_list_batch_end(
524 	ns_ldap_list_batch_t *batch);
525 
526 void __ns_ldap_list_batch_release(
527 	ns_ldap_list_batch_t *batch);
528 
529 int  __ns_ldap_addAttr(
530 	const char *service,
531 	const char *dn,
532 	const ns_ldap_attr_t * const *attr,
533 	const ns_cred_t *cred,
534 	const int flags,
535 	ns_ldap_error_t **errorp);
536 
537 int __ns_ldap_delAttr(
538 	const char *service,
539 	const char *dn,
540 	const ns_ldap_attr_t * const *attr,
541 	const ns_cred_t *cred,
542 	const int flags,
543 	ns_ldap_error_t **errorp);
544 
545 int  __ns_ldap_repAttr(
546 	const char *service,
547 	const char *dn,
548 	const ns_ldap_attr_t * const *attr,
549 	const ns_cred_t *cred,
550 	const int flags,
551 	ns_ldap_error_t **errorp);
552 
553 int  __ns_ldap_addEntry(
554 	const char *service,
555 	const char *dn,
556 	const ns_ldap_entry_t *entry,
557 	const ns_cred_t *cred,
558 	const int flags,
559 	ns_ldap_error_t **errorp);
560 
561 int  __ns_ldap_addTypedEntry(
562 	const char *servicetype,
563 	const char *basedn,
564 	const void *data,
565 	const int  create,
566 	const ns_cred_t *cred,
567 	const int flags,
568 	ns_ldap_error_t **errorp);
569 
570 int __ns_ldap_delEntry(
571 	const char *service,
572 	const char *dn,
573 	const ns_cred_t *cred,
574 	const int flags,
575 	ns_ldap_error_t **errorp);
576 
577 int __ns_ldap_firstEntry(
578 	const char *service,
579 	const char *filter,
580 	int (*init_filter_cb)(const ns_ldap_search_desc_t *desc,
581 			char **realfilter, const void *userdata),
582 	const char * const *attribute,
583 	const ns_cred_t *cred,
584 	const int flags,
585 	void **cookie,
586 	ns_ldap_result_t ** result,
587 	ns_ldap_error_t **errorp,
588 	const void *userdata);
589 
590 int  __ns_ldap_nextEntry(
591 	void *cookie,
592 	ns_ldap_result_t ** result,
593 	ns_ldap_error_t **errorp);
594 
595 int  __ns_ldap_endEntry(
596 	void **cookie,
597 	ns_ldap_error_t **errorp);
598 
599 int __ns_ldap_freeResult(
600 	ns_ldap_result_t **result);
601 
602 int __ns_ldap_freeError(
603 	ns_ldap_error_t **errorp);
604 
605 int  __ns_ldap_uid2dn(
606 	const char *uid,
607 	char **userDN,
608 	const ns_cred_t *cred,
609 	ns_ldap_error_t ** errorp);
610 
611 int  __ns_ldap_host2dn(
612 	const char *host,
613 	const char *domain,
614 	char **hostDN,
615 	const ns_cred_t *cred,
616 	ns_ldap_error_t ** errorp);
617 
618 int  __ns_ldap_dn2domain(
619 	const char *dn,
620 	char **domain,
621 	const ns_cred_t *cred,
622 	ns_ldap_error_t ** errorp);
623 
624 int __ns_ldap_auth(
625 	const ns_cred_t *cred,
626 	const int flag,
627 	ns_ldap_error_t **errorp,
628 	LDAPControl **serverctrls,
629 	LDAPControl **clientctrls);
630 
631 int __ns_ldap_freeCred(
632 	ns_cred_t **credp);
633 
634 int __ns_ldap_err2str(
635 	int err,
636 	char **strmsg);
637 
638 int __ns_ldap_setParam(
639 	const ParamIndexType type,
640 	const void *data,
641 	ns_ldap_error_t **errorp);
642 
643 int __ns_ldap_getParam(
644 	const ParamIndexType type,
645 	void ***data,
646 	ns_ldap_error_t **errorp);
647 
648 int __ns_ldap_freeParam(
649 	void ***data);
650 
651 char **__ns_ldap_getAttr(
652 	const ns_ldap_entry_t *entry,
653 	const char *attrname);
654 
655 ns_ldap_attr_t	*__ns_ldap_getAttrStruct(
656 	const ns_ldap_entry_t *entry,
657 	const char *attrname);
658 
659 int __ns_ldap_getServiceAuthMethods(
660 	const char *service,
661 	ns_auth_t ***auth,
662 	ns_ldap_error_t **errorp);
663 
664 int __ns_ldap_getSearchDescriptors(
665 	const char *service,
666 	ns_ldap_search_desc_t ***desc,
667 	ns_ldap_error_t **errorp);
668 
669 int __ns_ldap_freeSearchDescriptors(
670 	ns_ldap_search_desc_t ***desc);
671 
672 int __ns_ldap_getAttributeMaps(
673 	const char *service,
674 	ns_ldap_attribute_map_t ***maps,
675 	ns_ldap_error_t **errorp);
676 
677 int __ns_ldap_freeAttributeMaps(
678 	ns_ldap_attribute_map_t ***maps);
679 
680 char **__ns_ldap_getMappedAttributes(
681 	const char *service,
682 	const char *origAttribute);
683 
684 char **__ns_ldap_getOrigAttribute(
685 	const char *service,
686 	const char *mappedAttribute);
687 
688 int __ns_ldap_getObjectClassMaps(
689 	const char *service,
690 	ns_ldap_objectclass_map_t ***maps,
691 	ns_ldap_error_t **errorp);
692 
693 int __ns_ldap_freeObjectClassMaps(
694 	ns_ldap_objectclass_map_t ***maps);
695 
696 char **__ns_ldap_getMappedObjectClass(
697 	const char *service,
698 	const char *origObjectClass);
699 
700 char **__ns_ldap_getOrigObjectClass(
701 	const char *service,
702 	const char *mappedObjectClass);
703 
704 int __ns_ldap_getParamType(
705 	const char *value,
706 	ParamIndexType *type);
707 
708 int __ns_ldap_getAcctMgmt(
709 	const char *user,
710 	AcctUsableResponse_t *acctResp);
711 void
712 __ns_ldap_self_gssapi_only_set(
713 	int flag);
714 int
715 __ns_ldap_self_gssapi_config(
716 	ns_ldap_self_gssapi_config_t *config);
717 #ifdef __cplusplus
718 }
719 #endif
720 
721 #endif /* _NS_SLDAP_H */
722