1 /* $NetBSD: ldap-int.h,v 1.1.1.2 2010/03/08 02:14:20 lukem Exp $ */ 2 3 /* ldap-int.h - defines & prototypes internal to the LDAP library */ 4 /* OpenLDAP: pkg/ldap/libraries/libldap/ldap-int.h,v 1.168.2.16 2009/08/12 23:40:55 quanah Exp */ 5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 6 * 7 * Copyright 1998-2009 The OpenLDAP Foundation. 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted only as authorized by the OpenLDAP 12 * Public License. 13 * 14 * A copy of this license is available in the file LICENSE in the 15 * top-level directory of the distribution or, alternatively, at 16 * <http://www.OpenLDAP.org/license.html>. 17 */ 18 /* Portions Copyright (c) 1995 Regents of the University of Michigan. 19 * All rights reserved. 20 */ 21 22 #ifndef _LDAP_INT_H 23 #define _LDAP_INT_H 1 24 25 #ifdef LDAP_R_COMPILE 26 #define LDAP_THREAD_SAFE 1 27 #endif 28 29 #include "../liblber/lber-int.h" 30 31 #ifdef LDAP_R_COMPILE 32 #include <ldap_pvt_thread.h> 33 #endif 34 35 #ifdef HAVE_CYRUS_SASL 36 /* the need for this should be removed */ 37 #ifdef HAVE_SASL_SASL_H 38 #include <sasl/sasl.h> 39 #else 40 #include <sasl.h> 41 #endif 42 43 #define SASL_MAX_BUFF_SIZE (0xffffff) 44 #define SASL_MIN_BUFF_SIZE 4096 45 #endif 46 47 /* for struct timeval */ 48 #include <ac/time.h> 49 50 #undef TV2MILLISEC 51 #define TV2MILLISEC(tv) (((tv)->tv_sec * 1000) + ((tv)->tv_usec/1000)) 52 53 /* 54 * Support needed if the library is running in the kernel 55 */ 56 #if LDAP_INT_IN_KERNEL 57 /* 58 * Platform specific function to return a pointer to the 59 * process-specific global options. 60 * 61 * This function should perform the following functions: 62 * Allocate and initialize a global options struct on a per process basis 63 * Use callers process identifier to return its global options struct 64 * Note: Deallocate structure when the process exits 65 */ 66 # define LDAP_INT_GLOBAL_OPT() ldap_int_global_opt() 67 struct ldapoptions *ldap_int_global_opt(void); 68 #else 69 # define LDAP_INT_GLOBAL_OPT() (&ldap_int_global_options) 70 #endif 71 72 #define ldap_debug ((LDAP_INT_GLOBAL_OPT())->ldo_debug) 73 74 #include "ldap_log.h" 75 76 #undef Debug 77 78 #ifdef LDAP_DEBUG 79 80 #define DebugTest( level ) \ 81 ( ldap_debug & level ) 82 83 #define Debug( level, fmt, arg1, arg2, arg3 ) \ 84 do { if ( ldap_debug & level ) \ 85 ldap_log_printf( NULL, (level), (fmt), (arg1), (arg2), (arg3) ); \ 86 } while ( 0 ) 87 88 #define LDAP_Debug( subsystem, level, fmt, arg1, arg2, arg3 )\ 89 ldap_log_printf( NULL, (level), (fmt), (arg1), (arg2), (arg3) ) 90 91 #else 92 93 #define DebugTest( level ) (0 == 1) 94 #define Debug( level, fmt, arg1, arg2, arg3 ) ((void)0) 95 #define LDAP_Debug( subsystem, level, fmt, arg1, arg2, arg3 ) ((void)0) 96 97 #endif /* LDAP_DEBUG */ 98 99 #define LDAP_DEPRECATED 1 100 #include "ldap.h" 101 102 #include "ldap_pvt.h" 103 104 LDAP_BEGIN_DECL 105 106 #define LDAP_URL_PREFIX "ldap://" 107 #define LDAP_URL_PREFIX_LEN STRLENOF(LDAP_URL_PREFIX) 108 #define LDAPS_URL_PREFIX "ldaps://" 109 #define LDAPS_URL_PREFIX_LEN STRLENOF(LDAPS_URL_PREFIX) 110 #define LDAPI_URL_PREFIX "ldapi://" 111 #define LDAPI_URL_PREFIX_LEN STRLENOF(LDAPI_URL_PREFIX) 112 #ifdef LDAP_CONNECTIONLESS 113 #define LDAPC_URL_PREFIX "cldap://" 114 #define LDAPC_URL_PREFIX_LEN STRLENOF(LDAPC_URL_PREFIX) 115 #endif 116 #define LDAP_URL_URLCOLON "URL:" 117 #define LDAP_URL_URLCOLON_LEN STRLENOF(LDAP_URL_URLCOLON) 118 119 #define LDAP_REF_STR "Referral:\n" 120 #define LDAP_REF_STR_LEN STRLENOF(LDAP_REF_STR) 121 #define LDAP_LDAP_REF_STR LDAP_URL_PREFIX 122 #define LDAP_LDAP_REF_STR_LEN LDAP_URL_PREFIX_LEN 123 124 #define LDAP_DEFAULT_REFHOPLIMIT 5 125 126 #define LDAP_BOOL_REFERRALS 0 127 #define LDAP_BOOL_RESTART 1 128 #define LDAP_BOOL_TLS 3 129 #define LDAP_BOOL_CONNECT_ASYNC 4 130 #define LDAP_BOOL_SASL_NOCANON 5 131 132 #define LDAP_BOOLEANS unsigned long 133 #define LDAP_BOOL(n) ((LDAP_BOOLEANS)1 << (n)) 134 #define LDAP_BOOL_GET(lo, bool) \ 135 ((lo)->ldo_booleans & LDAP_BOOL(bool) ? -1 : 0) 136 #define LDAP_BOOL_SET(lo, bool) ((lo)->ldo_booleans |= LDAP_BOOL(bool)) 137 #define LDAP_BOOL_CLR(lo, bool) ((lo)->ldo_booleans &= ~LDAP_BOOL(bool)) 138 #define LDAP_BOOL_ZERO(lo) ((lo)->ldo_booleans = 0) 139 140 /* 141 * This structure represents both ldap messages and ldap responses. 142 * These are really the same, except in the case of search responses, 143 * where a response has multiple messages. 144 */ 145 146 struct ldapmsg { 147 ber_int_t lm_msgid; /* the message id */ 148 ber_tag_t lm_msgtype; /* the message type */ 149 BerElement *lm_ber; /* the ber encoded message contents */ 150 struct ldapmsg *lm_chain; /* for search - next msg in the resp */ 151 struct ldapmsg *lm_chain_tail; 152 struct ldapmsg *lm_next; /* next response */ 153 time_t lm_time; /* used to maintain cache */ 154 }; 155 156 #ifdef HAVE_TLS 157 struct ldaptls { 158 char *lt_certfile; 159 char *lt_keyfile; 160 char *lt_dhfile; 161 char *lt_cacertfile; 162 char *lt_cacertdir; 163 char *lt_ciphersuite; 164 char *lt_crlfile; 165 char *lt_randfile; /* OpenSSL only */ 166 int lt_protocol_min; 167 }; 168 #endif 169 170 typedef struct ldaplist { 171 struct ldaplist *ll_next; 172 void *ll_data; 173 } ldaplist; 174 175 /* 176 * structure representing get/set'able options 177 * which have global defaults. 178 */ 179 struct ldapoptions { 180 short ldo_valid; 181 #define LDAP_UNINITIALIZED 0x0 182 #define LDAP_INITIALIZED 0x1 183 #define LDAP_VALID_SESSION 0x2 184 #define LDAP_TRASHED_SESSION 0xFF 185 int ldo_debug; 186 #ifdef LDAP_CONNECTIONLESS 187 #define LDAP_IS_UDP(ld) ((ld)->ld_options.ldo_is_udp) 188 void* ldo_peer; /* struct sockaddr* */ 189 char* ldo_cldapdn; 190 int ldo_is_udp; 191 #endif 192 193 /* per API call timeout */ 194 struct timeval ldo_tm_api; 195 struct timeval ldo_tm_net; 196 197 ber_int_t ldo_version; 198 ber_int_t ldo_deref; 199 ber_int_t ldo_timelimit; 200 ber_int_t ldo_sizelimit; 201 202 #ifdef HAVE_TLS 203 /* tls context */ 204 void *ldo_tls_ctx; 205 LDAP_TLS_CONNECT_CB *ldo_tls_connect_cb; 206 void* ldo_tls_connect_arg; 207 struct ldaptls ldo_tls_info; 208 #define ldo_tls_certfile ldo_tls_info.lt_certfile 209 #define ldo_tls_keyfile ldo_tls_info.lt_keyfile 210 #define ldo_tls_dhfile ldo_tls_info.lt_dhfile 211 #define ldo_tls_cacertfile ldo_tls_info.lt_cacertfile 212 #define ldo_tls_cacertdir ldo_tls_info.lt_cacertdir 213 #define ldo_tls_ciphersuite ldo_tls_info.lt_ciphersuite 214 #define ldo_tls_protocol_min ldo_tls_info.lt_protocol_min 215 #define ldo_tls_crlfile ldo_tls_info.lt_crlfile 216 #define ldo_tls_randfile ldo_tls_info.lt_randfile 217 int ldo_tls_mode; 218 int ldo_tls_require_cert; 219 int ldo_tls_impl; 220 #ifdef HAVE_OPENSSL_CRL 221 int ldo_tls_crlcheck; 222 #endif 223 #endif 224 225 LDAPURLDesc *ldo_defludp; 226 int ldo_defport; 227 char* ldo_defbase; 228 char* ldo_defbinddn; /* bind dn */ 229 230 #ifdef HAVE_CYRUS_SASL 231 char* ldo_def_sasl_mech; /* SASL Mechanism(s) */ 232 char* ldo_def_sasl_realm; /* SASL realm */ 233 char* ldo_def_sasl_authcid; /* SASL authentication identity */ 234 char* ldo_def_sasl_authzid; /* SASL authorization identity */ 235 236 /* SASL Security Properties */ 237 struct sasl_security_properties ldo_sasl_secprops; 238 #endif 239 240 #ifdef HAVE_GSSAPI 241 unsigned gssapi_flags; 242 243 unsigned ldo_gssapi_flags; 244 #define LDAP_GSSAPI_OPT_DO_NOT_FREE_GSS_CONTEXT 0x0001 245 #define LDAP_GSSAPI_OPT_ALLOW_REMOTE_PRINCIPAL 0x0002 246 unsigned ldo_gssapi_options; 247 #endif 248 249 /* 250 * Per connection tcp-keepalive settings (Linux only, 251 * ignored where unsupported) 252 */ 253 ber_int_t ldo_keepalive_idle; 254 ber_int_t ldo_keepalive_probes; 255 ber_int_t ldo_keepalive_interval; 256 257 int ldo_refhoplimit; /* limit on referral nesting */ 258 259 /* LDAPv3 server and client controls */ 260 LDAPControl **ldo_sctrls; 261 LDAPControl **ldo_cctrls; 262 263 /* LDAP rebind callback function */ 264 LDAP_REBIND_PROC *ldo_rebind_proc; 265 void *ldo_rebind_params; 266 LDAP_NEXTREF_PROC *ldo_nextref_proc; 267 void *ldo_nextref_params; 268 LDAP_URLLIST_PROC *ldo_urllist_proc; 269 void *ldo_urllist_params; 270 271 /* LDAP connection callback stack */ 272 ldaplist *ldo_conn_cbs; 273 274 LDAP_BOOLEANS ldo_booleans; /* boolean options */ 275 }; 276 277 278 /* 279 * structure for representing an LDAP server connection 280 */ 281 typedef struct ldap_conn { 282 Sockbuf *lconn_sb; 283 #ifdef HAVE_CYRUS_SASL 284 void *lconn_sasl_authctx; /* context for bind */ 285 void *lconn_sasl_sockctx; /* for security layer */ 286 #endif 287 #ifdef HAVE_GSSAPI 288 void *lconn_gss_ctx; /* gss_ctx_id_t */ 289 #endif 290 int lconn_refcnt; 291 time_t lconn_created; /* time */ 292 time_t lconn_lastused; /* time */ 293 int lconn_rebind_inprogress; /* set if rebind in progress */ 294 char ***lconn_rebind_queue; /* used if rebind in progress */ 295 int lconn_status; 296 #define LDAP_CONNST_NEEDSOCKET 1 297 #define LDAP_CONNST_CONNECTING 2 298 #define LDAP_CONNST_CONNECTED 3 299 LDAPURLDesc *lconn_server; 300 BerElement *lconn_ber; /* ber receiving on this conn. */ 301 302 struct ldap_conn *lconn_next; 303 } LDAPConn; 304 305 306 /* 307 * structure used to track outstanding requests 308 */ 309 typedef struct ldapreq { 310 ber_int_t lr_msgid; /* the message id */ 311 int lr_status; /* status of request */ 312 #define LDAP_REQST_COMPLETED 0 313 #define LDAP_REQST_INPROGRESS 1 314 #define LDAP_REQST_CHASINGREFS 2 315 #define LDAP_REQST_NOTCONNECTED 3 316 #define LDAP_REQST_WRITING 4 317 int lr_refcnt; /* count of references */ 318 int lr_outrefcnt; /* count of outstanding referrals */ 319 int lr_abandoned; /* the request has been abandoned */ 320 ber_int_t lr_origid; /* original request's message id */ 321 int lr_parentcnt; /* count of parent requests */ 322 ber_tag_t lr_res_msgtype; /* result message type */ 323 ber_int_t lr_res_errno; /* result LDAP errno */ 324 char *lr_res_error; /* result error string */ 325 char *lr_res_matched;/* result matched DN string */ 326 BerElement *lr_ber; /* ber encoded request contents */ 327 LDAPConn *lr_conn; /* connection used to send request */ 328 struct berval lr_dn; /* DN of request, in lr_ber */ 329 struct ldapreq *lr_parent; /* request that spawned this referral */ 330 struct ldapreq *lr_child; /* first child request */ 331 struct ldapreq *lr_refnext; /* next referral spawned */ 332 struct ldapreq *lr_prev; /* previous request */ 333 struct ldapreq *lr_next; /* next request */ 334 } LDAPRequest; 335 336 /* 337 * structure for client cache 338 */ 339 #define LDAP_CACHE_BUCKETS 31 /* cache hash table size */ 340 typedef struct ldapcache { 341 LDAPMessage *lc_buckets[LDAP_CACHE_BUCKETS];/* hash table */ 342 LDAPMessage *lc_requests; /* unfulfilled reqs */ 343 long lc_timeout; /* request timeout */ 344 ber_len_t lc_maxmem; /* memory to use */ 345 ber_len_t lc_memused; /* memory in use */ 346 int lc_enabled; /* enabled? */ 347 unsigned long lc_options; /* options */ 348 #define LDAP_CACHE_OPT_CACHENOERRS 0x00000001 349 #define LDAP_CACHE_OPT_CACHEALLERRS 0x00000002 350 } LDAPCache; 351 352 /* 353 * structure containing referral request info for rebind procedure 354 */ 355 typedef struct ldapreqinfo { 356 ber_len_t ri_msgid; 357 int ri_request; 358 char *ri_url; 359 } LDAPreqinfo; 360 361 /* 362 * structure representing an ldap connection 363 */ 364 365 struct ldap { 366 Sockbuf *ld_sb; /* socket descriptor & buffer */ 367 368 struct ldapoptions ld_options; 369 370 #define ld_valid ld_options.ldo_valid 371 #define ld_debug ld_options.ldo_debug 372 373 #define ld_deref ld_options.ldo_deref 374 #define ld_timelimit ld_options.ldo_timelimit 375 #define ld_sizelimit ld_options.ldo_sizelimit 376 377 #define ld_defbinddn ld_options.ldo_defbinddn 378 #define ld_defbase ld_options.ldo_defbase 379 #define ld_defhost ld_options.ldo_defhost 380 #define ld_defport ld_options.ldo_defport 381 382 #define ld_refhoplimit ld_options.ldo_refhoplimit 383 384 #define ld_sctrls ld_options.ldo_sctrls 385 #define ld_cctrls ld_options.ldo_cctrls 386 #define ld_rebind_proc ld_options.ldo_rebind_proc 387 #define ld_rebind_params ld_options.ldo_rebind_params 388 #define ld_nextref_proc ld_options.ldo_nextref_proc 389 #define ld_nextref_params ld_options.ldo_nextref_params 390 #define ld_urllist_proc ld_options.ldo_urllist_proc 391 #define ld_urllist_params ld_options.ldo_urllist_params 392 393 #define ld_version ld_options.ldo_version 394 395 unsigned short ld_lberoptions; 396 397 ber_int_t ld_errno; 398 char *ld_error; 399 char *ld_matched; 400 char **ld_referrals; 401 ber_len_t ld_msgid; 402 403 /* do not mess with these */ 404 LDAPRequest *ld_requests; /* list of outstanding requests */ 405 LDAPMessage *ld_responses; /* list of outstanding responses */ 406 407 #ifdef LDAP_R_COMPILE 408 ldap_pvt_thread_mutex_t ld_conn_mutex; 409 ldap_pvt_thread_mutex_t ld_req_mutex; 410 ldap_pvt_thread_mutex_t ld_res_mutex; 411 #endif 412 413 ber_len_t ld_nabandoned; 414 ber_int_t *ld_abandoned; /* array of abandoned requests */ 415 416 LDAPCache *ld_cache; /* non-null if cache is initialized */ 417 418 /* do not mess with the rest though */ 419 420 LDAPConn *ld_defconn; /* default connection */ 421 LDAPConn *ld_conns; /* list of server connections */ 422 void *ld_selectinfo; /* platform specifics for select */ 423 }; 424 #define LDAP_VALID(ld) ( (ld)->ld_valid == LDAP_VALID_SESSION ) 425 #define LDAP_TRASHED(ld) ( (ld)->ld_valid == LDAP_TRASHED_SESSION ) 426 #define LDAP_TRASH(ld) ( (ld)->ld_valid = LDAP_TRASHED_SESSION ) 427 428 #ifdef LDAP_R_COMPILE 429 LDAP_V ( ldap_pvt_thread_mutex_t ) ldap_int_resolv_mutex; 430 431 #ifdef HAVE_CYRUS_SASL 432 LDAP_V( ldap_pvt_thread_mutex_t ) ldap_int_sasl_mutex; 433 #endif 434 #ifdef HAVE_GSSAPI 435 LDAP_V( ldap_pvt_thread_mutex_t ) ldap_int_gssapi_mutex; 436 #endif 437 #endif 438 439 #ifdef LDAP_R_COMPILE 440 #define LDAP_NEXT_MSGID(ld, id) \ 441 ldap_pvt_thread_mutex_lock( &(ld)->ld_req_mutex ); \ 442 id = ++(ld)->ld_msgid; \ 443 ldap_pvt_thread_mutex_unlock( &(ld)->ld_req_mutex ) 444 #else 445 #define LDAP_NEXT_MSGID(ld, id) id = ++(ld)->ld_msgid 446 #endif 447 448 /* 449 * in abandon.c 450 */ 451 452 LDAP_F (int) 453 ldap_int_bisect_find( ber_int_t *v, ber_len_t n, ber_int_t id, int *idxp ); 454 LDAP_F (int) 455 ldap_int_bisect_insert( ber_int_t **vp, ber_len_t *np, int id, int idx ); 456 LDAP_F (int) 457 ldap_int_bisect_delete( ber_int_t **vp, ber_len_t *np, int id, int idx ); 458 459 /* 460 * in init.c 461 */ 462 463 LDAP_V ( struct ldapoptions ) ldap_int_global_options; 464 465 LDAP_F ( void ) ldap_int_initialize LDAP_P((struct ldapoptions *, int *)); 466 LDAP_F ( void ) ldap_int_initialize_global_options LDAP_P(( 467 struct ldapoptions *, int *)); 468 469 /* memory.c */ 470 /* simple macros to realloc for now */ 471 #define LDAP_MALLOC(s) (ber_memalloc_x((s),NULL)) 472 #define LDAP_CALLOC(n,s) (ber_memcalloc_x((n),(s),NULL)) 473 #define LDAP_REALLOC(p,s) (ber_memrealloc_x((p),(s),NULL)) 474 #define LDAP_FREE(p) (ber_memfree_x((p),NULL)) 475 #define LDAP_VFREE(v) (ber_memvfree_x((void **)(v),NULL)) 476 #define LDAP_STRDUP(s) (ber_strdup_x((s),NULL)) 477 #define LDAP_STRNDUP(s,l) (ber_strndup_x((s),(l),NULL)) 478 479 #define LDAP_MALLOCX(s,x) (ber_memalloc_x((s),(x))) 480 #define LDAP_CALLOCX(n,s,x) (ber_memcalloc_x((n),(s),(x))) 481 #define LDAP_REALLOCX(p,s,x) (ber_memrealloc_x((p),(s),(x))) 482 #define LDAP_FREEX(p,x) (ber_memfree_x((p),(x))) 483 #define LDAP_VFREEX(v,x) (ber_memvfree_x((void **)(v),(x))) 484 #define LDAP_STRDUPX(s,x) (ber_strdup_x((s),(x))) 485 #define LDAP_STRNDUPX(s,l,x) (ber_strndup_x((s),(l),(x))) 486 487 /* 488 * in error.c 489 */ 490 LDAP_F (void) ldap_int_error_init( void ); 491 492 /* 493 * in unit-int.c 494 */ 495 LDAP_F (void) ldap_int_utils_init LDAP_P(( void )); 496 497 498 /* 499 * in print.c 500 */ 501 LDAP_F (int) ldap_log_printf LDAP_P((LDAP *ld, int level, const char *fmt, ...)) LDAP_GCCATTR((format(printf, 3, 4))); 502 503 /* 504 * in cache.c 505 */ 506 LDAP_F (void) ldap_add_request_to_cache LDAP_P(( LDAP *ld, ber_tag_t msgtype, 507 BerElement *request )); 508 LDAP_F (void) ldap_add_result_to_cache LDAP_P(( LDAP *ld, LDAPMessage *result )); 509 LDAP_F (int) ldap_check_cache LDAP_P(( LDAP *ld, ber_tag_t msgtype, BerElement *request )); 510 511 /* 512 * in controls.c 513 */ 514 LDAP_F (int) ldap_int_put_controls LDAP_P(( 515 LDAP *ld, 516 LDAPControl *const *ctrls, 517 BerElement *ber )); 518 519 LDAP_F (int) ldap_int_client_controls LDAP_P(( 520 LDAP *ld, 521 LDAPControl **ctrlp )); 522 523 /* 524 * in dsparse.c 525 */ 526 LDAP_F (int) ldap_int_next_line_tokens LDAP_P(( char **bufp, ber_len_t *blenp, char ***toksp )); 527 528 529 /* 530 * in open.c 531 */ 532 LDAP_F (int) ldap_open_defconn( LDAP *ld ); 533 LDAP_F (int) ldap_int_open_connection( LDAP *ld, 534 LDAPConn *conn, LDAPURLDesc *srvlist, int async ); 535 536 /* 537 * in os-ip.c 538 */ 539 #ifndef HAVE_POLL 540 LDAP_V (int) ldap_int_tblsize; 541 LDAP_F (void) ldap_int_ip_init( void ); 542 #endif 543 544 LDAP_F (int) ldap_int_timeval_dup( struct timeval **dest, 545 const struct timeval *tm ); 546 LDAP_F (int) ldap_connect_to_host( LDAP *ld, Sockbuf *sb, 547 int proto, LDAPURLDesc *srv, int async ); 548 LDAP_F (int) ldap_int_poll( LDAP *ld, ber_socket_t s, 549 struct timeval *tvp ); 550 551 #if defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL) 552 LDAP_V (char *) ldap_int_hostname; 553 LDAP_F (char *) ldap_host_connected_to( Sockbuf *sb, 554 const char *host ); 555 #endif 556 557 LDAP_F (int) ldap_int_select( LDAP *ld, struct timeval *timeout ); 558 LDAP_F (void *) ldap_new_select_info( void ); 559 LDAP_F (void) ldap_free_select_info( void *sip ); 560 LDAP_F (void) ldap_mark_select_write( LDAP *ld, Sockbuf *sb ); 561 LDAP_F (void) ldap_mark_select_read( LDAP *ld, Sockbuf *sb ); 562 LDAP_F (void) ldap_mark_select_clear( LDAP *ld, Sockbuf *sb ); 563 LDAP_F (int) ldap_is_read_ready( LDAP *ld, Sockbuf *sb ); 564 LDAP_F (int) ldap_is_write_ready( LDAP *ld, Sockbuf *sb ); 565 566 LDAP_F (int) ldap_int_connect_cbs( LDAP *ld, Sockbuf *sb, 567 ber_socket_t *s, LDAPURLDesc *srv, struct sockaddr *addr ); 568 569 /* 570 * in os-local.c 571 */ 572 #ifdef LDAP_PF_LOCAL 573 LDAP_F (int) ldap_connect_to_path( LDAP *ld, Sockbuf *sb, 574 LDAPURLDesc *srv, int async ); 575 #endif /* LDAP_PF_LOCAL */ 576 577 /* 578 * in request.c 579 */ 580 LDAP_F (ber_int_t) ldap_send_initial_request( LDAP *ld, ber_tag_t msgtype, 581 const char *dn, BerElement *ber, ber_int_t msgid ); 582 LDAP_F (BerElement *) ldap_alloc_ber_with_options( LDAP *ld ); 583 LDAP_F (void) ldap_set_ber_options( LDAP *ld, BerElement *ber ); 584 585 LDAP_F (int) ldap_send_server_request( LDAP *ld, BerElement *ber, ber_int_t msgid, LDAPRequest *parentreq, LDAPURLDesc **srvlist, LDAPConn *lc, LDAPreqinfo *bind ); 586 LDAP_F (LDAPConn *) ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb, int connect, LDAPreqinfo *bind ); 587 LDAP_F (LDAPRequest *) ldap_find_request_by_msgid( LDAP *ld, ber_int_t msgid ); 588 LDAP_F (void) ldap_return_request( LDAP *ld, LDAPRequest *lr, int freeit ); 589 LDAP_F (void) ldap_free_request( LDAP *ld, LDAPRequest *lr ); 590 LDAP_F (void) ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind ); 591 LDAP_F (void) ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all ); 592 LDAP_F (void) ldap_dump_requests_and_responses( LDAP *ld ); 593 LDAP_F (int) ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, 594 char **errstrp, int sref, int *hadrefp ); 595 LDAP_F (int) ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, 596 char **refs, int sref, char **referralsp, int *hadrefp ); 597 LDAP_F (int) ldap_append_referral( LDAP *ld, char **referralsp, char *s ); 598 LDAP_F (int) ldap_int_flush_request( LDAP *ld, LDAPRequest *lr ); 599 600 /* 601 * in result.c: 602 */ 603 LDAP_F (const char *) ldap_int_msgtype2str( ber_tag_t tag ); 604 605 /* 606 * in search.c 607 */ 608 LDAP_F (BerElement *) ldap_build_search_req LDAP_P(( 609 LDAP *ld, 610 const char *base, 611 ber_int_t scope, 612 const char *filter, 613 char **attrs, 614 ber_int_t attrsonly, 615 LDAPControl **sctrls, 616 LDAPControl **cctrls, 617 ber_int_t timelimit, 618 ber_int_t sizelimit, 619 ber_int_t deref, 620 ber_int_t *msgidp)); 621 622 623 /* 624 * in unbind.c 625 */ 626 LDAP_F (int) ldap_ld_free LDAP_P(( 627 LDAP *ld, 628 int close, 629 LDAPControl **sctrls, 630 LDAPControl **cctrls )); 631 632 LDAP_F (int) ldap_send_unbind LDAP_P(( 633 LDAP *ld, 634 Sockbuf *sb, 635 LDAPControl **sctrls, 636 LDAPControl **cctrls )); 637 638 /* 639 * in url.c 640 */ 641 LDAP_F (LDAPURLDesc *) ldap_url_dup LDAP_P(( 642 LDAPURLDesc *ludp )); 643 644 LDAP_F (LDAPURLDesc *) ldap_url_duplist LDAP_P(( 645 LDAPURLDesc *ludlist )); 646 647 LDAP_F (int) ldap_url_parsehosts LDAP_P(( 648 LDAPURLDesc **ludlist, 649 const char *hosts, 650 int port )); 651 652 LDAP_F (char *) ldap_url_list2hosts LDAP_P(( 653 LDAPURLDesc *ludlist )); 654 655 /* 656 * in cyrus.c 657 */ 658 659 LDAP_F (int) ldap_int_sasl_init LDAP_P(( void )); 660 661 LDAP_F (int) ldap_int_sasl_open LDAP_P(( 662 LDAP *ld, LDAPConn *conn, 663 const char* host )); 664 LDAP_F (int) ldap_int_sasl_close LDAP_P(( LDAP *ld, LDAPConn *conn )); 665 666 LDAP_F (int) ldap_int_sasl_external LDAP_P(( 667 LDAP *ld, LDAPConn *conn, 668 const char* authid, ber_len_t ssf )); 669 670 LDAP_F (int) ldap_int_sasl_get_option LDAP_P(( LDAP *ld, 671 int option, void *arg )); 672 LDAP_F (int) ldap_int_sasl_set_option LDAP_P(( LDAP *ld, 673 int option, void *arg )); 674 LDAP_F (int) ldap_int_sasl_config LDAP_P(( struct ldapoptions *lo, 675 int option, const char *arg )); 676 677 LDAP_F (int) ldap_int_sasl_bind LDAP_P(( 678 LDAP *ld, 679 const char *, 680 const char *, 681 LDAPControl **, LDAPControl **, 682 683 /* should be passed in client controls */ 684 unsigned flags, 685 LDAP_SASL_INTERACT_PROC *interact, 686 void *defaults )); 687 688 /* in schema.c */ 689 LDAP_F (char *) ldap_int_parse_numericoid LDAP_P(( 690 const char **sp, 691 int *code, 692 const int flags )); 693 694 /* 695 * in tls.c 696 */ 697 LDAP_F (int) ldap_int_tls_config LDAP_P(( LDAP *ld, 698 int option, const char *arg )); 699 700 LDAP_F (int) ldap_int_tls_start LDAP_P(( LDAP *ld, 701 LDAPConn *conn, LDAPURLDesc *srv )); 702 703 LDAP_F (void) ldap_int_tls_destroy LDAP_P(( struct ldapoptions *lo )); 704 705 /* 706 * in getvalues.c 707 */ 708 LDAP_F (char **) ldap_value_dup LDAP_P(( 709 char *const *vals )); 710 711 /* 712 * in gssapi.c 713 */ 714 #ifdef HAVE_GSSAPI 715 LDAP_F(int) ldap_int_gssapi_get_option LDAP_P(( LDAP *ld, int option, void *arg )); 716 LDAP_F(int) ldap_int_gssapi_set_option LDAP_P(( LDAP *ld, int option, void *arg )); 717 LDAP_F(int) ldap_int_gssapi_config LDAP_P(( struct ldapoptions *lo, int option, const char *arg )); 718 LDAP_F(void) ldap_int_gssapi_close LDAP_P(( LDAP *ld, LDAPConn *lc )); 719 #endif 720 721 LDAP_END_DECL 722 723 #endif /* _LDAP_INT_H */ 724