xref: /onnv-gate/usr/src/lib/libldap4/include/ldap-private.h (revision 6812:febeba71273d)
10Sstevel@tonic-gate /*
2*6812Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
30Sstevel@tonic-gate  * Use is subject to license terms.
40Sstevel@tonic-gate  */
50Sstevel@tonic-gate 
60Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
70Sstevel@tonic-gate 
80Sstevel@tonic-gate #ifndef _LDAP_PRIVATE_H
90Sstevel@tonic-gate #define _LDAP_PRIVATE_H
100Sstevel@tonic-gate 
110Sstevel@tonic-gate #include <signal.h>
120Sstevel@tonic-gate #include <pthread.h> 				/* rri */
130Sstevel@tonic-gate 
14*6812Sraf #define  pthread_self		thr_self
15*6812Sraf #define  thr_self		thr_self
16*6812Sraf #define  pthread_kill		thr_kill
17*6812Sraf #define  thr_kill		thr_kill
180Sstevel@tonic-gate 
190Sstevel@tonic-gate #ifdef _REENTRANT
200Sstevel@tonic-gate #ifndef MAX_THREAD_ID
210Sstevel@tonic-gate #define MAX_THREAD_ID 500
220Sstevel@tonic-gate #endif /* MAX_THREAD_ID */
230Sstevel@tonic-gate #else /* _REENTRANT */
240Sstevel@tonic-gate #ifndef MAX_THREAD_ID
250Sstevel@tonic-gate #define MAX_THREAD_ID 1
260Sstevel@tonic-gate #endif /* MAX_THREAD_ID */
270Sstevel@tonic-gate #endif /* _REENTRANT */
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #define COMPAT20
300Sstevel@tonic-gate #define COMPAT30
310Sstevel@tonic-gate #if defined(COMPAT20) || defined(COMPAT30)
320Sstevel@tonic-gate #define COMPAT
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifdef LDAP_DNS
360Sstevel@tonic-gate #define LDAP_OPT_DNS		0x00000001	/* use DN & DNS */
370Sstevel@tonic-gate #endif /* LDAP_DNS */
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
40*6812Sraf #define DBG_LOCK1(st) printf("%d> %s %d:%s\n", thr_self(), st, __LINE__, __FILE__);
41*6812Sraf #define DBG_LOCK2(ld,st) printf("%d> %s ld_lockcount=%d %d:%s\n",  thr_self(), st, (ld)->ld_lockcount, __LINE__, __FILE__);
420Sstevel@tonic-gate */
430Sstevel@tonic-gate #define DBG_LOCK1(st)
440Sstevel@tonic-gate #define DBG_LOCK2(ld,st)
450Sstevel@tonic-gate 
46*6812Sraf extern pthread_t thr_self();
470Sstevel@tonic-gate #define LOCK_RESPONSE(ld) \
48*6812Sraf 	if ((ld)->ld_response_lockthread != thr_self()) { \
490Sstevel@tonic-gate 		DBG_LOCK1("waiting for response lock") \
500Sstevel@tonic-gate 		pthread_mutex_lock( &((ld)->ld_response_mutex) ); \
510Sstevel@tonic-gate 		DBG_LOCK1("got response lock") \
52*6812Sraf 		(ld)->ld_response_lockthread = thr_self(); \
530Sstevel@tonic-gate 	} else  { \
540Sstevel@tonic-gate 	        (ld)->ld_response_lockcount++; \
550Sstevel@tonic-gate 		DBG_LOCK2(ld, "fake ldap lock") \
560Sstevel@tonic-gate 	}
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #define UNLOCK_RESPONSE(ld) \
590Sstevel@tonic-gate 	if ((ld)->ld_response_lockcount==0) { \
600Sstevel@tonic-gate 		(ld)->ld_response_lockthread = 0; \
610Sstevel@tonic-gate 		pthread_mutex_unlock( &((ld)->ld_response_mutex) ); \
620Sstevel@tonic-gate 		DBG_LOCK1("freed response lock") \
630Sstevel@tonic-gate 	} else  { \
640Sstevel@tonic-gate 	        (ld)->ld_response_lockcount--; \
650Sstevel@tonic-gate 	        DBG_LOCK2(ld, "fake ldap unlock") \
660Sstevel@tonic-gate 	}
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #define LOCK_LDAP(ld) \
69*6812Sraf 	if ((ld)->ld_lockthread != thr_self()) { \
700Sstevel@tonic-gate 	        DBG_LOCK1("waiting for ldap lock") \
710Sstevel@tonic-gate                 pthread_mutex_lock( &((ld)->ld_ldap_mutex) ); \
720Sstevel@tonic-gate 		DBG_LOCK1("got ldap lock") \
73*6812Sraf 		(ld)->ld_lockthread = thr_self(); \
740Sstevel@tonic-gate 	} else  { \
750Sstevel@tonic-gate 	        (ld)->ld_lockcount++; \
760Sstevel@tonic-gate 		DBG_LOCK2(ld, "fake ldap lock") \
770Sstevel@tonic-gate 	}
780Sstevel@tonic-gate 
790Sstevel@tonic-gate #define UNLOCK_LDAP(ld) \
800Sstevel@tonic-gate 	if ((ld)->ld_lockcount==0) { \
810Sstevel@tonic-gate                 (ld)->ld_lockthread = 0; \
820Sstevel@tonic-gate 		pthread_mutex_unlock( &((ld)->ld_ldap_mutex) ); \
830Sstevel@tonic-gate 		DBG_LOCK1("freed ldap lock") \
840Sstevel@tonic-gate 	} else  { \
850Sstevel@tonic-gate 	        (ld)->ld_lockcount--; \
860Sstevel@tonic-gate 	        DBG_LOCK2(ld, "fake ldap unlock") \
870Sstevel@tonic-gate 	}
880Sstevel@tonic-gate 
890Sstevel@tonic-gate #define LOCK_POLL(ld) 	pthread_mutex_lock( &ld->ld_poll_mutex )
900Sstevel@tonic-gate #define UNLOCK_POLL(ld) pthread_mutex_unlock( &ld->ld_poll_mutex )
910Sstevel@tonic-gate 
920Sstevel@tonic-gate 
930Sstevel@tonic-gate /*
940Sstevel@tonic-gate  * structure representing a Ber Element
950Sstevel@tonic-gate  */
960Sstevel@tonic-gate typedef struct berelement {
970Sstevel@tonic-gate 	char		*ber_buf;
980Sstevel@tonic-gate 	char		*ber_ptr;
990Sstevel@tonic-gate 	char		*ber_end;
1000Sstevel@tonic-gate 	struct seqorset *ber_sos;
1010Sstevel@tonic-gate 	unsigned int	ber_tag;
1020Sstevel@tonic-gate 	unsigned int	ber_len;
1030Sstevel@tonic-gate 	int		ber_usertag;
1040Sstevel@tonic-gate 	char		ber_options;
1050Sstevel@tonic-gate #define LBER_USE_DER		0x01
1060Sstevel@tonic-gate #define LBER_USE_INDEFINITE_LEN	0x02
1070Sstevel@tonic-gate #define LBER_TRANSLATE_STRINGS	0x04
1080Sstevel@tonic-gate 	char		*ber_rwptr;
1090Sstevel@tonic-gate 	BERTranslateProc ber_encode_translate_proc;
1100Sstevel@tonic-gate 	BERTranslateProc ber_decode_translate_proc;
1110Sstevel@tonic-gate } _struct_BerElement;
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate /*
1150Sstevel@tonic-gate  * This structure represents both ldap messages and ldap responses.
1160Sstevel@tonic-gate  * These are really the same, except in the case of search responses,
1170Sstevel@tonic-gate  * where a response has multiple messages.
1180Sstevel@tonic-gate  */
1190Sstevel@tonic-gate typedef struct ldapmsg {
1200Sstevel@tonic-gate 	int		lm_msgid;	/* the message id */
1210Sstevel@tonic-gate 	int		lm_msgtype;	/* the message type */
1220Sstevel@tonic-gate 	BerElement	*lm_ber;	/* the ber encoded message contents */
1230Sstevel@tonic-gate 	struct ldapmsg	*lm_chain;	/* for search - next msg in the resp */
1240Sstevel@tonic-gate 	struct ldapmsg	*lm_next;	/* next response */
1250Sstevel@tonic-gate 	unsigned long	lm_time;	/* used to maintain cache */
1260Sstevel@tonic-gate } _struct_LDAPMessage;
1270Sstevel@tonic-gate 
1280Sstevel@tonic-gate typedef struct ldap_filt_list {
1290Sstevel@tonic-gate     char			*lfl_tag;
1300Sstevel@tonic-gate     char			*lfl_pattern;
1310Sstevel@tonic-gate     char			*lfl_delims;
1320Sstevel@tonic-gate     LDAPFiltInfo		*lfl_ilist;
1330Sstevel@tonic-gate     struct ldap_filt_list	*lfl_next;
1340Sstevel@tonic-gate } _struct_FiltList;
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate typedef struct ldap_filt_desc {
1370Sstevel@tonic-gate 	LDAPFiltList		*lfd_filtlist;
1380Sstevel@tonic-gate 	LDAPFiltInfo		*lfd_curfip;
1390Sstevel@tonic-gate 	LDAPFiltInfo		lfd_retfi;
1400Sstevel@tonic-gate 	char			lfd_filter[ LDAP_FILT_MAXSIZ ];
1410Sstevel@tonic-gate 	char			*lfd_curval;
1420Sstevel@tonic-gate 	char			*lfd_curvalcopy;
1430Sstevel@tonic-gate 	char			**lfd_curvalwords;
1440Sstevel@tonic-gate 	char			*lfd_filtprefix;
1450Sstevel@tonic-gate 	char			*lfd_filtsuffix;
1460Sstevel@tonic-gate } _struct_FiltDesc;
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate /*
1490Sstevel@tonic-gate  * structure for tracking LDAP server host, ports, DNs, etc.
1500Sstevel@tonic-gate  */
1510Sstevel@tonic-gate typedef struct ldap_server {
1520Sstevel@tonic-gate 	char			*lsrv_host;
1530Sstevel@tonic-gate 	char			*lsrv_dn;	/* if NULL, use default */
1540Sstevel@tonic-gate 	int			lsrv_port;
1550Sstevel@tonic-gate 	struct ldap_server	*lsrv_next;
1560Sstevel@tonic-gate } LDAPServer;
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate 
1590Sstevel@tonic-gate /*
1600Sstevel@tonic-gate  * structure representing a Socket buffer
1610Sstevel@tonic-gate  */
1620Sstevel@tonic-gate typedef struct sockbuf {
1630Sstevel@tonic-gate #ifndef MACOS
1640Sstevel@tonic-gate 	int		sb_sd;
1650Sstevel@tonic-gate #else /* MACOS */
1660Sstevel@tonic-gate 	void		*sb_sd;
1670Sstevel@tonic-gate #endif /* MACOS */
1680Sstevel@tonic-gate 	BerElement	sb_ber;
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate 	int		sb_naddr;	/* > 0 implies using CLDAP (UDP) */
1710Sstevel@tonic-gate 	void		*sb_useaddr;	/* pointer to sockaddr to use next */
1720Sstevel@tonic-gate 	void		*sb_fromaddr;	/* pointer to message source sockaddr */
1730Sstevel@tonic-gate 	void		**sb_addrs;	/* actually an array of pointers to */
1740Sstevel@tonic-gate 					/*		sockaddrs */
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate 	int		sb_options;	/* to support copying ber elements */
1770Sstevel@tonic-gate #define	LBER_TO_FILE		0x01	/* to a file referenced by sb_fd   */
1780Sstevel@tonic-gate #define	LBER_TO_FILE_ONLY	0x02	/* only write to file, not network */
1790Sstevel@tonic-gate #define	LBER_MAX_INCOMING_SIZE	0x04	/* impose limit on incoming stuff  */
1800Sstevel@tonic-gate #define	LBER_NO_READ_AHEAD	0x08	/* read only as much as requested  */
1810Sstevel@tonic-gate 	int		sb_fd;
1820Sstevel@tonic-gate 	int		sb_max_incoming;
1830Sstevel@tonic-gate #ifdef LDAP_SSL
1840Sstevel@tonic-gate 	int 	sb_ssl_tls;
1850Sstevel@tonic-gate 	SSL		*sb_ssl;	/* to support ldap over ssl */
1860Sstevel@tonic-gate #endif /* LDAP_SSL */
1870Sstevel@tonic-gate } Sockbuf;
1880Sstevel@tonic-gate #define	READBUFSIZ	8192
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate 
1910Sstevel@tonic-gate /*
1920Sstevel@tonic-gate  * structure for representing an LDAP server connection
1930Sstevel@tonic-gate  */
1940Sstevel@tonic-gate typedef struct ldap_conn {
1950Sstevel@tonic-gate 	Sockbuf			*lconn_sb;
1960Sstevel@tonic-gate 	int			lconn_refcnt;
1970Sstevel@tonic-gate 	unsigned long		lconn_lastused;	/* time */
1980Sstevel@tonic-gate 	int			lconn_status;
1990Sstevel@tonic-gate #define LDAP_CONNST_NEEDSOCKET		1
2000Sstevel@tonic-gate #define LDAP_CONNST_CONNECTING		2
2010Sstevel@tonic-gate #define LDAP_CONNST_CONNECTED		3
2020Sstevel@tonic-gate #define LDAP_CONNST_DEAD		4
2030Sstevel@tonic-gate 	LDAPServer		*lconn_server;
2040Sstevel@tonic-gate 	char			*lconn_krbinstance;
2050Sstevel@tonic-gate 	struct ldap_conn	*lconn_next;
2060Sstevel@tonic-gate } LDAPConn;
2070Sstevel@tonic-gate 
2080Sstevel@tonic-gate /*
2090Sstevel@tonic-gate  * Structure used to keep track of search references
2100Sstevel@tonic-gate  */
2110Sstevel@tonic-gate typedef struct ldap_reference {
2120Sstevel@tonic-gate       char ** lref_refs;
2130Sstevel@tonic-gate       struct ldap_reference *lref_next;
2140Sstevel@tonic-gate } LDAPRef;
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate /*
2190Sstevel@tonic-gate  * structure used to track outstanding requests
2200Sstevel@tonic-gate  */
2210Sstevel@tonic-gate typedef struct ldapreq {
2220Sstevel@tonic-gate 	int		lr_msgid;	/* the message id */
2230Sstevel@tonic-gate 	int		lr_status;	/* status of request */
2240Sstevel@tonic-gate #define LDAP_REQST_INPROGRESS	1
2250Sstevel@tonic-gate #define LDAP_REQST_CHASINGREFS	2
2260Sstevel@tonic-gate #define LDAP_REQST_NOTCONNECTED	3
2270Sstevel@tonic-gate #define LDAP_REQST_WRITING	4
2280Sstevel@tonic-gate #define LDAP_REQST_CONNDEAD	5
2290Sstevel@tonic-gate 	int		lr_outrefcnt;	/* count of outstanding referrals */
2300Sstevel@tonic-gate 	int		lr_origid;	/* original request's message id */
2310Sstevel@tonic-gate 	int		lr_parentcnt;	/* count of parent requests */
2320Sstevel@tonic-gate 	int		lr_res_msgtype;	/* result message type */
2330Sstevel@tonic-gate 	int		lr_res_errno;	/* result LDAP errno */
2340Sstevel@tonic-gate 	char		*lr_res_error;	/* result error string */
2350Sstevel@tonic-gate 	char		*lr_res_matched;/* result matched DN string */
2360Sstevel@tonic-gate 	BerElement	*lr_ber;	/* ber encoded request contents */
2370Sstevel@tonic-gate 	LDAPConn	*lr_conn;	/* connection used to send request */
2380Sstevel@tonic-gate 	LDAPRef         *lr_references;
2390Sstevel@tonic-gate 	char	 **lr_ref_followed; /* referral being followed */
2400Sstevel@tonic-gate 	char	 **lr_ref_unfollowed; /* Not being followed */
2410Sstevel@tonic-gate 	char	 **lr_ref_tofollow; /* referral to follow if the one being
2420Sstevel@tonic-gate 								   followed fails. */
2430Sstevel@tonic-gate 	struct ldapreq	*lr_parent;	/* request that spawned this referral */
2440Sstevel@tonic-gate 	struct ldapreq	*lr_refnext;	/* next referral spawned */
2450Sstevel@tonic-gate 	struct ldapreq	*lr_prev;	/* previous request */
2460Sstevel@tonic-gate 	struct ldapreq	*lr_next;	/* next request */
2470Sstevel@tonic-gate } LDAPRequest;
2480Sstevel@tonic-gate 
2490Sstevel@tonic-gate /*
2500Sstevel@tonic-gate  * structure for client cache
2510Sstevel@tonic-gate  */
2520Sstevel@tonic-gate #define LDAP_CACHE_BUCKETS	31	/* cache hash table size */
2530Sstevel@tonic-gate typedef struct ldapcache {
2540Sstevel@tonic-gate 	LDAPMessage	*lc_buckets[LDAP_CACHE_BUCKETS];/* hash table */
2550Sstevel@tonic-gate 	LDAPMessage	*lc_requests;			/* unfulfilled reqs */
2560Sstevel@tonic-gate 	time_t		lc_timeout;			/* request timeout */
2570Sstevel@tonic-gate 	ssize_t		lc_maxmem;			/* memory to use */
2580Sstevel@tonic-gate 	ssize_t		lc_memused;			/* memory in use */
2590Sstevel@tonic-gate 	int		lc_enabled;			/* enabled? */
2600Sstevel@tonic-gate 	unsigned int	lc_options;			/* options */
2610Sstevel@tonic-gate #define LDAP_CACHE_OPT_CACHENOERRS	0x00000001
2620Sstevel@tonic-gate #define LDAP_CACHE_OPT_CACHEALLERRS	0x00000002
2630Sstevel@tonic-gate }  LDAPCache;
2640Sstevel@tonic-gate #define NULLLDCACHE ((LDAPCache *)NULL)
2650Sstevel@tonic-gate 
2660Sstevel@tonic-gate /*
2670Sstevel@tonic-gate  * structure representing an ldap connection
2680Sstevel@tonic-gate  */
2690Sstevel@tonic-gate typedef struct ldap {
2700Sstevel@tonic-gate 	Sockbuf		ld_sb;		/* socket descriptor & buffer */
2710Sstevel@tonic-gate 	char		*ld_host;
2720Sstevel@tonic-gate 	int		ld_version;
2730Sstevel@tonic-gate 	char		ld_lberoptions;
2740Sstevel@tonic-gate 	int		ld_deref;
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate 	int		ld_timelimit;
2770Sstevel@tonic-gate 	int		ld_sizelimit;
2780Sstevel@tonic-gate 
2790Sstevel@tonic-gate 	LDAPFiltDesc	*ld_filtd;	/* from getfilter for ufn searches */
2800Sstevel@tonic-gate 	char		*ld_ufnprefix;	/* for incomplete ufn's */
2810Sstevel@tonic-gate 
2820Sstevel@tonic-gate 	int		ld_errno[MAX_THREAD_ID];	/* thread-specific */
2830Sstevel@tonic-gate #define ld_errno ld_errno[ldap_thr_index()]
2840Sstevel@tonic-gate 	char		*ld_error[MAX_THREAD_ID];	/* thread-specific */
2850Sstevel@tonic-gate #define ld_error ld_error[ldap_thr_index()]
2860Sstevel@tonic-gate 	char		*ld_matched[MAX_THREAD_ID];	/* thread-specific */
2870Sstevel@tonic-gate #define ld_matched ld_matched[ldap_thr_index()]
2880Sstevel@tonic-gate 	char		**ld_referrals[MAX_THREAD_ID];	/* thread-specific */
2890Sstevel@tonic-gate #define ld_referrals ld_referrals[ldap_thr_index()]
2900Sstevel@tonic-gate 	LDAPControl	**ld_ret_ctrls[MAX_THREAD_ID];	/* thread-specific */
2910Sstevel@tonic-gate #define ld_ret_ctrls ld_ret_ctrls[ldap_thr_index()]
2920Sstevel@tonic-gate 	int		ld_msgid;
2930Sstevel@tonic-gate 
2940Sstevel@tonic-gate 	int ld_follow_referral; /* flag set to true if lib follow referrals */
2950Sstevel@tonic-gate 	LDAPRequest	*ld_requests;	/* list of outstanding requests -- referrals*/
2960Sstevel@tonic-gate 
2970Sstevel@tonic-gate 	LDAPMessage	*ld_responses;	/* list of outstanding responses */
2980Sstevel@tonic-gate 	int		*ld_abandoned;	/* array of abandoned requests */
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate 	pthread_mutex_t	ld_response_mutex; /* mutex for responses part of structure */
3010Sstevel@tonic-gate 	pthread_t	ld_response_lockthread; /* thread which currently holds the response lock */
3020Sstevel@tonic-gate 	int		ld_response_lockcount;  /* response lock depth */
3030Sstevel@tonic-gate 
3040Sstevel@tonic-gate 	char		*ld_attrbuffer[MAX_THREAD_ID];
3050Sstevel@tonic-gate #define ld_attrbuffer ld_attrbuffer[ldap_thr_index()]
3060Sstevel@tonic-gate 	LDAPCache	*ld_cache;	/* non-null if cache is initialized */
3070Sstevel@tonic-gate 	char		*ld_cldapdn;	/* DN used in connectionless search */
3080Sstevel@tonic-gate 
3090Sstevel@tonic-gate 	/* it is OK to change these next four values directly */
3100Sstevel@tonic-gate 	int		ld_cldaptries;	/* connectionless search retry count */
3110Sstevel@tonic-gate 	int		ld_cldaptimeout;/* time between retries */
3120Sstevel@tonic-gate 	int		ld_refhoplimit;	/* limit on referral nesting */
3130Sstevel@tonic-gate /* LP TO CHANGE */
3140Sstevel@tonic-gate 	char ld_restart;
3150Sstevel@tonic-gate #ifdef LDAP_SSL
3160Sstevel@tonic-gate 	int ld_use_ssl;
3170Sstevel@tonic-gate 	char *ld_ssl_key;
3180Sstevel@tonic-gate #endif
3190Sstevel@tonic-gate 	unsigned int	ld_options;	/* boolean options */
3200Sstevel@tonic-gate 
3210Sstevel@tonic-gate 	/* do not mess with the rest though */
3220Sstevel@tonic-gate 	char		*ld_defhost;	/* full name of default server */
3230Sstevel@tonic-gate 	int		ld_defport;	/* port of default server */
3240Sstevel@tonic-gate 	BERTranslateProc ld_lber_encode_translate_proc;
3250Sstevel@tonic-gate 	BERTranslateProc ld_lber_decode_translate_proc;
3260Sstevel@tonic-gate 
3270Sstevel@tonic-gate 	LDAPConn	*ld_defconn;	/* default connection */
3280Sstevel@tonic-gate 	LDAPConn	*ld_conns;	/* list of server connections */
3290Sstevel@tonic-gate 	void		*ld_selectinfo;	/* platform specifics for select */
3300Sstevel@tonic-gate 
3310Sstevel@tonic-gate 	LDAP_REBIND_FUNCTION *ld_rebindproc;
3320Sstevel@tonic-gate 	void *ld_rebind_extra_arg;
3330Sstevel@tonic-gate /* 	int		(*ld_rebindproc)( struct ldap *ld, char **dnp, */
3340Sstevel@tonic-gate /* 				char **passwdp, int *authmethodp, int freeit ); */
3350Sstevel@tonic-gate 				/* routine to get info needed for re-bind */
3360Sstevel@tonic-gate 
3370Sstevel@tonic-gate 	pthread_mutex_t	ld_ldap_mutex; /* mutex for thread dependent part of struct */
3380Sstevel@tonic-gate 	pthread_t	ld_lockthread; /* thread which currently holds the lock */
3390Sstevel@tonic-gate 	int		ld_lockcount;  /* lock depth */
3400Sstevel@tonic-gate 	pthread_mutex_t	ld_poll_mutex; /* a seperate lock for polling */
3410Sstevel@tonic-gate 
3420Sstevel@tonic-gate 	LDAPControl **ld_srvctrls; /* Controls used by ldap and server */
3430Sstevel@tonic-gate 	LDAPControl **ld_cltctrls; /* Client side controls */
3440Sstevel@tonic-gate 
3450Sstevel@tonic-gate /* KE: Lists of unsolicited notifications */
3460Sstevel@tonic-gate 	LDAPMessage *ld_notifs[MAX_THREAD_ID];
3470Sstevel@tonic-gate 
3480Sstevel@tonic-gate 	/* How long to wait for while connecting to a server */
3490Sstevel@tonic-gate 	int		ld_connect_timeout;
3500Sstevel@tonic-gate #define ld_notifs ld_notifs[ldap_thr_index()]
3510Sstevel@tonic-gate } _struct_LDAP;
3520Sstevel@tonic-gate 
3530Sstevel@tonic-gate 
3540Sstevel@tonic-gate /*
3550Sstevel@tonic-gate  * handy macro to check whether LDAP struct is set up for CLDAP or not
3560Sstevel@tonic-gate  */
3570Sstevel@tonic-gate #define LDAP_IS_CLDAP( ld )	( ld->ld_sb.sb_naddr > 0 )
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate 
3600Sstevel@tonic-gate #endif /* _LDAP_PRIVATE_H */
361