1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gate #ifndef _LDAP_PRIVATE_H 9*0Sstevel@tonic-gate #define _LDAP_PRIVATE_H 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate #include <signal.h> 12*0Sstevel@tonic-gate #include <pthread.h> /* rri */ 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gate #define pthread_self _thr_self 15*0Sstevel@tonic-gate #define thr_self _thr_self 16*0Sstevel@tonic-gate #define pthread_kill _thr_kill 17*0Sstevel@tonic-gate #define thr_kill _thr_kill 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate #ifdef _REENTRANT 20*0Sstevel@tonic-gate #ifndef MAX_THREAD_ID 21*0Sstevel@tonic-gate #define MAX_THREAD_ID 500 22*0Sstevel@tonic-gate #endif /* MAX_THREAD_ID */ 23*0Sstevel@tonic-gate #else /* _REENTRANT */ 24*0Sstevel@tonic-gate #ifndef MAX_THREAD_ID 25*0Sstevel@tonic-gate #define MAX_THREAD_ID 1 26*0Sstevel@tonic-gate #endif /* MAX_THREAD_ID */ 27*0Sstevel@tonic-gate #endif /* _REENTRANT */ 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #define COMPAT20 30*0Sstevel@tonic-gate #define COMPAT30 31*0Sstevel@tonic-gate #if defined(COMPAT20) || defined(COMPAT30) 32*0Sstevel@tonic-gate #define COMPAT 33*0Sstevel@tonic-gate #endif 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #ifdef LDAP_DNS 36*0Sstevel@tonic-gate #define LDAP_OPT_DNS 0x00000001 /* use DN & DNS */ 37*0Sstevel@tonic-gate #endif /* LDAP_DNS */ 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate /* 40*0Sstevel@tonic-gate #define DBG_LOCK1(st) printf("%d> %s %d:%s\n", _thr_self(), st, __LINE__, __FILE__); 41*0Sstevel@tonic-gate #define DBG_LOCK2(ld,st) printf("%d> %s ld_lockcount=%d %d:%s\n", _thr_self(), st, (ld)->ld_lockcount, __LINE__, __FILE__); 42*0Sstevel@tonic-gate */ 43*0Sstevel@tonic-gate #define DBG_LOCK1(st) 44*0Sstevel@tonic-gate #define DBG_LOCK2(ld,st) 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate extern pthread_t _thr_self(); 47*0Sstevel@tonic-gate #define LOCK_RESPONSE(ld) \ 48*0Sstevel@tonic-gate if ((ld)->ld_response_lockthread != _thr_self()) { \ 49*0Sstevel@tonic-gate DBG_LOCK1("waiting for response lock") \ 50*0Sstevel@tonic-gate pthread_mutex_lock( &((ld)->ld_response_mutex) ); \ 51*0Sstevel@tonic-gate DBG_LOCK1("got response lock") \ 52*0Sstevel@tonic-gate (ld)->ld_response_lockthread = _thr_self(); \ 53*0Sstevel@tonic-gate } else { \ 54*0Sstevel@tonic-gate (ld)->ld_response_lockcount++; \ 55*0Sstevel@tonic-gate DBG_LOCK2(ld, "fake ldap lock") \ 56*0Sstevel@tonic-gate } 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate #define UNLOCK_RESPONSE(ld) \ 59*0Sstevel@tonic-gate if ((ld)->ld_response_lockcount==0) { \ 60*0Sstevel@tonic-gate (ld)->ld_response_lockthread = 0; \ 61*0Sstevel@tonic-gate pthread_mutex_unlock( &((ld)->ld_response_mutex) ); \ 62*0Sstevel@tonic-gate DBG_LOCK1("freed response lock") \ 63*0Sstevel@tonic-gate } else { \ 64*0Sstevel@tonic-gate (ld)->ld_response_lockcount--; \ 65*0Sstevel@tonic-gate DBG_LOCK2(ld, "fake ldap unlock") \ 66*0Sstevel@tonic-gate } 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate #define LOCK_LDAP(ld) \ 69*0Sstevel@tonic-gate if ((ld)->ld_lockthread != _thr_self()) { \ 70*0Sstevel@tonic-gate DBG_LOCK1("waiting for ldap lock") \ 71*0Sstevel@tonic-gate pthread_mutex_lock( &((ld)->ld_ldap_mutex) ); \ 72*0Sstevel@tonic-gate DBG_LOCK1("got ldap lock") \ 73*0Sstevel@tonic-gate (ld)->ld_lockthread = _thr_self(); \ 74*0Sstevel@tonic-gate } else { \ 75*0Sstevel@tonic-gate (ld)->ld_lockcount++; \ 76*0Sstevel@tonic-gate DBG_LOCK2(ld, "fake ldap lock") \ 77*0Sstevel@tonic-gate } 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate #define UNLOCK_LDAP(ld) \ 80*0Sstevel@tonic-gate if ((ld)->ld_lockcount==0) { \ 81*0Sstevel@tonic-gate (ld)->ld_lockthread = 0; \ 82*0Sstevel@tonic-gate pthread_mutex_unlock( &((ld)->ld_ldap_mutex) ); \ 83*0Sstevel@tonic-gate DBG_LOCK1("freed ldap lock") \ 84*0Sstevel@tonic-gate } else { \ 85*0Sstevel@tonic-gate (ld)->ld_lockcount--; \ 86*0Sstevel@tonic-gate DBG_LOCK2(ld, "fake ldap unlock") \ 87*0Sstevel@tonic-gate } 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate #define LOCK_POLL(ld) pthread_mutex_lock( &ld->ld_poll_mutex ) 90*0Sstevel@tonic-gate #define UNLOCK_POLL(ld) pthread_mutex_unlock( &ld->ld_poll_mutex ) 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate /* 94*0Sstevel@tonic-gate * structure representing a Ber Element 95*0Sstevel@tonic-gate */ 96*0Sstevel@tonic-gate typedef struct berelement { 97*0Sstevel@tonic-gate char *ber_buf; 98*0Sstevel@tonic-gate char *ber_ptr; 99*0Sstevel@tonic-gate char *ber_end; 100*0Sstevel@tonic-gate struct seqorset *ber_sos; 101*0Sstevel@tonic-gate unsigned int ber_tag; 102*0Sstevel@tonic-gate unsigned int ber_len; 103*0Sstevel@tonic-gate int ber_usertag; 104*0Sstevel@tonic-gate char ber_options; 105*0Sstevel@tonic-gate #define LBER_USE_DER 0x01 106*0Sstevel@tonic-gate #define LBER_USE_INDEFINITE_LEN 0x02 107*0Sstevel@tonic-gate #define LBER_TRANSLATE_STRINGS 0x04 108*0Sstevel@tonic-gate char *ber_rwptr; 109*0Sstevel@tonic-gate BERTranslateProc ber_encode_translate_proc; 110*0Sstevel@tonic-gate BERTranslateProc ber_decode_translate_proc; 111*0Sstevel@tonic-gate } _struct_BerElement; 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate /* 115*0Sstevel@tonic-gate * This structure represents both ldap messages and ldap responses. 116*0Sstevel@tonic-gate * These are really the same, except in the case of search responses, 117*0Sstevel@tonic-gate * where a response has multiple messages. 118*0Sstevel@tonic-gate */ 119*0Sstevel@tonic-gate typedef struct ldapmsg { 120*0Sstevel@tonic-gate int lm_msgid; /* the message id */ 121*0Sstevel@tonic-gate int lm_msgtype; /* the message type */ 122*0Sstevel@tonic-gate BerElement *lm_ber; /* the ber encoded message contents */ 123*0Sstevel@tonic-gate struct ldapmsg *lm_chain; /* for search - next msg in the resp */ 124*0Sstevel@tonic-gate struct ldapmsg *lm_next; /* next response */ 125*0Sstevel@tonic-gate unsigned long lm_time; /* used to maintain cache */ 126*0Sstevel@tonic-gate } _struct_LDAPMessage; 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate typedef struct ldap_filt_list { 129*0Sstevel@tonic-gate char *lfl_tag; 130*0Sstevel@tonic-gate char *lfl_pattern; 131*0Sstevel@tonic-gate char *lfl_delims; 132*0Sstevel@tonic-gate LDAPFiltInfo *lfl_ilist; 133*0Sstevel@tonic-gate struct ldap_filt_list *lfl_next; 134*0Sstevel@tonic-gate } _struct_FiltList; 135*0Sstevel@tonic-gate 136*0Sstevel@tonic-gate typedef struct ldap_filt_desc { 137*0Sstevel@tonic-gate LDAPFiltList *lfd_filtlist; 138*0Sstevel@tonic-gate LDAPFiltInfo *lfd_curfip; 139*0Sstevel@tonic-gate LDAPFiltInfo lfd_retfi; 140*0Sstevel@tonic-gate char lfd_filter[ LDAP_FILT_MAXSIZ ]; 141*0Sstevel@tonic-gate char *lfd_curval; 142*0Sstevel@tonic-gate char *lfd_curvalcopy; 143*0Sstevel@tonic-gate char **lfd_curvalwords; 144*0Sstevel@tonic-gate char *lfd_filtprefix; 145*0Sstevel@tonic-gate char *lfd_filtsuffix; 146*0Sstevel@tonic-gate } _struct_FiltDesc; 147*0Sstevel@tonic-gate 148*0Sstevel@tonic-gate /* 149*0Sstevel@tonic-gate * structure for tracking LDAP server host, ports, DNs, etc. 150*0Sstevel@tonic-gate */ 151*0Sstevel@tonic-gate typedef struct ldap_server { 152*0Sstevel@tonic-gate char *lsrv_host; 153*0Sstevel@tonic-gate char *lsrv_dn; /* if NULL, use default */ 154*0Sstevel@tonic-gate int lsrv_port; 155*0Sstevel@tonic-gate struct ldap_server *lsrv_next; 156*0Sstevel@tonic-gate } LDAPServer; 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate /* 160*0Sstevel@tonic-gate * structure representing a Socket buffer 161*0Sstevel@tonic-gate */ 162*0Sstevel@tonic-gate typedef struct sockbuf { 163*0Sstevel@tonic-gate #ifndef MACOS 164*0Sstevel@tonic-gate int sb_sd; 165*0Sstevel@tonic-gate #else /* MACOS */ 166*0Sstevel@tonic-gate void *sb_sd; 167*0Sstevel@tonic-gate #endif /* MACOS */ 168*0Sstevel@tonic-gate BerElement sb_ber; 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate int sb_naddr; /* > 0 implies using CLDAP (UDP) */ 171*0Sstevel@tonic-gate void *sb_useaddr; /* pointer to sockaddr to use next */ 172*0Sstevel@tonic-gate void *sb_fromaddr; /* pointer to message source sockaddr */ 173*0Sstevel@tonic-gate void **sb_addrs; /* actually an array of pointers to */ 174*0Sstevel@tonic-gate /* sockaddrs */ 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate int sb_options; /* to support copying ber elements */ 177*0Sstevel@tonic-gate #define LBER_TO_FILE 0x01 /* to a file referenced by sb_fd */ 178*0Sstevel@tonic-gate #define LBER_TO_FILE_ONLY 0x02 /* only write to file, not network */ 179*0Sstevel@tonic-gate #define LBER_MAX_INCOMING_SIZE 0x04 /* impose limit on incoming stuff */ 180*0Sstevel@tonic-gate #define LBER_NO_READ_AHEAD 0x08 /* read only as much as requested */ 181*0Sstevel@tonic-gate int sb_fd; 182*0Sstevel@tonic-gate int sb_max_incoming; 183*0Sstevel@tonic-gate #ifdef LDAP_SSL 184*0Sstevel@tonic-gate int sb_ssl_tls; 185*0Sstevel@tonic-gate SSL *sb_ssl; /* to support ldap over ssl */ 186*0Sstevel@tonic-gate #endif /* LDAP_SSL */ 187*0Sstevel@tonic-gate } Sockbuf; 188*0Sstevel@tonic-gate #define READBUFSIZ 8192 189*0Sstevel@tonic-gate 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate /* 192*0Sstevel@tonic-gate * structure for representing an LDAP server connection 193*0Sstevel@tonic-gate */ 194*0Sstevel@tonic-gate typedef struct ldap_conn { 195*0Sstevel@tonic-gate Sockbuf *lconn_sb; 196*0Sstevel@tonic-gate int lconn_refcnt; 197*0Sstevel@tonic-gate unsigned long lconn_lastused; /* time */ 198*0Sstevel@tonic-gate int lconn_status; 199*0Sstevel@tonic-gate #define LDAP_CONNST_NEEDSOCKET 1 200*0Sstevel@tonic-gate #define LDAP_CONNST_CONNECTING 2 201*0Sstevel@tonic-gate #define LDAP_CONNST_CONNECTED 3 202*0Sstevel@tonic-gate #define LDAP_CONNST_DEAD 4 203*0Sstevel@tonic-gate LDAPServer *lconn_server; 204*0Sstevel@tonic-gate char *lconn_krbinstance; 205*0Sstevel@tonic-gate struct ldap_conn *lconn_next; 206*0Sstevel@tonic-gate } LDAPConn; 207*0Sstevel@tonic-gate 208*0Sstevel@tonic-gate /* 209*0Sstevel@tonic-gate * Structure used to keep track of search references 210*0Sstevel@tonic-gate */ 211*0Sstevel@tonic-gate typedef struct ldap_reference { 212*0Sstevel@tonic-gate char ** lref_refs; 213*0Sstevel@tonic-gate struct ldap_reference *lref_next; 214*0Sstevel@tonic-gate } LDAPRef; 215*0Sstevel@tonic-gate 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gate /* 219*0Sstevel@tonic-gate * structure used to track outstanding requests 220*0Sstevel@tonic-gate */ 221*0Sstevel@tonic-gate typedef struct ldapreq { 222*0Sstevel@tonic-gate int lr_msgid; /* the message id */ 223*0Sstevel@tonic-gate int lr_status; /* status of request */ 224*0Sstevel@tonic-gate #define LDAP_REQST_INPROGRESS 1 225*0Sstevel@tonic-gate #define LDAP_REQST_CHASINGREFS 2 226*0Sstevel@tonic-gate #define LDAP_REQST_NOTCONNECTED 3 227*0Sstevel@tonic-gate #define LDAP_REQST_WRITING 4 228*0Sstevel@tonic-gate #define LDAP_REQST_CONNDEAD 5 229*0Sstevel@tonic-gate int lr_outrefcnt; /* count of outstanding referrals */ 230*0Sstevel@tonic-gate int lr_origid; /* original request's message id */ 231*0Sstevel@tonic-gate int lr_parentcnt; /* count of parent requests */ 232*0Sstevel@tonic-gate int lr_res_msgtype; /* result message type */ 233*0Sstevel@tonic-gate int lr_res_errno; /* result LDAP errno */ 234*0Sstevel@tonic-gate char *lr_res_error; /* result error string */ 235*0Sstevel@tonic-gate char *lr_res_matched;/* result matched DN string */ 236*0Sstevel@tonic-gate BerElement *lr_ber; /* ber encoded request contents */ 237*0Sstevel@tonic-gate LDAPConn *lr_conn; /* connection used to send request */ 238*0Sstevel@tonic-gate LDAPRef *lr_references; 239*0Sstevel@tonic-gate char **lr_ref_followed; /* referral being followed */ 240*0Sstevel@tonic-gate char **lr_ref_unfollowed; /* Not being followed */ 241*0Sstevel@tonic-gate char **lr_ref_tofollow; /* referral to follow if the one being 242*0Sstevel@tonic-gate followed fails. */ 243*0Sstevel@tonic-gate struct ldapreq *lr_parent; /* request that spawned this referral */ 244*0Sstevel@tonic-gate struct ldapreq *lr_refnext; /* next referral spawned */ 245*0Sstevel@tonic-gate struct ldapreq *lr_prev; /* previous request */ 246*0Sstevel@tonic-gate struct ldapreq *lr_next; /* next request */ 247*0Sstevel@tonic-gate } LDAPRequest; 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate /* 250*0Sstevel@tonic-gate * structure for client cache 251*0Sstevel@tonic-gate */ 252*0Sstevel@tonic-gate #define LDAP_CACHE_BUCKETS 31 /* cache hash table size */ 253*0Sstevel@tonic-gate typedef struct ldapcache { 254*0Sstevel@tonic-gate LDAPMessage *lc_buckets[LDAP_CACHE_BUCKETS];/* hash table */ 255*0Sstevel@tonic-gate LDAPMessage *lc_requests; /* unfulfilled reqs */ 256*0Sstevel@tonic-gate time_t lc_timeout; /* request timeout */ 257*0Sstevel@tonic-gate ssize_t lc_maxmem; /* memory to use */ 258*0Sstevel@tonic-gate ssize_t lc_memused; /* memory in use */ 259*0Sstevel@tonic-gate int lc_enabled; /* enabled? */ 260*0Sstevel@tonic-gate unsigned int lc_options; /* options */ 261*0Sstevel@tonic-gate #define LDAP_CACHE_OPT_CACHENOERRS 0x00000001 262*0Sstevel@tonic-gate #define LDAP_CACHE_OPT_CACHEALLERRS 0x00000002 263*0Sstevel@tonic-gate } LDAPCache; 264*0Sstevel@tonic-gate #define NULLLDCACHE ((LDAPCache *)NULL) 265*0Sstevel@tonic-gate 266*0Sstevel@tonic-gate /* 267*0Sstevel@tonic-gate * structure representing an ldap connection 268*0Sstevel@tonic-gate */ 269*0Sstevel@tonic-gate typedef struct ldap { 270*0Sstevel@tonic-gate Sockbuf ld_sb; /* socket descriptor & buffer */ 271*0Sstevel@tonic-gate char *ld_host; 272*0Sstevel@tonic-gate int ld_version; 273*0Sstevel@tonic-gate char ld_lberoptions; 274*0Sstevel@tonic-gate int ld_deref; 275*0Sstevel@tonic-gate 276*0Sstevel@tonic-gate int ld_timelimit; 277*0Sstevel@tonic-gate int ld_sizelimit; 278*0Sstevel@tonic-gate 279*0Sstevel@tonic-gate LDAPFiltDesc *ld_filtd; /* from getfilter for ufn searches */ 280*0Sstevel@tonic-gate char *ld_ufnprefix; /* for incomplete ufn's */ 281*0Sstevel@tonic-gate 282*0Sstevel@tonic-gate int ld_errno[MAX_THREAD_ID]; /* thread-specific */ 283*0Sstevel@tonic-gate #define ld_errno ld_errno[ldap_thr_index()] 284*0Sstevel@tonic-gate char *ld_error[MAX_THREAD_ID]; /* thread-specific */ 285*0Sstevel@tonic-gate #define ld_error ld_error[ldap_thr_index()] 286*0Sstevel@tonic-gate char *ld_matched[MAX_THREAD_ID]; /* thread-specific */ 287*0Sstevel@tonic-gate #define ld_matched ld_matched[ldap_thr_index()] 288*0Sstevel@tonic-gate char **ld_referrals[MAX_THREAD_ID]; /* thread-specific */ 289*0Sstevel@tonic-gate #define ld_referrals ld_referrals[ldap_thr_index()] 290*0Sstevel@tonic-gate LDAPControl **ld_ret_ctrls[MAX_THREAD_ID]; /* thread-specific */ 291*0Sstevel@tonic-gate #define ld_ret_ctrls ld_ret_ctrls[ldap_thr_index()] 292*0Sstevel@tonic-gate int ld_msgid; 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gate int ld_follow_referral; /* flag set to true if lib follow referrals */ 295*0Sstevel@tonic-gate LDAPRequest *ld_requests; /* list of outstanding requests -- referrals*/ 296*0Sstevel@tonic-gate 297*0Sstevel@tonic-gate LDAPMessage *ld_responses; /* list of outstanding responses */ 298*0Sstevel@tonic-gate int *ld_abandoned; /* array of abandoned requests */ 299*0Sstevel@tonic-gate 300*0Sstevel@tonic-gate pthread_mutex_t ld_response_mutex; /* mutex for responses part of structure */ 301*0Sstevel@tonic-gate pthread_t ld_response_lockthread; /* thread which currently holds the response lock */ 302*0Sstevel@tonic-gate int ld_response_lockcount; /* response lock depth */ 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate char *ld_attrbuffer[MAX_THREAD_ID]; 305*0Sstevel@tonic-gate #define ld_attrbuffer ld_attrbuffer[ldap_thr_index()] 306*0Sstevel@tonic-gate LDAPCache *ld_cache; /* non-null if cache is initialized */ 307*0Sstevel@tonic-gate char *ld_cldapdn; /* DN used in connectionless search */ 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate /* it is OK to change these next four values directly */ 310*0Sstevel@tonic-gate int ld_cldaptries; /* connectionless search retry count */ 311*0Sstevel@tonic-gate int ld_cldaptimeout;/* time between retries */ 312*0Sstevel@tonic-gate int ld_refhoplimit; /* limit on referral nesting */ 313*0Sstevel@tonic-gate /* LP TO CHANGE */ 314*0Sstevel@tonic-gate char ld_restart; 315*0Sstevel@tonic-gate #ifdef LDAP_SSL 316*0Sstevel@tonic-gate int ld_use_ssl; 317*0Sstevel@tonic-gate char *ld_ssl_key; 318*0Sstevel@tonic-gate #endif 319*0Sstevel@tonic-gate unsigned int ld_options; /* boolean options */ 320*0Sstevel@tonic-gate 321*0Sstevel@tonic-gate /* do not mess with the rest though */ 322*0Sstevel@tonic-gate char *ld_defhost; /* full name of default server */ 323*0Sstevel@tonic-gate int ld_defport; /* port of default server */ 324*0Sstevel@tonic-gate BERTranslateProc ld_lber_encode_translate_proc; 325*0Sstevel@tonic-gate BERTranslateProc ld_lber_decode_translate_proc; 326*0Sstevel@tonic-gate 327*0Sstevel@tonic-gate LDAPConn *ld_defconn; /* default connection */ 328*0Sstevel@tonic-gate LDAPConn *ld_conns; /* list of server connections */ 329*0Sstevel@tonic-gate void *ld_selectinfo; /* platform specifics for select */ 330*0Sstevel@tonic-gate 331*0Sstevel@tonic-gate LDAP_REBIND_FUNCTION *ld_rebindproc; 332*0Sstevel@tonic-gate void *ld_rebind_extra_arg; 333*0Sstevel@tonic-gate /* int (*ld_rebindproc)( struct ldap *ld, char **dnp, */ 334*0Sstevel@tonic-gate /* char **passwdp, int *authmethodp, int freeit ); */ 335*0Sstevel@tonic-gate /* routine to get info needed for re-bind */ 336*0Sstevel@tonic-gate 337*0Sstevel@tonic-gate pthread_mutex_t ld_ldap_mutex; /* mutex for thread dependent part of struct */ 338*0Sstevel@tonic-gate pthread_t ld_lockthread; /* thread which currently holds the lock */ 339*0Sstevel@tonic-gate int ld_lockcount; /* lock depth */ 340*0Sstevel@tonic-gate pthread_mutex_t ld_poll_mutex; /* a seperate lock for polling */ 341*0Sstevel@tonic-gate 342*0Sstevel@tonic-gate LDAPControl **ld_srvctrls; /* Controls used by ldap and server */ 343*0Sstevel@tonic-gate LDAPControl **ld_cltctrls; /* Client side controls */ 344*0Sstevel@tonic-gate 345*0Sstevel@tonic-gate /* KE: Lists of unsolicited notifications */ 346*0Sstevel@tonic-gate LDAPMessage *ld_notifs[MAX_THREAD_ID]; 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate /* How long to wait for while connecting to a server */ 349*0Sstevel@tonic-gate int ld_connect_timeout; 350*0Sstevel@tonic-gate #define ld_notifs ld_notifs[ldap_thr_index()] 351*0Sstevel@tonic-gate } _struct_LDAP; 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate /* 355*0Sstevel@tonic-gate * handy macro to check whether LDAP struct is set up for CLDAP or not 356*0Sstevel@tonic-gate */ 357*0Sstevel@tonic-gate #define LDAP_IS_CLDAP( ld ) ( ld->ld_sb.sb_naddr > 0 ) 358*0Sstevel@tonic-gate 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate #endif /* _LDAP_PRIVATE_H */ 361