17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 37c478bd9Sstevel@tonic-gate * Use is subject to license terms. 47c478bd9Sstevel@tonic-gate */ 57c478bd9Sstevel@tonic-gate 67c478bd9Sstevel@tonic-gate /* 77c478bd9Sstevel@tonic-gate * The contents of this file are subject to the Netscape Public 87c478bd9Sstevel@tonic-gate * License Version 1.1 (the "License"); you may not use this file 97c478bd9Sstevel@tonic-gate * except in compliance with the License. You may obtain a copy of 107c478bd9Sstevel@tonic-gate * the License at http://www.mozilla.org/NPL/ 117c478bd9Sstevel@tonic-gate * 127c478bd9Sstevel@tonic-gate * Software distributed under the License is distributed on an "AS 137c478bd9Sstevel@tonic-gate * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 147c478bd9Sstevel@tonic-gate * implied. See the License for the specific language governing 157c478bd9Sstevel@tonic-gate * rights and limitations under the License. 167c478bd9Sstevel@tonic-gate * 177c478bd9Sstevel@tonic-gate * The Original Code is Mozilla Communicator client code, released 187c478bd9Sstevel@tonic-gate * March 31, 1998. 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * The Initial Developer of the Original Code is Netscape 217c478bd9Sstevel@tonic-gate * Communications Corporation. Portions created by Netscape are 227c478bd9Sstevel@tonic-gate * Copyright (C) 1998-1999 Netscape Communications Corporation. All 237c478bd9Sstevel@tonic-gate * Rights Reserved. 247c478bd9Sstevel@tonic-gate * 257c478bd9Sstevel@tonic-gate * Contributor(s): 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifndef _LDAPINT_H 297c478bd9Sstevel@tonic-gate #define _LDAPINT_H 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <stdio.h> 327c478bd9Sstevel@tonic-gate #include <string.h> 337c478bd9Sstevel@tonic-gate #include <stdlib.h> 347c478bd9Sstevel@tonic-gate #include <errno.h> 357c478bd9Sstevel@tonic-gate #include <time.h> 367c478bd9Sstevel@tonic-gate #include <fcntl.h> 377c478bd9Sstevel@tonic-gate #ifdef hpux 387c478bd9Sstevel@tonic-gate #include <strings.h> 397c478bd9Sstevel@tonic-gate #endif /* hpux */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef _WINDOWS 427c478bd9Sstevel@tonic-gate # define FD_SETSIZE 256 /* number of connections we support */ 437c478bd9Sstevel@tonic-gate # define WIN32_LEAN_AND_MEAN 447c478bd9Sstevel@tonic-gate # include <windows.h> 457c478bd9Sstevel@tonic-gate #elif defined(macintosh) 467c478bd9Sstevel@tonic-gate #include "ldap-macos.h" 477c478bd9Sstevel@tonic-gate #elif defined(XP_OS2) 487c478bd9Sstevel@tonic-gate #include <os2sock.h> 497c478bd9Sstevel@tonic-gate #else /* _WINDOWS */ 507c478bd9Sstevel@tonic-gate # include <sys/time.h> 517c478bd9Sstevel@tonic-gate # include <sys/types.h> 527c478bd9Sstevel@tonic-gate # include <sys/socket.h> 537c478bd9Sstevel@tonic-gate # include <netinet/in.h> 547c478bd9Sstevel@tonic-gate # include <arpa/inet.h> 557c478bd9Sstevel@tonic-gate # include <netdb.h> 567c478bd9Sstevel@tonic-gate #if !defined(hpux) && !defined(SUNOS4) && !defined(LINUX) 577c478bd9Sstevel@tonic-gate # include <sys/select.h> 587c478bd9Sstevel@tonic-gate #endif /* !defined(hpux) and others */ 597c478bd9Sstevel@tonic-gate #endif /* _WINDOWS */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate #if defined(IRIX) 627c478bd9Sstevel@tonic-gate #include <bstring.h> 637c478bd9Sstevel@tonic-gate #endif /* IRIX */ 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate #define NSLBERI_LBER_INT_FRIEND 667c478bd9Sstevel@tonic-gate #ifdef macintosh 677c478bd9Sstevel@tonic-gate #include "lber-int.h" 687c478bd9Sstevel@tonic-gate #elif defined(_SOLARIS_SDK) 697c478bd9Sstevel@tonic-gate #include "../ber/lber-int.h" 707c478bd9Sstevel@tonic-gate #else /* _SOLARIS_SDK */ 717c478bd9Sstevel@tonic-gate #include "../liblber/lber-int.h" 727c478bd9Sstevel@tonic-gate #endif /* macintosh */ 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #include "ldap.h" 757c478bd9Sstevel@tonic-gate #include "ldaprot.h" 767c478bd9Sstevel@tonic-gate #include "ldaplog.h" 777c478bd9Sstevel@tonic-gate #include "portable.h" 787c478bd9Sstevel@tonic-gate #include "regex.h" 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate #ifdef LDAP_ASYNC_IO 817c478bd9Sstevel@tonic-gate #ifdef NEED_FILIO 827c478bd9Sstevel@tonic-gate #include <sys/filio.h> /* to get FIONBIO for ioctl() call */ 837c478bd9Sstevel@tonic-gate #else /* NEED_FILIO */ 847c478bd9Sstevel@tonic-gate #if !defined( _WINDOWS) && !defined (macintosh) 857c478bd9Sstevel@tonic-gate #include <sys/ioctl.h> /* to get FIONBIO for ioctl() call */ 867c478bd9Sstevel@tonic-gate #endif /* _WINDOWS && macintosh */ 877c478bd9Sstevel@tonic-gate #endif /* NEED_FILIO */ 887c478bd9Sstevel@tonic-gate #endif /* LDAP_ASYNC_IO */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #ifdef USE_SYSCONF 917c478bd9Sstevel@tonic-gate # include <unistd.h> 927c478bd9Sstevel@tonic-gate #endif /* USE_SYSCONF */ 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 957c478bd9Sstevel@tonic-gate #include <libintl.h> 967c478bd9Sstevel@tonic-gate #endif 977c478bd9Sstevel@tonic-gate #ifdef LDAP_SASLIO_HOOKS 987c478bd9Sstevel@tonic-gate #include <sasl/sasl.h> 997c478bd9Sstevel@tonic-gate #define SASL_MAX_BUFF_SIZE 65536 1007c478bd9Sstevel@tonic-gate #define SASL_MIN_BUFF_SIZE 4096 1017c478bd9Sstevel@tonic-gate #endif 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #if !defined(_WINDOWS) && !defined(macintosh) && !defined(LINUX) && !defined(BSDI) 1047c478bd9Sstevel@tonic-gate #define NSLDAPI_HAVE_POLL 1 1057c478bd9Sstevel@tonic-gate #endif 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate /* SSL version, or 0 if not built with SSL */ 1087c478bd9Sstevel@tonic-gate #if defined(NET_SSL) 1097c478bd9Sstevel@tonic-gate # define SSL_VERSION 3 1107c478bd9Sstevel@tonic-gate #else 1117c478bd9Sstevel@tonic-gate # define SSL_VERSION 0 1127c478bd9Sstevel@tonic-gate #endif 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #define LDAP_URL_URLCOLON "URL:" 1167c478bd9Sstevel@tonic-gate #define LDAP_URL_URLCOLON_LEN 4 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate #define LDAP_LDAP_REF_STR LDAP_URL_PREFIX 1197c478bd9Sstevel@tonic-gate #define LDAP_LDAP_REF_STR_LEN LDAP_URL_PREFIX_LEN 1207c478bd9Sstevel@tonic-gate #define LDAP_LDAPS_REF_STR LDAPS_URL_PREFIX 1217c478bd9Sstevel@tonic-gate #define LDAP_LDAPS_REF_STR_LEN LDAPS_URL_PREFIX_LEN 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate /* default limit on nesting of referrals */ 1247c478bd9Sstevel@tonic-gate #define LDAP_DEFAULT_REFHOPLIMIT 5 1257c478bd9Sstevel@tonic-gate #ifdef LDAP_DNS 1267c478bd9Sstevel@tonic-gate #define LDAP_DX_REF_STR "dx://" 1277c478bd9Sstevel@tonic-gate #define LDAP_DX_REF_STR_LEN 5 1287c478bd9Sstevel@tonic-gate #endif /* LDAP_DNS */ 1297c478bd9Sstevel@tonic-gate 130*1da57d55SToomas Soome typedef enum { 131*1da57d55SToomas Soome LDAP_CACHE_LOCK, 132*1da57d55SToomas Soome LDAP_MEMCACHE_LOCK, 1337c478bd9Sstevel@tonic-gate LDAP_MSGID_LOCK, 134*1da57d55SToomas Soome LDAP_REQ_LOCK, 135*1da57d55SToomas Soome LDAP_RESP_LOCK, 136*1da57d55SToomas Soome LDAP_ABANDON_LOCK, 1377c478bd9Sstevel@tonic-gate LDAP_CTRL_LOCK, 138*1da57d55SToomas Soome LDAP_OPTION_LOCK, 139*1da57d55SToomas Soome LDAP_ERR_LOCK, 140*1da57d55SToomas Soome LDAP_CONN_LOCK, 1417c478bd9Sstevel@tonic-gate LDAP_IOSTATUS_LOCK, /* serializes access to ld->ld_iostatus */ 142*1da57d55SToomas Soome LDAP_RESULT_LOCK, 143*1da57d55SToomas Soome LDAP_PEND_LOCK, 144*1da57d55SToomas Soome LDAP_THREADID_LOCK, 1457c478bd9Sstevel@tonic-gate #ifdef LDAP_SASLIO_HOOKS 146*1da57d55SToomas Soome LDAP_SASL_LOCK, 1477c478bd9Sstevel@tonic-gate #endif 148*1da57d55SToomas Soome LDAP_MAX_LOCK 1497c478bd9Sstevel@tonic-gate } LDAPLock; 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate /* 1527c478bd9Sstevel@tonic-gate * This structure represents both ldap messages and ldap responses. 1537c478bd9Sstevel@tonic-gate * These are really the same, except in the case of search responses, 1547c478bd9Sstevel@tonic-gate * where a response has multiple messages. 1557c478bd9Sstevel@tonic-gate */ 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate struct ldapmsg { 1587c478bd9Sstevel@tonic-gate int lm_msgid; /* the message id */ 1597c478bd9Sstevel@tonic-gate int lm_msgtype; /* the message type */ 1607c478bd9Sstevel@tonic-gate BerElement *lm_ber; /* the ber encoded message contents */ 1617c478bd9Sstevel@tonic-gate struct ldapmsg *lm_chain; /* for search - next msg in the resp */ 1627c478bd9Sstevel@tonic-gate struct ldapmsg *lm_next; /* next response */ 1637c478bd9Sstevel@tonic-gate int lm_fromcache; /* memcache: origin of message */ 1647c478bd9Sstevel@tonic-gate }; 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate /* 1677c478bd9Sstevel@tonic-gate * structure for tracking LDAP server host, ports, DNs, etc. 1687c478bd9Sstevel@tonic-gate */ 1697c478bd9Sstevel@tonic-gate typedef struct ldap_server { 1707c478bd9Sstevel@tonic-gate char *lsrv_host; 1717c478bd9Sstevel@tonic-gate char *lsrv_dn; /* if NULL, use default */ 1727c478bd9Sstevel@tonic-gate int lsrv_port; 1737c478bd9Sstevel@tonic-gate unsigned long lsrv_options; /* boolean options */ 1747c478bd9Sstevel@tonic-gate #define LDAP_SRV_OPT_SECURE 0x01 1757c478bd9Sstevel@tonic-gate struct ldap_server *lsrv_next; 1767c478bd9Sstevel@tonic-gate } LDAPServer; 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate /* 1797c478bd9Sstevel@tonic-gate * structure for representing an LDAP server connection 1807c478bd9Sstevel@tonic-gate */ 1817c478bd9Sstevel@tonic-gate typedef struct ldap_conn { 1827c478bd9Sstevel@tonic-gate Sockbuf *lconn_sb; 1837c478bd9Sstevel@tonic-gate BerElement *lconn_ber; /* non-NULL if in midst of msg. */ 1847c478bd9Sstevel@tonic-gate int lconn_version; /* LDAP protocol version */ 1857c478bd9Sstevel@tonic-gate int lconn_refcnt; 1867c478bd9Sstevel@tonic-gate unsigned long lconn_lastused; /* time */ 1877c478bd9Sstevel@tonic-gate int lconn_status; 1887c478bd9Sstevel@tonic-gate #define LDAP_CONNST_NEEDSOCKET 1 1897c478bd9Sstevel@tonic-gate #define LDAP_CONNST_CONNECTING 2 1907c478bd9Sstevel@tonic-gate #define LDAP_CONNST_CONNECTED 3 1917c478bd9Sstevel@tonic-gate #define LDAP_CONNST_DEAD 4 1927c478bd9Sstevel@tonic-gate LDAPServer *lconn_server; 1937c478bd9Sstevel@tonic-gate char *lconn_binddn; /* DN of last successful bind */ 1947c478bd9Sstevel@tonic-gate int lconn_bound; /* has a bind been done? */ 1957c478bd9Sstevel@tonic-gate char *lconn_krbinstance; 1967c478bd9Sstevel@tonic-gate struct ldap_conn *lconn_next; 1977c478bd9Sstevel@tonic-gate } LDAPConn; 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate /* 2017c478bd9Sstevel@tonic-gate * structure used to track outstanding requests 2027c478bd9Sstevel@tonic-gate */ 2037c478bd9Sstevel@tonic-gate typedef struct ldapreq { 2047c478bd9Sstevel@tonic-gate int lr_msgid; /* the message id */ 2057c478bd9Sstevel@tonic-gate int lr_status; /* status of request */ 2067c478bd9Sstevel@tonic-gate #define LDAP_REQST_INPROGRESS 1 2077c478bd9Sstevel@tonic-gate #define LDAP_REQST_CHASINGREFS 2 2087c478bd9Sstevel@tonic-gate #define LDAP_REQST_NOTCONNECTED 3 2097c478bd9Sstevel@tonic-gate #define LDAP_REQST_WRITING 4 2107c478bd9Sstevel@tonic-gate #define LDAP_REQST_CONNDEAD 5 /* associated conn. has failed */ 2117c478bd9Sstevel@tonic-gate int lr_outrefcnt; /* count of outstanding referrals */ 2127c478bd9Sstevel@tonic-gate int lr_origid; /* original request's message id */ 2137c478bd9Sstevel@tonic-gate int lr_parentcnt; /* count of parent requests */ 2147c478bd9Sstevel@tonic-gate int lr_res_msgtype; /* result message type */ 2157c478bd9Sstevel@tonic-gate int lr_res_errno; /* result LDAP errno */ 2167c478bd9Sstevel@tonic-gate char *lr_res_error; /* result error string */ 2177c478bd9Sstevel@tonic-gate char *lr_res_matched;/* result matched DN string */ 2187c478bd9Sstevel@tonic-gate BerElement *lr_ber; /* ber encoded request contents */ 2197c478bd9Sstevel@tonic-gate LDAPConn *lr_conn; /* connection used to send request */ 2207c478bd9Sstevel@tonic-gate char *lr_binddn; /* request is a bind for this DN */ 2217c478bd9Sstevel@tonic-gate struct ldapreq *lr_parent; /* request that spawned this referral */ 2227c478bd9Sstevel@tonic-gate struct ldapreq *lr_child; /* list of requests we spawned */ 2237c478bd9Sstevel@tonic-gate struct ldapreq *lr_sibling; /* next referral spawned */ 2247c478bd9Sstevel@tonic-gate struct ldapreq *lr_prev; /* ld->ld_requests previous request */ 2257c478bd9Sstevel@tonic-gate struct ldapreq *lr_next; /* ld->ld_requests next request */ 2267c478bd9Sstevel@tonic-gate } LDAPRequest; 2277c478bd9Sstevel@tonic-gate 2287c478bd9Sstevel@tonic-gate typedef struct ldappend { 2297c478bd9Sstevel@tonic-gate void *lp_sema; /* semaphore to post */ 2307c478bd9Sstevel@tonic-gate int lp_msgid; /* message id */ 2317c478bd9Sstevel@tonic-gate LDAPMessage *lp_result; /* result storage */ 2327c478bd9Sstevel@tonic-gate struct ldappend *lp_prev; /* previous pending */ 2337c478bd9Sstevel@tonic-gate struct ldappend *lp_next; /* next pending */ 2347c478bd9Sstevel@tonic-gate } LDAPPend; 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate /* 2377c478bd9Sstevel@tonic-gate * forward declaration for I/O status structure (defined in os-ip.c) 2387c478bd9Sstevel@tonic-gate */ 2397c478bd9Sstevel@tonic-gate typedef struct nsldapi_iostatus_info NSLDAPIIOStatus; 2407c478bd9Sstevel@tonic-gate 2417c478bd9Sstevel@tonic-gate /* 2427c478bd9Sstevel@tonic-gate * old extended IO structure (before writev callback was added) 2437c478bd9Sstevel@tonic-gate */ 2447c478bd9Sstevel@tonic-gate struct ldap_x_ext_io_fns_rev0 { 2457c478bd9Sstevel@tonic-gate int lextiof_size; 2467c478bd9Sstevel@tonic-gate LDAP_X_EXTIOF_CONNECT_CALLBACK *lextiof_connect; 2477c478bd9Sstevel@tonic-gate LDAP_X_EXTIOF_CLOSE_CALLBACK *lextiof_close; 2487c478bd9Sstevel@tonic-gate LDAP_X_EXTIOF_READ_CALLBACK *lextiof_read; 2497c478bd9Sstevel@tonic-gate LDAP_X_EXTIOF_WRITE_CALLBACK *lextiof_write; 2507c478bd9Sstevel@tonic-gate LDAP_X_EXTIOF_POLL_CALLBACK *lextiof_poll; 2517c478bd9Sstevel@tonic-gate LDAP_X_EXTIOF_NEWHANDLE_CALLBACK *lextiof_newhandle; 2527c478bd9Sstevel@tonic-gate LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *lextiof_disposehandle; 2537c478bd9Sstevel@tonic-gate void *lextiof_session_arg; 2547c478bd9Sstevel@tonic-gate }; 2557c478bd9Sstevel@tonic-gate #define LDAP_X_EXTIO_FNS_SIZE_REV0 sizeof(struct ldap_x_ext_io_fns_rev0) 2567c478bd9Sstevel@tonic-gate 2577c478bd9Sstevel@tonic-gate /* 2587c478bd9Sstevel@tonic-gate * structure representing an ldap connection 2597c478bd9Sstevel@tonic-gate */ 2607c478bd9Sstevel@tonic-gate struct ldap { 2617c478bd9Sstevel@tonic-gate struct sockbuf *ld_sbp; /* pointer to socket desc. & buffer */ 2627c478bd9Sstevel@tonic-gate char *ld_host; 2637c478bd9Sstevel@tonic-gate int ld_version; /* LDAP protocol version */ 2647c478bd9Sstevel@tonic-gate char ld_lberoptions; 2657c478bd9Sstevel@tonic-gate int ld_deref; 2667c478bd9Sstevel@tonic-gate 2677c478bd9Sstevel@tonic-gate int ld_timelimit; 2687c478bd9Sstevel@tonic-gate int ld_sizelimit; 2697c478bd9Sstevel@tonic-gate 2707c478bd9Sstevel@tonic-gate struct ldap_filt_desc *ld_filtd; /* from getfilter for ufn searches */ 2717c478bd9Sstevel@tonic-gate char *ld_ufnprefix; /* for incomplete ufn's */ 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate int ld_errno; 2747c478bd9Sstevel@tonic-gate char *ld_error; 2757c478bd9Sstevel@tonic-gate char *ld_matched; 2767c478bd9Sstevel@tonic-gate int ld_msgid; 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate /* do not mess with these */ 2797c478bd9Sstevel@tonic-gate LDAPRequest *ld_requests; /* list of outstanding requests */ 2807c478bd9Sstevel@tonic-gate LDAPMessage *ld_responses; /* list of outstanding responses */ 2817c478bd9Sstevel@tonic-gate int *ld_abandoned; /* array of abandoned requests */ 2827c478bd9Sstevel@tonic-gate char *ld_cldapdn; /* DN used in connectionless search */ 2837c478bd9Sstevel@tonic-gate 2847c478bd9Sstevel@tonic-gate /* it is OK to change these next four values directly */ 2857c478bd9Sstevel@tonic-gate int ld_cldaptries; /* connectionless search retry count */ 2867c478bd9Sstevel@tonic-gate int ld_cldaptimeout;/* time between retries */ 2877c478bd9Sstevel@tonic-gate int ld_refhoplimit; /* limit on referral nesting */ 2887c478bd9Sstevel@tonic-gate unsigned long ld_options; /* boolean options */ 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate #define LDAP_BITOPT_REFERRALS 0x80000000 2917c478bd9Sstevel@tonic-gate #define LDAP_BITOPT_SSL 0x40000000 2927c478bd9Sstevel@tonic-gate #define LDAP_BITOPT_DNS 0x20000000 2937c478bd9Sstevel@tonic-gate #define LDAP_BITOPT_RESTART 0x10000000 2947c478bd9Sstevel@tonic-gate #define LDAP_BITOPT_RECONNECT 0x08000000 2957c478bd9Sstevel@tonic-gate #define LDAP_BITOPT_ASYNC 0x04000000 2967c478bd9Sstevel@tonic-gate 2977c478bd9Sstevel@tonic-gate /* do not mess with the rest though */ 2987c478bd9Sstevel@tonic-gate char *ld_defhost; /* full name of default server */ 2997c478bd9Sstevel@tonic-gate int ld_defport; /* port of default server */ 3007c478bd9Sstevel@tonic-gate BERTranslateProc ld_lber_encode_translate_proc; 3017c478bd9Sstevel@tonic-gate BERTranslateProc ld_lber_decode_translate_proc; 3027c478bd9Sstevel@tonic-gate LDAPConn *ld_defconn; /* default connection */ 3037c478bd9Sstevel@tonic-gate LDAPConn *ld_conns; /* list of all server connections */ 3047c478bd9Sstevel@tonic-gate NSLDAPIIOStatus *ld_iostatus; /* status info. about network sockets */ 3057c478bd9Sstevel@tonic-gate LDAP_REBINDPROC_CALLBACK *ld_rebind_fn; 3067c478bd9Sstevel@tonic-gate void *ld_rebind_arg; 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gate /* function pointers, etc. for extended I/O */ 3097c478bd9Sstevel@tonic-gate struct ldap_x_ext_io_fns ld_ext_io_fns; 3107c478bd9Sstevel@tonic-gate #define ld_extio_size ld_ext_io_fns.lextiof_size 3117c478bd9Sstevel@tonic-gate #define ld_extclose_fn ld_ext_io_fns.lextiof_close 3127c478bd9Sstevel@tonic-gate #define ld_extconnect_fn ld_ext_io_fns.lextiof_connect 3137c478bd9Sstevel@tonic-gate #define ld_extread_fn ld_ext_io_fns.lextiof_read 3147c478bd9Sstevel@tonic-gate #define ld_extwrite_fn ld_ext_io_fns.lextiof_write 3157c478bd9Sstevel@tonic-gate #define ld_extwritev_fn ld_ext_io_fns.lextiof_writev 3167c478bd9Sstevel@tonic-gate #define ld_extpoll_fn ld_ext_io_fns.lextiof_poll 3177c478bd9Sstevel@tonic-gate #define ld_extnewhandle_fn ld_ext_io_fns.lextiof_newhandle 3187c478bd9Sstevel@tonic-gate #define ld_extdisposehandle_fn ld_ext_io_fns.lextiof_disposehandle 3197c478bd9Sstevel@tonic-gate #define ld_ext_session_arg ld_ext_io_fns.lextiof_session_arg 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate /* allocated pointer for older I/O functions */ 3227c478bd9Sstevel@tonic-gate struct ldap_io_fns *ld_io_fns_ptr; 3237c478bd9Sstevel@tonic-gate #define NSLDAPI_USING_CLASSIC_IO_FUNCTIONS( ld ) ((ld)->ld_io_fns_ptr != NULL) 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* function pointers, etc. for DNS */ 3267c478bd9Sstevel@tonic-gate struct ldap_dns_fns ld_dnsfn; 3277c478bd9Sstevel@tonic-gate #define ld_dns_extradata ld_dnsfn.lddnsfn_extradata 3287c478bd9Sstevel@tonic-gate #define ld_dns_bufsize ld_dnsfn.lddnsfn_bufsize 3297c478bd9Sstevel@tonic-gate #define ld_dns_gethostbyname_fn ld_dnsfn.lddnsfn_gethostbyname 3307c478bd9Sstevel@tonic-gate #define ld_dns_gethostbyaddr_fn ld_dnsfn.lddnsfn_gethostbyaddr 3317c478bd9Sstevel@tonic-gate #define ld_dns_getpeername_fn ld_dnsfn.lddnsfn_getpeername 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate /* function pointers, etc. for threading */ 3347c478bd9Sstevel@tonic-gate struct ldap_thread_fns ld_thread; 3357c478bd9Sstevel@tonic-gate #define ld_mutex_alloc_fn ld_thread.ltf_mutex_alloc 3367c478bd9Sstevel@tonic-gate #define ld_mutex_free_fn ld_thread.ltf_mutex_free 3377c478bd9Sstevel@tonic-gate #define ld_mutex_lock_fn ld_thread.ltf_mutex_lock 3387c478bd9Sstevel@tonic-gate #define ld_mutex_unlock_fn ld_thread.ltf_mutex_unlock 3397c478bd9Sstevel@tonic-gate #define ld_get_errno_fn ld_thread.ltf_get_errno 3407c478bd9Sstevel@tonic-gate #define ld_set_errno_fn ld_thread.ltf_set_errno 3417c478bd9Sstevel@tonic-gate #define ld_get_lderrno_fn ld_thread.ltf_get_lderrno 3427c478bd9Sstevel@tonic-gate #define ld_set_lderrno_fn ld_thread.ltf_set_lderrno 3437c478bd9Sstevel@tonic-gate #define ld_lderrno_arg ld_thread.ltf_lderrno_arg 3447c478bd9Sstevel@tonic-gate void **ld_mutex; 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate /* function pointers, etc. for caching */ 3477c478bd9Sstevel@tonic-gate int ld_cache_on; 3487c478bd9Sstevel@tonic-gate int ld_cache_strategy; 3497c478bd9Sstevel@tonic-gate struct ldap_cache_fns ld_cache; 3507c478bd9Sstevel@tonic-gate #define ld_cache_config ld_cache.lcf_config 3517c478bd9Sstevel@tonic-gate #define ld_cache_bind ld_cache.lcf_bind 3527c478bd9Sstevel@tonic-gate #define ld_cache_unbind ld_cache.lcf_unbind 3537c478bd9Sstevel@tonic-gate #define ld_cache_search ld_cache.lcf_search 3547c478bd9Sstevel@tonic-gate #define ld_cache_compare ld_cache.lcf_compare 3557c478bd9Sstevel@tonic-gate #define ld_cache_add ld_cache.lcf_add 3567c478bd9Sstevel@tonic-gate #define ld_cache_delete ld_cache.lcf_delete 3577c478bd9Sstevel@tonic-gate #if 0 3587c478bd9Sstevel@tonic-gate #define ld_cache_rename ld_cache.lcf_rename 3597c478bd9Sstevel@tonic-gate #endif 3607c478bd9Sstevel@tonic-gate #define ld_cache_modify ld_cache.lcf_modify 3617c478bd9Sstevel@tonic-gate #define ld_cache_modrdn ld_cache.lcf_modrdn 3627c478bd9Sstevel@tonic-gate #define ld_cache_abandon ld_cache.lcf_abandon 3637c478bd9Sstevel@tonic-gate #define ld_cache_result ld_cache.lcf_result 3647c478bd9Sstevel@tonic-gate #define ld_cache_flush ld_cache.lcf_flush 3657c478bd9Sstevel@tonic-gate #define ld_cache_arg ld_cache.lcf_arg 3667c478bd9Sstevel@tonic-gate 3677c478bd9Sstevel@tonic-gate /* ldapv3 controls */ 3687c478bd9Sstevel@tonic-gate LDAPControl **ld_servercontrols; 3697c478bd9Sstevel@tonic-gate LDAPControl **ld_clientcontrols; 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate /* Preferred language */ 3727c478bd9Sstevel@tonic-gate char *ld_preferred_language; 3737c478bd9Sstevel@tonic-gate 3747c478bd9Sstevel@tonic-gate /* MemCache */ 3757c478bd9Sstevel@tonic-gate LDAPMemCache *ld_memcache; 3767c478bd9Sstevel@tonic-gate 3777c478bd9Sstevel@tonic-gate /* Pending results */ 3787c478bd9Sstevel@tonic-gate LDAPPend *ld_pend; /* list of pending results */ 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate /* extra thread function pointers */ 3817c478bd9Sstevel@tonic-gate struct ldap_extra_thread_fns ld_thread2; 3827c478bd9Sstevel@tonic-gate 3837c478bd9Sstevel@tonic-gate /* With the 4.0 version of the LDAP SDK */ 3847c478bd9Sstevel@tonic-gate /* the extra thread functions except for */ 3857c478bd9Sstevel@tonic-gate /* the ld_threadid_fn has been disabled */ 3867c478bd9Sstevel@tonic-gate /* Look at the release notes for the full */ 3877c478bd9Sstevel@tonic-gate /* explanation */ 3887c478bd9Sstevel@tonic-gate #define ld_mutex_trylock_fn ld_thread2.ltf_mutex_trylock 3897c478bd9Sstevel@tonic-gate #define ld_sema_alloc_fn ld_thread2.ltf_sema_alloc 3907c478bd9Sstevel@tonic-gate #define ld_sema_free_fn ld_thread2.ltf_sema_free 3917c478bd9Sstevel@tonic-gate #define ld_sema_wait_fn ld_thread2.ltf_sema_wait 3927c478bd9Sstevel@tonic-gate #define ld_sema_post_fn ld_thread2.ltf_sema_post 3937c478bd9Sstevel@tonic-gate #define ld_threadid_fn ld_thread2.ltf_threadid_fn 3947c478bd9Sstevel@tonic-gate 3957c478bd9Sstevel@tonic-gate /* extra data for mutex handling in referrals */ 3967c478bd9Sstevel@tonic-gate void *ld_mutex_threadid[LDAP_MAX_LOCK]; 3977c478bd9Sstevel@tonic-gate unsigned long ld_mutex_refcnt[LDAP_MAX_LOCK]; 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate /* connect timeout value (milliseconds) */ 4007c478bd9Sstevel@tonic-gate int ld_connect_timeout; 4017c478bd9Sstevel@tonic-gate 4027c478bd9Sstevel@tonic-gate #ifdef LDAP_SASLIO_HOOKS 4037c478bd9Sstevel@tonic-gate /* SASL default option settings */ 4047c478bd9Sstevel@tonic-gate char *ld_def_sasl_mech; 4057c478bd9Sstevel@tonic-gate char *ld_def_sasl_realm; 4067c478bd9Sstevel@tonic-gate char *ld_def_sasl_authcid; 4077c478bd9Sstevel@tonic-gate char *ld_def_sasl_authzid; 4087c478bd9Sstevel@tonic-gate /* SASL Security properties */ 4097c478bd9Sstevel@tonic-gate struct sasl_security_properties ld_sasl_secprops; 4107c478bd9Sstevel@tonic-gate /* prldap shadow io functions */ 4117c478bd9Sstevel@tonic-gate struct ldap_x_ext_io_fns ld_sasl_io_fns; 4127c478bd9Sstevel@tonic-gate #endif 4137c478bd9Sstevel@tonic-gate }; 4147c478bd9Sstevel@tonic-gate 4157c478bd9Sstevel@tonic-gate /* allocate/free mutex */ 4167c478bd9Sstevel@tonic-gate #define LDAP_MUTEX_ALLOC( ld ) \ 4177c478bd9Sstevel@tonic-gate (((ld)->ld_mutex_alloc_fn != NULL) ? (ld)->ld_mutex_alloc_fn() : NULL) 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate /* allocate/free mutex */ 4207c478bd9Sstevel@tonic-gate #define LDAP_MUTEX_FREE( ld, m ) \ 4217c478bd9Sstevel@tonic-gate if ( (ld)->ld_mutex_free_fn != NULL && m != NULL ) { \ 4227c478bd9Sstevel@tonic-gate (ld)->ld_mutex_free_fn( m ); \ 4237c478bd9Sstevel@tonic-gate } 4247c478bd9Sstevel@tonic-gate 4257c478bd9Sstevel@tonic-gate /* enter/exit critical sections */ 4267c478bd9Sstevel@tonic-gate /* 4277c478bd9Sstevel@tonic-gate * The locks assume that the locks are thread safe. XXXmcs: which means??? 4287c478bd9Sstevel@tonic-gate * 4297c478bd9Sstevel@tonic-gate * Note that we test for both ld_mutex_lock_fn != NULL AND ld_mutex != NULL. 4307c478bd9Sstevel@tonic-gate * This is necessary because there is a window in ldap_init() between the 4317c478bd9Sstevel@tonic-gate * time we set the ld_mutex_lock_fn pointer and the time we allocate the 4327c478bd9Sstevel@tonic-gate * mutexes in which external code COULD be called which COULD make a call to 4337c478bd9Sstevel@tonic-gate * something like ldap_get_option(), which uses LDAP_MUTEX_LOCK(). The 4347c478bd9Sstevel@tonic-gate * libprldap code does this in its newhandle callback (prldap_newhandle). 4357c478bd9Sstevel@tonic-gate */ 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate #define LDAP_MUTEX_LOCK(ld, lock) \ 4387c478bd9Sstevel@tonic-gate if ((ld)->ld_mutex_lock_fn != NULL && ld->ld_mutex != NULL) { \ 4397c478bd9Sstevel@tonic-gate if ((ld)->ld_threadid_fn != NULL) { \ 4407c478bd9Sstevel@tonic-gate if ((ld)->ld_mutex_threadid[lock] == (ld)->ld_threadid_fn()) { \ 4417c478bd9Sstevel@tonic-gate (ld)->ld_mutex_refcnt[lock]++; \ 4427c478bd9Sstevel@tonic-gate } else { \ 4437c478bd9Sstevel@tonic-gate (ld)->ld_mutex_lock_fn(ld->ld_mutex[lock]); \ 4447c478bd9Sstevel@tonic-gate (ld)->ld_mutex_threadid[lock] = ld->ld_threadid_fn(); \ 4457c478bd9Sstevel@tonic-gate (ld)->ld_mutex_refcnt[lock] = 1; \ 4467c478bd9Sstevel@tonic-gate } \ 4477c478bd9Sstevel@tonic-gate } else { \ 4487c478bd9Sstevel@tonic-gate (ld)->ld_mutex_lock_fn(ld->ld_mutex[lock]); \ 4497c478bd9Sstevel@tonic-gate } \ 450*1da57d55SToomas Soome } 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gate #define LDAP_MUTEX_UNLOCK(ld, lock) \ 4537c478bd9Sstevel@tonic-gate if ((ld)->ld_mutex_lock_fn != NULL && ld->ld_mutex != NULL) { \ 4547c478bd9Sstevel@tonic-gate if ((ld)->ld_threadid_fn != NULL) { \ 4557c478bd9Sstevel@tonic-gate if ((ld)->ld_mutex_threadid[lock] == (ld)->ld_threadid_fn()) { \ 4567c478bd9Sstevel@tonic-gate (ld)->ld_mutex_refcnt[lock]--; \ 4577c478bd9Sstevel@tonic-gate if ((ld)->ld_mutex_refcnt[lock] <= 0) { \ 4587c478bd9Sstevel@tonic-gate (ld)->ld_mutex_threadid[lock] = (void *) -1; \ 4597c478bd9Sstevel@tonic-gate (ld)->ld_mutex_refcnt[lock] = 0; \ 4607c478bd9Sstevel@tonic-gate (ld)->ld_mutex_unlock_fn(ld->ld_mutex[lock]); \ 4617c478bd9Sstevel@tonic-gate } \ 4627c478bd9Sstevel@tonic-gate } \ 4637c478bd9Sstevel@tonic-gate } else { \ 4647c478bd9Sstevel@tonic-gate ld->ld_mutex_unlock_fn(ld->ld_mutex[lock]); \ 4657c478bd9Sstevel@tonic-gate } \ 4667c478bd9Sstevel@tonic-gate } 4677c478bd9Sstevel@tonic-gate 4687c478bd9Sstevel@tonic-gate /* Backward compatibility locks */ 4697c478bd9Sstevel@tonic-gate #define LDAP_MUTEX_BC_LOCK( ld, i ) \ 4707c478bd9Sstevel@tonic-gate /* the ld_mutex_trylock_fn is always set to NULL */ \ 4717c478bd9Sstevel@tonic-gate /* in setoption.c as the extra thread functions were */ \ 4727c478bd9Sstevel@tonic-gate /* turned off in the 4.0 SDK. This check will */ \ 4737c478bd9Sstevel@tonic-gate /* always be true */ \ 4747c478bd9Sstevel@tonic-gate if( (ld)->ld_mutex_trylock_fn == NULL ) { \ 4757c478bd9Sstevel@tonic-gate LDAP_MUTEX_LOCK( ld, i ) ; \ 4767c478bd9Sstevel@tonic-gate } 4777c478bd9Sstevel@tonic-gate #define LDAP_MUTEX_BC_UNLOCK( ld, i ) \ 4787c478bd9Sstevel@tonic-gate /* the ld_mutex_trylock_fn is always set to NULL */ \ 4797c478bd9Sstevel@tonic-gate /* in setoption.c as the extra thread functions were */ \ 4807c478bd9Sstevel@tonic-gate /* turned off in the 4.0 SDK. This check will */ \ 4817c478bd9Sstevel@tonic-gate /* always be true */ \ 4827c478bd9Sstevel@tonic-gate if( (ld)->ld_mutex_trylock_fn == NULL ) { \ 4837c478bd9Sstevel@tonic-gate LDAP_MUTEX_UNLOCK( ld, i ) ; \ 4847c478bd9Sstevel@tonic-gate } 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate /* allocate/free semaphore */ 4877c478bd9Sstevel@tonic-gate #define LDAP_SEMA_ALLOC( ld ) \ 4887c478bd9Sstevel@tonic-gate (((ld)->ld_sema_alloc_fn != NULL) ? (ld)->ld_sema_alloc_fn() : NULL) 4897c478bd9Sstevel@tonic-gate #define LDAP_SEMA_FREE( ld, m ) \ 4907c478bd9Sstevel@tonic-gate if ( (ld)->ld_sema_free_fn != NULL && m != NULL ) { \ 4917c478bd9Sstevel@tonic-gate (ld)->ld_sema_free_fn( m ); \ 4927c478bd9Sstevel@tonic-gate } 4937c478bd9Sstevel@tonic-gate 4947c478bd9Sstevel@tonic-gate /* wait/post binary semaphore */ 4957c478bd9Sstevel@tonic-gate #define LDAP_SEMA_WAIT( ld, lp ) \ 4967c478bd9Sstevel@tonic-gate if ( (ld)->ld_sema_wait_fn != NULL ) { \ 4977c478bd9Sstevel@tonic-gate (ld)->ld_sema_wait_fn( lp->lp_sema ); \ 4987c478bd9Sstevel@tonic-gate } 4997c478bd9Sstevel@tonic-gate #define LDAP_SEMA_POST( ld, lp ) \ 5007c478bd9Sstevel@tonic-gate if ( (ld)->ld_sema_post_fn != NULL ) { \ 5017c478bd9Sstevel@tonic-gate (ld)->ld_sema_post_fn( lp->lp_sema ); \ 5027c478bd9Sstevel@tonic-gate } 5037c478bd9Sstevel@tonic-gate #define POST( ld, y, z ) \ 5047c478bd9Sstevel@tonic-gate /* the ld_mutex_trylock_fn is always set to NULL */ \ 5057c478bd9Sstevel@tonic-gate /* in setoption.c as the extra thread functions were */ \ 5067c478bd9Sstevel@tonic-gate /* turned off in the 4.0 SDK. This check will */ \ 5077c478bd9Sstevel@tonic-gate /* always be false */ \ 5087c478bd9Sstevel@tonic-gate if( (ld)->ld_mutex_trylock_fn != NULL ) { \ 5097c478bd9Sstevel@tonic-gate nsldapi_post_result( ld, y, z ); \ 5107c478bd9Sstevel@tonic-gate } 5117c478bd9Sstevel@tonic-gate 5127c478bd9Sstevel@tonic-gate /* get/set errno */ 5137c478bd9Sstevel@tonic-gate #ifndef macintosh 5147c478bd9Sstevel@tonic-gate #define LDAP_SET_ERRNO( ld, e ) \ 5157c478bd9Sstevel@tonic-gate if ( (ld)->ld_set_errno_fn != NULL ) { \ 5167c478bd9Sstevel@tonic-gate (ld)->ld_set_errno_fn( e ); \ 5177c478bd9Sstevel@tonic-gate } else { \ 5187c478bd9Sstevel@tonic-gate errno = e; \ 5197c478bd9Sstevel@tonic-gate } 5207c478bd9Sstevel@tonic-gate #define LDAP_GET_ERRNO( ld ) \ 5217c478bd9Sstevel@tonic-gate (((ld)->ld_get_errno_fn != NULL) ? \ 5227c478bd9Sstevel@tonic-gate (ld)->ld_get_errno_fn() : errno) 5237c478bd9Sstevel@tonic-gate #else /* macintosh */ 5247c478bd9Sstevel@tonic-gate #define LDAP_SET_ERRNO( ld, e ) \ 5257c478bd9Sstevel@tonic-gate if ( (ld)->ld_set_errno_fn != NULL ) { \ 5267c478bd9Sstevel@tonic-gate (ld)->ld_set_errno_fn( e ); \ 5277c478bd9Sstevel@tonic-gate } 5287c478bd9Sstevel@tonic-gate #define LDAP_GET_ERRNO( ld ) \ 5297c478bd9Sstevel@tonic-gate (((ld)->ld_get_errno_fn != NULL) ? \ 5307c478bd9Sstevel@tonic-gate (ld)->ld_get_errno_fn() : 0) 5317c478bd9Sstevel@tonic-gate #endif 5327c478bd9Sstevel@tonic-gate 5337c478bd9Sstevel@tonic-gate 5347c478bd9Sstevel@tonic-gate /* get/set ldap-specific errno */ 5357c478bd9Sstevel@tonic-gate #define LDAP_SET_LDERRNO( ld, e, m, s ) ldap_set_lderrno( ld, e, m, s ) 5367c478bd9Sstevel@tonic-gate #define LDAP_GET_LDERRNO( ld, m, s ) ldap_get_lderrno( ld, m, s ) 5377c478bd9Sstevel@tonic-gate 5387c478bd9Sstevel@tonic-gate /* 5397c478bd9Sstevel@tonic-gate * your standard "mimimum of two values" macro 5407c478bd9Sstevel@tonic-gate */ 5417c478bd9Sstevel@tonic-gate #define NSLDAPI_MIN(a, b) (((a) < (b)) ? (a) : (b)) 5427c478bd9Sstevel@tonic-gate 5437c478bd9Sstevel@tonic-gate /* 5447c478bd9Sstevel@tonic-gate * handy macro to check whether LDAP struct is set up for CLDAP or not 5457c478bd9Sstevel@tonic-gate */ 5467c478bd9Sstevel@tonic-gate #define LDAP_IS_CLDAP( ld ) ( ld->ld_sbp->sb_naddr > 0 ) 5477c478bd9Sstevel@tonic-gate 5487c478bd9Sstevel@tonic-gate /* 5497c478bd9Sstevel@tonic-gate * handy macro to check errno "e" for an "in progress" sort of error 5507c478bd9Sstevel@tonic-gate */ 5517c478bd9Sstevel@tonic-gate #if defined(macintosh) || defined(_WINDOWS) 5527c478bd9Sstevel@tonic-gate #define NSLDAPI_ERRNO_IO_INPROGRESS( e ) ((e) == EWOULDBLOCK || (e) == EAGAIN) 5537c478bd9Sstevel@tonic-gate #else 5547c478bd9Sstevel@tonic-gate #ifdef EAGAIN 5557c478bd9Sstevel@tonic-gate #define NSLDAPI_ERRNO_IO_INPROGRESS( e ) ((e) == EWOULDBLOCK || (e) == EINPROGRESS || (e) == EAGAIN) 5567c478bd9Sstevel@tonic-gate #else /* EAGAIN */ 557*1da57d55SToomas Soome #define NSLDAPI_ERRNO_IO_INPROGRESS( e ) ((e) == EWOULDBLOCK || (e) == EINPROGRESS) 5587c478bd9Sstevel@tonic-gate #endif /* EAGAIN */ 5597c478bd9Sstevel@tonic-gate #endif /* macintosh || _WINDOWS*/ 5607c478bd9Sstevel@tonic-gate 5617c478bd9Sstevel@tonic-gate /* 5627c478bd9Sstevel@tonic-gate * macro to return the LDAP protocol version we are using 5637c478bd9Sstevel@tonic-gate */ 5647c478bd9Sstevel@tonic-gate #define NSLDAPI_LDAP_VERSION( ld ) ( (ld)->ld_defconn == NULL ? \ 5657c478bd9Sstevel@tonic-gate (ld)->ld_version : \ 5667c478bd9Sstevel@tonic-gate (ld)->ld_defconn->lconn_version ) 5677c478bd9Sstevel@tonic-gate 5687c478bd9Sstevel@tonic-gate /* 5697c478bd9Sstevel@tonic-gate * Structures used for handling client filter lists. 5707c478bd9Sstevel@tonic-gate */ 5717c478bd9Sstevel@tonic-gate #define LDAP_FILT_MAXSIZ 1024 5727c478bd9Sstevel@tonic-gate 5737c478bd9Sstevel@tonic-gate struct ldap_filt_list { 5747c478bd9Sstevel@tonic-gate char *lfl_tag; 5757c478bd9Sstevel@tonic-gate char *lfl_pattern; 5767c478bd9Sstevel@tonic-gate char *lfl_delims; 5777c478bd9Sstevel@tonic-gate struct ldap_filt_info *lfl_ilist; 5787c478bd9Sstevel@tonic-gate struct ldap_filt_list *lfl_next; 5797c478bd9Sstevel@tonic-gate }; 5807c478bd9Sstevel@tonic-gate 5817c478bd9Sstevel@tonic-gate struct ldap_filt_desc { 5827c478bd9Sstevel@tonic-gate LDAPFiltList *lfd_filtlist; 5837c478bd9Sstevel@tonic-gate LDAPFiltInfo *lfd_curfip; 5847c478bd9Sstevel@tonic-gate LDAPFiltInfo lfd_retfi; 5857c478bd9Sstevel@tonic-gate char lfd_filter[ LDAP_FILT_MAXSIZ ]; 5867c478bd9Sstevel@tonic-gate char *lfd_curval; 5877c478bd9Sstevel@tonic-gate char *lfd_curvalcopy; 5887c478bd9Sstevel@tonic-gate char **lfd_curvalwords; 5897c478bd9Sstevel@tonic-gate char *lfd_filtprefix; 5907c478bd9Sstevel@tonic-gate char *lfd_filtsuffix; 5917c478bd9Sstevel@tonic-gate }; 5927c478bd9Sstevel@tonic-gate 5937c478bd9Sstevel@tonic-gate /* 5947c478bd9Sstevel@tonic-gate * "internal" globals used to track defaults and memory allocation callbacks: 5957c478bd9Sstevel@tonic-gate * (the actual definitions are in open.c) 5967c478bd9Sstevel@tonic-gate */ 5977c478bd9Sstevel@tonic-gate extern struct ldap nsldapi_ld_defaults; 5987c478bd9Sstevel@tonic-gate extern struct ldap_memalloc_fns nsldapi_memalloc_fns; 5997c478bd9Sstevel@tonic-gate extern int nsldapi_initialized; 6007c478bd9Sstevel@tonic-gate 6017c478bd9Sstevel@tonic-gate 6027c478bd9Sstevel@tonic-gate /* 6037c478bd9Sstevel@tonic-gate * Memory allocation done in liblber should all go through one of the 6047c478bd9Sstevel@tonic-gate * following macros. This is so we can plug-in alternative memory 6057c478bd9Sstevel@tonic-gate * allocators, etc. as the need arises. 6067c478bd9Sstevel@tonic-gate */ 6077c478bd9Sstevel@tonic-gate #define NSLDAPI_MALLOC( size ) ldap_x_malloc( size ) 6087c478bd9Sstevel@tonic-gate #define NSLDAPI_CALLOC( nelem, elsize ) ldap_x_calloc( nelem, elsize ) 6097c478bd9Sstevel@tonic-gate #define NSLDAPI_REALLOC( ptr, size ) ldap_x_realloc( ptr, size ) 6107c478bd9Sstevel@tonic-gate #define NSLDAPI_FREE( ptr ) ldap_x_free( ptr ) 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gate 6137c478bd9Sstevel@tonic-gate /* 6147c478bd9Sstevel@tonic-gate * macros used to check validity of data structures and parameters 6157c478bd9Sstevel@tonic-gate */ 6167c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_LDAP_POINTER( ld ) \ 6177c478bd9Sstevel@tonic-gate ( (ld) != NULL ) 6187c478bd9Sstevel@tonic-gate 6197c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_LDAPMESSAGE_POINTER( lm ) \ 6207c478bd9Sstevel@tonic-gate ( (lm) != NULL ) 6217c478bd9Sstevel@tonic-gate 6227c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( lm ) \ 6237c478bd9Sstevel@tonic-gate ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) 6247c478bd9Sstevel@tonic-gate 6257c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_LDAPMESSAGE_REFERENCE_POINTER( lm ) \ 6267c478bd9Sstevel@tonic-gate ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) 6277c478bd9Sstevel@tonic-gate 6287c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_LDAPMESSAGE_BINDRESULT_POINTER( lm ) \ 6297c478bd9Sstevel@tonic-gate ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_BIND ) 6307c478bd9Sstevel@tonic-gate 6317c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_LDAPMESSAGE_EXRESULT_POINTER( lm ) \ 6327c478bd9Sstevel@tonic-gate ( (lm) != NULL && (lm)->lm_msgtype == LDAP_RES_EXTENDED ) 6337c478bd9Sstevel@tonic-gate 6347c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_LDAPMOD_ARRAY( mods ) \ 6357c478bd9Sstevel@tonic-gate ( (mods) != NULL ) 6367c478bd9Sstevel@tonic-gate 6377c478bd9Sstevel@tonic-gate #define NSLDAPI_VALID_NONEMPTY_LDAPMOD_ARRAY( mods ) \ 6387c478bd9Sstevel@tonic-gate ( (mods) != NULL && (mods)[0] != NULL ) 6397c478bd9Sstevel@tonic-gate 6407c478bd9Sstevel@tonic-gate #define NSLDAPI_IS_SEARCH_ENTRY( code ) \ 6417c478bd9Sstevel@tonic-gate ((code) == LDAP_RES_SEARCH_ENTRY) 6427c478bd9Sstevel@tonic-gate 6437c478bd9Sstevel@tonic-gate #define NSLDAPI_IS_SEARCH_RESULT( code ) \ 6447c478bd9Sstevel@tonic-gate ((code) == LDAP_RES_SEARCH_RESULT) 6457c478bd9Sstevel@tonic-gate 6467c478bd9Sstevel@tonic-gate #define NSLDAPI_SEARCH_RELATED_RESULT( code ) \ 6477c478bd9Sstevel@tonic-gate (NSLDAPI_IS_SEARCH_RESULT( code ) || NSLDAPI_IS_SEARCH_ENTRY( code )) 6487c478bd9Sstevel@tonic-gate 6497c478bd9Sstevel@tonic-gate /* 6507c478bd9Sstevel@tonic-gate * in bind.c 6517c478bd9Sstevel@tonic-gate */ 6527c478bd9Sstevel@tonic-gate char *nsldapi_get_binddn( LDAP *ld ); 6537c478bd9Sstevel@tonic-gate 6547c478bd9Sstevel@tonic-gate /* 6557c478bd9Sstevel@tonic-gate * in cache.c 6567c478bd9Sstevel@tonic-gate */ 6577c478bd9Sstevel@tonic-gate void nsldapi_add_result_to_cache( LDAP *ld, LDAPMessage *result ); 6587c478bd9Sstevel@tonic-gate 6597c478bd9Sstevel@tonic-gate /* 6607c478bd9Sstevel@tonic-gate * in dsparse.c 6617c478bd9Sstevel@tonic-gate */ 6627c478bd9Sstevel@tonic-gate int ldap_next_line_tokens( char **bufp, long *blenp, char ***toksp ); 6637c478bd9Sstevel@tonic-gate void ldap_free_strarray( char **sap ); 6647c478bd9Sstevel@tonic-gate 6657c478bd9Sstevel@tonic-gate /* 6667c478bd9Sstevel@tonic-gate * in error.c 6677c478bd9Sstevel@tonic-gate */ 6687c478bd9Sstevel@tonic-gate int nsldapi_parse_result( LDAP *ld, int msgtype, BerElement *rber, 6697c478bd9Sstevel@tonic-gate int *errcodep, char **matchednp, char **errmsgp, char ***referralsp, 6707c478bd9Sstevel@tonic-gate LDAPControl ***serverctrlsp ); 6717c478bd9Sstevel@tonic-gate 6727c478bd9Sstevel@tonic-gate /* 6737c478bd9Sstevel@tonic-gate * in open.c 6747c478bd9Sstevel@tonic-gate */ 6757c478bd9Sstevel@tonic-gate void nsldapi_initialize_defaults( void ); 6767c478bd9Sstevel@tonic-gate void nsldapi_mutex_alloc_all( LDAP *ld ); 6777c478bd9Sstevel@tonic-gate void nsldapi_mutex_free_all( LDAP *ld ); 6787c478bd9Sstevel@tonic-gate int nsldapi_open_ldap_defconn( LDAP *ld ); 6797c478bd9Sstevel@tonic-gate char *nsldapi_strdup( const char *s ); /* if s is NULL, returns NULL */ 6807c478bd9Sstevel@tonic-gate 6817c478bd9Sstevel@tonic-gate /* 6827c478bd9Sstevel@tonic-gate * in os-ip.c 6837c478bd9Sstevel@tonic-gate */ 6847c478bd9Sstevel@tonic-gate int nsldapi_connect_to_host( LDAP *ld, Sockbuf *sb, const char *host, 6857c478bd9Sstevel@tonic-gate int port, int secure, char **krbinstancep ); 6867c478bd9Sstevel@tonic-gate void nsldapi_close_connection( LDAP *ld, Sockbuf *sb ); 6877c478bd9Sstevel@tonic-gate 6887c478bd9Sstevel@tonic-gate int nsldapi_iostatus_poll( LDAP *ld, struct timeval *timeout ); 6897c478bd9Sstevel@tonic-gate void nsldapi_iostatus_free( LDAP *ld ); 6907c478bd9Sstevel@tonic-gate int nsldapi_iostatus_interest_write( LDAP *ld, Sockbuf *sb ); 6917c478bd9Sstevel@tonic-gate int nsldapi_iostatus_interest_read( LDAP *ld, Sockbuf *sb ); 6927c478bd9Sstevel@tonic-gate int nsldapi_iostatus_interest_clear( LDAP *ld, Sockbuf *sb ); 6937c478bd9Sstevel@tonic-gate int nsldapi_iostatus_is_read_ready( LDAP *ld, Sockbuf *sb ); 6947c478bd9Sstevel@tonic-gate int nsldapi_iostatus_is_write_ready( LDAP *ld, Sockbuf *sb ); 6957c478bd9Sstevel@tonic-gate int nsldapi_install_lber_extiofns( LDAP *ld, Sockbuf *sb ); 6967c478bd9Sstevel@tonic-gate int nsldapi_install_compat_io_fns( LDAP *ld, struct ldap_io_fns *iofns ); 6977c478bd9Sstevel@tonic-gate 6987c478bd9Sstevel@tonic-gate /* 6997c478bd9Sstevel@tonic-gate * if referral.c 7007c478bd9Sstevel@tonic-gate */ 7017c478bd9Sstevel@tonic-gate int nsldapi_parse_reference( LDAP *ld, BerElement *rber, char ***referralsp, 7027c478bd9Sstevel@tonic-gate LDAPControl ***serverctrlsp ); 7037c478bd9Sstevel@tonic-gate 7047c478bd9Sstevel@tonic-gate /* 7057c478bd9Sstevel@tonic-gate * in result.c 7067c478bd9Sstevel@tonic-gate */ 7077c478bd9Sstevel@tonic-gate int ldap_msgdelete( LDAP *ld, int msgid ); 7087c478bd9Sstevel@tonic-gate int nsldapi_result_nolock( LDAP *ld, int msgid, int all, int unlock_permitted, 7097c478bd9Sstevel@tonic-gate struct timeval *timeout, LDAPMessage **result ); 7107c478bd9Sstevel@tonic-gate int nsldapi_wait_result( LDAP *ld, int msgid, int all, struct timeval *timeout, 7117c478bd9Sstevel@tonic-gate LDAPMessage **result ); 7127c478bd9Sstevel@tonic-gate int nsldapi_post_result( LDAP *ld, int msgid, LDAPMessage *result ); 7137c478bd9Sstevel@tonic-gate 7147c478bd9Sstevel@tonic-gate /* 7157c478bd9Sstevel@tonic-gate * in request.c 7167c478bd9Sstevel@tonic-gate */ 7177c478bd9Sstevel@tonic-gate int nsldapi_send_initial_request( LDAP *ld, int msgid, unsigned long msgtype, 7187c478bd9Sstevel@tonic-gate char *dn, BerElement *ber ); 7197c478bd9Sstevel@tonic-gate int nsldapi_alloc_ber_with_options( LDAP *ld, BerElement **berp ); 7207c478bd9Sstevel@tonic-gate void nsldapi_set_ber_options( LDAP *ld, BerElement *ber ); 7217c478bd9Sstevel@tonic-gate int nsldapi_ber_flush( LDAP *ld, Sockbuf *sb, BerElement *ber, int freeit, 7227c478bd9Sstevel@tonic-gate int async ); 7237c478bd9Sstevel@tonic-gate int nsldapi_send_server_request( LDAP *ld, BerElement *ber, int msgid, 7247c478bd9Sstevel@tonic-gate LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc, 7257c478bd9Sstevel@tonic-gate char *bindreqdn, int bind ); 7267c478bd9Sstevel@tonic-gate LDAPConn *nsldapi_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb, 7277c478bd9Sstevel@tonic-gate int connect, int bind ); 7287c478bd9Sstevel@tonic-gate LDAPRequest *nsldapi_find_request_by_msgid( LDAP *ld, int msgid ); 7297c478bd9Sstevel@tonic-gate void nsldapi_free_request( LDAP *ld, LDAPRequest *lr, int free_conn ); 7307c478bd9Sstevel@tonic-gate void nsldapi_free_connection( LDAP *ld, LDAPConn *lc, 7317c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, 7327c478bd9Sstevel@tonic-gate int force, int unbind ); 7337c478bd9Sstevel@tonic-gate void nsldapi_dump_connection( LDAP *ld, LDAPConn *lconns, int all ); 7347c478bd9Sstevel@tonic-gate void nsldapi_dump_requests_and_responses( LDAP *ld ); 7357c478bd9Sstevel@tonic-gate int nsldapi_chase_v2_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, 7367c478bd9Sstevel@tonic-gate int *totalcountp, int *chasingcountp ); 7377c478bd9Sstevel@tonic-gate int nsldapi_chase_v3_refs( LDAP *ld, LDAPRequest *lr, char **refs, 7387c478bd9Sstevel@tonic-gate int is_reference, int *totalcountp, int *chasingcountp ); 7397c478bd9Sstevel@tonic-gate int nsldapi_append_referral( LDAP *ld, char **referralsp, char *s ); 7407c478bd9Sstevel@tonic-gate void nsldapi_connection_lost_nolock( LDAP *ld, Sockbuf *sb ); 7417c478bd9Sstevel@tonic-gate 7427c478bd9Sstevel@tonic-gate /* 7437c478bd9Sstevel@tonic-gate * in search.c 7447c478bd9Sstevel@tonic-gate */ 7457c478bd9Sstevel@tonic-gate int nsldapi_build_search_req( LDAP *ld, const char *base, int scope, 7467c478bd9Sstevel@tonic-gate const char *filter, char **attrs, int attrsonly, 7477c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, 7487c478bd9Sstevel@tonic-gate int timelimit, int sizelimit, int msgid, BerElement **berp ); 7497c478bd9Sstevel@tonic-gate 7507c478bd9Sstevel@tonic-gate int ldap_put_filter( BerElement *ber, char *str ); 7517c478bd9Sstevel@tonic-gate /* 7527c478bd9Sstevel@tonic-gate * in unbind.c 7537c478bd9Sstevel@tonic-gate */ 7547c478bd9Sstevel@tonic-gate int ldap_ld_free( LDAP *ld, LDAPControl **serverctrls, 7557c478bd9Sstevel@tonic-gate LDAPControl **clientctrls, int close ); 7567c478bd9Sstevel@tonic-gate int nsldapi_send_unbind( LDAP *ld, Sockbuf *sb, LDAPControl **serverctrls, 7577c478bd9Sstevel@tonic-gate LDAPControl **clientctrls ); 7587c478bd9Sstevel@tonic-gate 7597c478bd9Sstevel@tonic-gate #ifdef LDAP_DNS 7607c478bd9Sstevel@tonic-gate /* 7617c478bd9Sstevel@tonic-gate * in getdxbyname.c 7627c478bd9Sstevel@tonic-gate */ 7637c478bd9Sstevel@tonic-gate char **nsldapi_getdxbyname( char *domain ); 7647c478bd9Sstevel@tonic-gate 7657c478bd9Sstevel@tonic-gate #endif /* LDAP_DNS */ 7667c478bd9Sstevel@tonic-gate 7677c478bd9Sstevel@tonic-gate /* 7687c478bd9Sstevel@tonic-gate * in unescape.c 7697c478bd9Sstevel@tonic-gate */ 7707c478bd9Sstevel@tonic-gate void nsldapi_hex_unescape( char *s ); 7717c478bd9Sstevel@tonic-gate 7727c478bd9Sstevel@tonic-gate /* 7737c478bd9Sstevel@tonic-gate * in reslist.c 7747c478bd9Sstevel@tonic-gate */ 7757c478bd9Sstevel@tonic-gate LDAPMessage *ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e ); 7767c478bd9Sstevel@tonic-gate void ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e ); 7777c478bd9Sstevel@tonic-gate 7787c478bd9Sstevel@tonic-gate /* 7797c478bd9Sstevel@tonic-gate * in compat.c 7807c478bd9Sstevel@tonic-gate */ 7817c478bd9Sstevel@tonic-gate #ifdef hpux 7827c478bd9Sstevel@tonic-gate char *nsldapi_compat_ctime_r( const time_t *clock, char *buf, int buflen ); 7837c478bd9Sstevel@tonic-gate struct hostent *nsldapi_compat_gethostbyname_r( const char *name, 7847c478bd9Sstevel@tonic-gate struct hostent *result, char *buffer, int buflen, int *h_errnop ); 7857c478bd9Sstevel@tonic-gate #endif /* hpux */ 7867c478bd9Sstevel@tonic-gate 7877c478bd9Sstevel@tonic-gate /* 7887c478bd9Sstevel@tonic-gate * in control.c 7897c478bd9Sstevel@tonic-gate */ 7907c478bd9Sstevel@tonic-gate int nsldapi_put_controls( LDAP *ld, LDAPControl **ctrls, int closeseq, 7917c478bd9Sstevel@tonic-gate BerElement *ber ); 7927c478bd9Sstevel@tonic-gate int nsldapi_get_controls( BerElement *ber, LDAPControl ***controlsp ); 7937c478bd9Sstevel@tonic-gate int nsldapi_dup_controls( LDAP *ld, LDAPControl ***ldctrls, 7947c478bd9Sstevel@tonic-gate LDAPControl **newctrls ); 7957c478bd9Sstevel@tonic-gate int nsldapi_build_control( char *oid, BerElement *ber, int freeber, 7967c478bd9Sstevel@tonic-gate char iscritical, LDAPControl **ctrlp ); 7977c478bd9Sstevel@tonic-gate 7987c478bd9Sstevel@tonic-gate 7997c478bd9Sstevel@tonic-gate /* 8007c478bd9Sstevel@tonic-gate * in url.c 8017c478bd9Sstevel@tonic-gate */ 8027c478bd9Sstevel@tonic-gate int nsldapi_url_parse( const char *inurl, LDAPURLDesc **ludpp, 8037c478bd9Sstevel@tonic-gate int dn_required ); 8047c478bd9Sstevel@tonic-gate 8057c478bd9Sstevel@tonic-gate /* 8067c478bd9Sstevel@tonic-gate * in ../ber/bprint.c 8077c478bd9Sstevel@tonic-gate */ 8087c478bd9Sstevel@tonic-gate void ber_err_print( char *data ); 8097c478bd9Sstevel@tonic-gate 8107c478bd9Sstevel@tonic-gate #ifdef _SOLARIS_SDK 8117c478bd9Sstevel@tonic-gate /* 8127c478bd9Sstevel@tonic-gate * in ../prldap/ldappr-dns.c 8137c478bd9Sstevel@tonic-gate */ 8147c478bd9Sstevel@tonic-gate int prldap_x_install_dns_skipdb(LDAP *ld, const char *skip); 8157c478bd9Sstevel@tonic-gate /* 8167c478bd9Sstevel@tonic-gate * in ../prldap/ldappr-threads.c 8177c478bd9Sstevel@tonic-gate */ 8187c478bd9Sstevel@tonic-gate void prldap_nspr_init(void); 8197c478bd9Sstevel@tonic-gate #endif 8207c478bd9Sstevel@tonic-gate 8217c478bd9Sstevel@tonic-gate /* 8227c478bd9Sstevel@tonic-gate * in ../prldap/ldappr-public.c 8237c478bd9Sstevel@tonic-gate */ 8247c478bd9Sstevel@tonic-gate int 8257c478bd9Sstevel@tonic-gate prldap_install_io_functions( LDAP *ld, int shared ); 8267c478bd9Sstevel@tonic-gate int 8277c478bd9Sstevel@tonic-gate prldap_install_dns_functions( LDAP *ld ); 8287c478bd9Sstevel@tonic-gate int 8297c478bd9Sstevel@tonic-gate prldap_install_thread_functions( LDAP *ld, int shared ); 8307c478bd9Sstevel@tonic-gate 8317c478bd9Sstevel@tonic-gate 8327c478bd9Sstevel@tonic-gate 833*1da57d55SToomas Soome #ifndef _SOLARIS_SDK 8347c478bd9Sstevel@tonic-gate 8357c478bd9Sstevel@tonic-gate /* 8367c478bd9Sstevel@tonic-gate * in charset.c 8377c478bd9Sstevel@tonic-gate * 8387c478bd9Sstevel@tonic-gate * If we ever want to expose character set translation functionality to 8397c478bd9Sstevel@tonic-gate * users of libldap, all of these prototypes will need to be moved to ldap.h 8407c478bd9Sstevel@tonic-gate * 8417c478bd9Sstevel@tonic-gate * These are moved to ldap.h in the Solaris version of the library 8427c478bd9Sstevel@tonic-gate * 8437c478bd9Sstevel@tonic-gate */ 8447c478bd9Sstevel@tonic-gate #ifdef STR_TRANSLATION 8457c478bd9Sstevel@tonic-gate void ldap_set_string_translators( LDAP *ld, 8467c478bd9Sstevel@tonic-gate BERTranslateProc encode_proc, BERTranslateProc decode_proc ); 8477c478bd9Sstevel@tonic-gate int ldap_translate_from_t61( LDAP *ld, char **bufp, 8487c478bd9Sstevel@tonic-gate unsigned long *lenp, int free_input ); 8497c478bd9Sstevel@tonic-gate int ldap_translate_to_t61( LDAP *ld, char **bufp, 8507c478bd9Sstevel@tonic-gate unsigned long *lenp, int free_input ); 8517c478bd9Sstevel@tonic-gate void ldap_enable_translation( LDAP *ld, LDAPMessage *entry, 8527c478bd9Sstevel@tonic-gate int enable ); 8537c478bd9Sstevel@tonic-gate #ifdef LDAP_CHARSET_8859 8547c478bd9Sstevel@tonic-gate int ldap_t61_to_8859( char **bufp, unsigned long *buflenp, 8557c478bd9Sstevel@tonic-gate int free_input ); 8567c478bd9Sstevel@tonic-gate int ldap_8859_to_t61( char **bufp, unsigned long *buflenp, 8577c478bd9Sstevel@tonic-gate int free_input ); 8587c478bd9Sstevel@tonic-gate #endif /* LDAP_CHARSET_8859 */ 8597c478bd9Sstevel@tonic-gate #endif /* STR_TRANSLATION */ 8607c478bd9Sstevel@tonic-gate 8617c478bd9Sstevel@tonic-gate #endif /* _SOLARIS_SDK */ 8627c478bd9Sstevel@tonic-gate 8637c478bd9Sstevel@tonic-gate /* 8647c478bd9Sstevel@tonic-gate * in memcache.h 8657c478bd9Sstevel@tonic-gate */ 8667c478bd9Sstevel@tonic-gate int ldap_memcache_createkey( LDAP *ld, const char *base, int scope, 8677c478bd9Sstevel@tonic-gate const char *filter, char **attrs, int attrsonly, 8687c478bd9Sstevel@tonic-gate LDAPControl **serverctrls, LDAPControl **clientctrls, 8697c478bd9Sstevel@tonic-gate unsigned long *keyp ); 8707c478bd9Sstevel@tonic-gate int ldap_memcache_result( LDAP *ld, int msgid, unsigned long key ); 8717c478bd9Sstevel@tonic-gate int ldap_memcache_new( LDAP *ld, int msgid, unsigned long key, 8727c478bd9Sstevel@tonic-gate const char *basedn ); 8737c478bd9Sstevel@tonic-gate int ldap_memcache_append( LDAP *ld, int msgid, int bLast, LDAPMessage *result ); 8747c478bd9Sstevel@tonic-gate int ldap_memcache_abandon( LDAP *ld, int msgid ); 8757c478bd9Sstevel@tonic-gate 8767c478bd9Sstevel@tonic-gate #endif /* _LDAPINT_H */ 877