1/* $OpenLDAP$ */ 2/* This work is part of OpenLDAP Software <http://www.openldap.org/>. 3 * 4 * Copyright 1998-2011 The OpenLDAP Foundation. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted only as authorized by the OpenLDAP 9 * Public License. 10 * 11 * A copy of this license is available in file LICENSE in the 12 * top-level directory of the distribution or, alternatively, at 13 * <http://www.OpenLDAP.org/license.html>. 14 */ 15/* Portions Copyright (c) 1990 Regents of the University of Michigan. 16 * All rights reserved. 17 * 18 * Redistribution and use in source and binary forms are permitted 19 * provided that this notice is preserved and that due credit is given 20 * to the University of Michigan at Ann Arbor. The name of the University 21 * may not be used to endorse or promote products derived from this 22 * software without specific prior written permission. This software 23 * is provided ``as is'' without express or implied warranty. 24 */ 25 26#ifndef _LDAP_H 27#define _LDAP_H 28 29#include <Availability.h> 30 31/* pull in lber */ 32#include <lber.h> 33 34/* include version and API feature defines */ 35#include <ldap_features.h> 36 37LDAP_BEGIN_DECL 38 39#define LDAP_VERSION1 1 40#define LDAP_VERSION2 2 41#define LDAP_VERSION3 3 42 43#define LDAP_VERSION_MIN LDAP_VERSION2 44#define LDAP_VERSION LDAP_VERSION2 45#define LDAP_VERSION_MAX LDAP_VERSION3 46 47/* Use -DLDAP_DEPRECATED=0 to hide deprecated interfaces */ 48#ifndef LDAP_DEPRECATED 49#define LDAP_DEPRECATED 1 50#endif 51 52/* 53 * We use 3000+n here because it is above 1823 (for RFC 1823), 54 * above 2000+rev of IETF LDAPEXT draft (now quite dated), 55 * yet below allocations for new RFCs (just in case there is 56 * someday an RFC produced). 57 */ 58#define LDAP_API_VERSION 3001 59#define LDAP_VENDOR_NAME "OpenLDAP" 60 61/* OpenLDAP API Features */ 62#define LDAP_API_FEATURE_X_OPENLDAP LDAP_VENDOR_VERSION 63 64#if defined( LDAP_API_FEATURE_X_OPENLDAP_REENTRANT ) || \ 65 ( defined( LDAP_THREAD_SAFE ) && \ 66 defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) ) 67 /* -lldap may or may not be thread safe */ 68 /* -lldap_r, if available, is always thread safe */ 69# define LDAP_API_FEATURE_THREAD_SAFE 1 70# define LDAP_API_FEATURE_SESSION_THREAD_SAFE 1 71# define LDAP_API_FEATURE_OPERATION_THREAD_SAFE 1 72#endif 73#if defined( LDAP_THREAD_SAFE ) && \ 74 defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) 75/* #define LDAP_API_FEATURE_SESSION_SAFE 1 */ 76/* #define LDAP_API_OPERATION_SESSION_SAFE 1 */ 77#endif 78 79 80#define LDAP_PORT 389 /* ldap:/// default LDAP port */ 81#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */ 82 83#define LDAP_ROOT_DSE "" 84#define LDAP_NO_ATTRS "1.1" 85#define LDAP_ALL_USER_ATTRIBUTES "*" 86#define LDAP_ALL_OPERATIONAL_ATTRIBUTES "+" /* RFC 3673 */ 87 88/* RFC 4511: maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- */ 89#define LDAP_MAXINT (2147483647) 90 91/* 92 * LDAP_OPTions 93 * 0x0000 - 0x0fff reserved for api options 94 * 0x1000 - 0x3fff reserved for api extended options 95 * 0x4000 - 0x7fff reserved for private and experimental options 96 */ 97 98#define LDAP_OPT_API_INFO 0x0000 99#define LDAP_OPT_DESC 0x0001 /* historic */ 100#define LDAP_OPT_DEREF 0x0002 101#define LDAP_OPT_SIZELIMIT 0x0003 102#define LDAP_OPT_TIMELIMIT 0x0004 103/* 0x05 - 0x07 not defined */ 104#define LDAP_OPT_REFERRALS 0x0008 105#define LDAP_OPT_RESTART 0x0009 106/* 0x0a - 0x10 not defined */ 107#define LDAP_OPT_PROTOCOL_VERSION 0x0011 108#define LDAP_OPT_SERVER_CONTROLS 0x0012 109#define LDAP_OPT_CLIENT_CONTROLS 0x0013 110/* 0x14 not defined */ 111#define LDAP_OPT_API_FEATURE_INFO 0x0015 112/* 0x16 - 0x2f not defined */ 113#define LDAP_OPT_HOST_NAME 0x0030 114#define LDAP_OPT_RESULT_CODE 0x0031 115#define LDAP_OPT_ERROR_NUMBER LDAP_OPT_RESULT_CODE 116#define LDAP_OPT_DIAGNOSTIC_MESSAGE 0x0032 117#define LDAP_OPT_ERROR_STRING LDAP_OPT_DIAGNOSTIC_MESSAGE 118#define LDAP_OPT_MATCHED_DN 0x0033 119/* 0x0034 - 0x3fff not defined */ 120/* 0x0091 used by Microsoft for LDAP_OPT_AUTO_RECONNECT */ 121#define LDAP_OPT_SSPI_FLAGS 0x0092 122/* 0x0093 used by Microsoft for LDAP_OPT_SSL_INFO */ 123/* 0x0094 used by Microsoft for LDAP_OPT_REF_DEREF_CONN_PER_MSG */ 124#define LDAP_OPT_SIGN 0x0095 125#define LDAP_OPT_ENCRYPT 0x0096 126#define LDAP_OPT_SASL_METHOD 0x0097 127/* 0x0098 used by Microsoft for LDAP_OPT_AREC_EXCLUSIVE */ 128#define LDAP_OPT_SECURITY_CONTEXT 0x0099 129/* 0x009A used by Microsoft for LDAP_OPT_ROOTDSE_CACHE */ 130/* 0x009B - 0x3fff not defined */ 131 132/* API Extensions */ 133#define LDAP_OPT_API_EXTENSION_BASE 0x4000 /* API extensions */ 134 135/* private and experimental options */ 136/* OpenLDAP specific options */ 137#define LDAP_OPT_DEBUG_LEVEL 0x5001 /* debug level */ 138#define LDAP_OPT_TIMEOUT 0x5002 /* default timeout */ 139#define LDAP_OPT_REFHOPLIMIT 0x5003 /* ref hop limit */ 140#define LDAP_OPT_NETWORK_TIMEOUT 0x5005 /* socket level timeout */ 141#define LDAP_OPT_URI 0x5006 142#define LDAP_OPT_REFERRAL_URLS 0x5007 /* Referral URLs */ 143#define LDAP_OPT_SOCKBUF 0x5008 /* sockbuf */ 144#define LDAP_OPT_DEFBASE 0x5009 /* searchbase */ 145#define LDAP_OPT_CONNECT_ASYNC 0x5010 /* create connections asynchronously */ 146#define LDAP_OPT_CONNECT_CB 0x5011 /* connection callbacks */ 147#define LDAP_OPT_SESSION_REFCNT 0x5012 /* session reference count */ 148 149/* OpenLDAP TLS options */ 150#define LDAP_OPT_X_TLS 0x6000 151#define LDAP_OPT_X_TLS_CTX 0x6001 /* OpenSSL CTX* */ 152#define LDAP_OPT_X_TLS_CACERTFILE 0x6002 153#define LDAP_OPT_X_TLS_CACERTDIR 0x6003 154#define LDAP_OPT_X_TLS_CERTFILE 0x6004 155#define LDAP_OPT_X_TLS_KEYFILE 0x6005 156#define LDAP_OPT_X_TLS_REQUIRE_CERT 0x6006 157#define LDAP_OPT_X_TLS_PROTOCOL_MIN 0x6007 158#define LDAP_OPT_X_TLS_CIPHER_SUITE 0x6008 159#define LDAP_OPT_X_TLS_RANDOM_FILE 0x6009 160#define LDAP_OPT_X_TLS_SSL_CTX 0x600a /* OpenSSL SSL* */ 161#define LDAP_OPT_X_TLS_CRLCHECK 0x600b 162#define LDAP_OPT_X_TLS_CONNECT_CB 0x600c 163#define LDAP_OPT_X_TLS_CONNECT_ARG 0x600d 164#define LDAP_OPT_X_TLS_DHFILE 0x600e 165#define LDAP_OPT_X_TLS_NEWCTX 0x600f 166#define LDAP_OPT_X_TLS_CRLFILE 0x6010 /* GNUtls only */ 167#define LDAP_OPT_X_TLS_PACKAGE 0x6011 168#define LDAP_OPT_X_TLS_IDENTITY 0x60fc /* SecureTransport only */ 169#define LDAP_OPT_X_TLS_TRUSTED_CERTS 0x60fd /* SecureTransport only */ 170#define LDAP_OPT_X_TLS_CERT_IDENTITY 0x60fe /*Apple Specific code (OpenSSL) */ 171#define LDAP_OPT_X_TLS_PASSPHRASE 0x60ff /*Apple Specific code (OpenSSL) */ 172 173#define LDAP_OPT_X_TLS_NEVER 0 174#define LDAP_OPT_X_TLS_HARD 1 175#define LDAP_OPT_X_TLS_DEMAND 2 176#define LDAP_OPT_X_TLS_ALLOW 3 177#define LDAP_OPT_X_TLS_TRY 4 178 179#define LDAP_OPT_X_TLS_CRL_NONE 0 180#define LDAP_OPT_X_TLS_CRL_PEER 1 181#define LDAP_OPT_X_TLS_CRL_ALL 2 182 183/* for LDAP_OPT_X_TLS_PROTOCOL_MIN */ 184#define LDAP_OPT_X_TLS_PROTOCOL(maj,min) (((maj) << 8) + (min)) 185#define LDAP_OPT_X_TLS_PROTOCOL_SSL2 (2 << 8) 186#define LDAP_OPT_X_TLS_PROTOCOL_SSL3 (3 << 8) 187#define LDAP_OPT_X_TLS_PROTOCOL_TLS1_0 ((3 << 8) + 1) 188#define LDAP_OPT_X_TLS_PROTOCOL_TLS1_1 ((3 << 8) + 2) 189#define LDAP_OPT_X_TLS_PROTOCOL_TLS1_2 ((3 << 8) + 3) 190 191/* OpenLDAP SASL options */ 192#define LDAP_OPT_X_SASL_MECH 0x6100 193#define LDAP_OPT_X_SASL_REALM 0x6101 194#define LDAP_OPT_X_SASL_AUTHCID 0x6102 195#define LDAP_OPT_X_SASL_AUTHZID 0x6103 196#define LDAP_OPT_X_SASL_SSF 0x6104 /* read-only */ 197#define LDAP_OPT_X_SASL_SSF_EXTERNAL 0x6105 /* write-only */ 198#define LDAP_OPT_X_SASL_SECPROPS 0x6106 /* write-only */ 199#define LDAP_OPT_X_SASL_SSF_MIN 0x6107 200#define LDAP_OPT_X_SASL_SSF_MAX 0x6108 201#define LDAP_OPT_X_SASL_MAXBUFSIZE 0x6109 202#define LDAP_OPT_X_SASL_MECHLIST 0x610a /* read-only */ 203#define LDAP_OPT_X_SASL_NOCANON 0x610b 204#define LDAP_OPT_X_SASL_USERNAME 0x610c /* read-only */ 205#define LDAP_OPT_X_SASL_GSS_CREDS 0x610d 206 207/* OpenLDAP GSSAPI options */ 208#define LDAP_OPT_X_GSSAPI_DO_NOT_FREE_CONTEXT 0x6200 209#define LDAP_OPT_X_GSSAPI_ALLOW_REMOTE_PRINCIPAL 0x6201 210 211/* 212 * OpenLDAP per connection tcp-keepalive settings 213 * (Linux only, ignored where unsupported) 214 */ 215#define LDAP_OPT_X_KEEPALIVE_IDLE 0x6300 216#define LDAP_OPT_X_KEEPALIVE_PROBES 0x6301 217#define LDAP_OPT_X_KEEPALIVE_INTERVAL 0x6302 218 219/* Private API Extensions -- reserved for application use */ 220#define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x7000 /* Private API inclusive */ 221 222/* This option disables reverse lookups for hostnames provided during ldap_init. 223 * If the hostname was an IP, then a reverse lookup is still done. 224 */ 225#define LDAP_OPT_NOREVERSE_LOOKUP LDAP_OPT_X_SASL_NOCANON 226 227/* 228 * ldap_get_option() and ldap_set_option() return values. 229 * As later versions may return other values indicating 230 * failure, current applications should only compare returned 231 * value against LDAP_OPT_SUCCESS. 232 */ 233#define LDAP_OPT_SUCCESS 0 234#define LDAP_OPT_ERROR (-1) 235 236/* option on/off values */ 237#define LDAP_OPT_ON ((void *) &ber_pvt_opt_on) 238#define LDAP_OPT_OFF ((void *) 0) 239 240typedef struct ldapapiinfo { 241 int ldapai_info_version; /* version of LDAPAPIInfo */ 242#define LDAP_API_INFO_VERSION (1) 243 int ldapai_api_version; /* revision of API supported */ 244 int ldapai_protocol_version; /* highest LDAP version supported */ 245 char **ldapai_extensions; /* names of API extensions */ 246 char *ldapai_vendor_name; /* name of supplier */ 247 int ldapai_vendor_version; /* supplier-specific version * 100 */ 248} LDAPAPIInfo; 249 250typedef struct ldap_apifeature_info { 251 int ldapaif_info_version; /* version of LDAPAPIFeatureInfo */ 252#define LDAP_FEATURE_INFO_VERSION (1) /* apifeature_info struct version */ 253 char* ldapaif_name; /* LDAP_API_FEATURE_* (less prefix) */ 254 int ldapaif_version; /* value of LDAP_API_FEATURE_... */ 255} LDAPAPIFeatureInfo; 256 257/* 258 * LDAP Control structure 259 */ 260typedef struct ldapcontrol { 261 char * ldctl_oid; /* numericoid of control */ 262 struct berval ldctl_value; /* encoded value of control */ 263 char ldctl_iscritical; /* criticality */ 264} LDAPControl; 265 266/* LDAP Controls */ 267/* standard track controls */ 268#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2" /* RFC 3296 */ 269#define LDAP_CONTROL_PROXY_AUTHZ "2.16.840.1.113730.3.4.18" /* RFC 4370 */ 270#define LDAP_CONTROL_SUBENTRIES "1.3.6.1.4.1.4203.1.10.1" /* RFC 3672 */ 271 272#define LDAP_CONTROL_VALUESRETURNFILTER "1.2.826.0.1.3344810.2.3"/* RFC 3876 */ 273 274#define LDAP_CONTROL_ASSERT "1.3.6.1.1.12" /* RFC 4528 */ 275#define LDAP_CONTROL_PRE_READ "1.3.6.1.1.13.1" /* RFC 4527 */ 276#define LDAP_CONTROL_POST_READ "1.3.6.1.1.13.2" /* RFC 4527 */ 277 278#define LDAP_CONTROL_SORTREQUEST "1.2.840.113556.1.4.473" /* RFC 2891 */ 279#define LDAP_CONTROL_SORTRESPONSE "1.2.840.113556.1.4.474" /* RFC 2891 */ 280 281/* non-standard track controls */ 282#define LDAP_CONTROL_PAGEDRESULTS "1.2.840.113556.1.4.319" /* RFC 2696 */ 283 284/* LDAP Content Synchronization Operation -- RFC 4533 */ 285#define LDAP_SYNC_OID "1.3.6.1.4.1.4203.1.9.1" 286#define LDAP_CONTROL_SYNC LDAP_SYNC_OID ".1" 287#define LDAP_CONTROL_SYNC_STATE LDAP_SYNC_OID ".2" 288#define LDAP_CONTROL_SYNC_DONE LDAP_SYNC_OID ".3" 289#define LDAP_SYNC_INFO LDAP_SYNC_OID ".4" 290 291#define LDAP_SYNC_NONE 0x00 292#define LDAP_SYNC_REFRESH_ONLY 0x01 293#define LDAP_SYNC_RESERVED 0x02 294#define LDAP_SYNC_REFRESH_AND_PERSIST 0x03 295 296#define LDAP_SYNC_REFRESH_PRESENTS 0 297#define LDAP_SYNC_REFRESH_DELETES 1 298 299#define LDAP_TAG_SYNC_NEW_COOKIE ((ber_tag_t) 0x80U) 300#define LDAP_TAG_SYNC_REFRESH_DELETE ((ber_tag_t) 0xa1U) 301#define LDAP_TAG_SYNC_REFRESH_PRESENT ((ber_tag_t) 0xa2U) 302#define LDAP_TAG_SYNC_ID_SET ((ber_tag_t) 0xa3U) 303 304#define LDAP_TAG_SYNC_COOKIE ((ber_tag_t) 0x04U) 305#define LDAP_TAG_REFRESHDELETES ((ber_tag_t) 0x01U) 306#define LDAP_TAG_REFRESHDONE ((ber_tag_t) 0x01U) 307#define LDAP_TAG_RELOAD_HINT ((ber_tag_t) 0x01U) 308 309#define LDAP_SYNC_PRESENT 0 310#define LDAP_SYNC_ADD 1 311#define LDAP_SYNC_MODIFY 2 312#define LDAP_SYNC_DELETE 3 313#define LDAP_SYNC_NEW_COOKIE 4 314 315 316/* Password policy Controls *//* work in progress */ 317/* ITS#3458: released; disabled by default */ 318#define LDAP_CONTROL_PASSWORDPOLICYREQUEST "1.3.6.1.4.1.42.2.27.8.5.1" 319#define LDAP_CONTROL_PASSWORDPOLICYRESPONSE "1.3.6.1.4.1.42.2.27.8.5.1" 320 321/* various works in progress */ 322#define LDAP_CONTROL_NOOP "1.3.6.1.4.1.4203.666.5.2" 323#define LDAP_CONTROL_NO_SUBORDINATES "1.3.6.1.4.1.4203.666.5.11" 324#define LDAP_CONTROL_RELAX "1.3.6.1.4.1.4203.666.5.12" 325#define LDAP_CONTROL_MANAGEDIT LDAP_CONTROL_RELAX 326#define LDAP_CONTROL_SLURP "1.3.6.1.4.1.4203.666.5.13" 327#define LDAP_CONTROL_VALSORT "1.3.6.1.4.1.4203.666.5.14" 328#define LDAP_CONTROL_DONTUSECOPY "1.3.6.1.4.1.4203.666.5.15" 329#define LDAP_CONTROL_X_DEREF "1.3.6.1.4.1.4203.666.5.16" 330#define LDAP_CONTROL_X_WHATFAILED "1.3.6.1.4.1.4203.666.5.17" 331 332/* LDAP Chaining Behavior Control *//* work in progress */ 333/* <draft-sermersheim-ldap-chaining>; 334 * see also LDAP_NO_REFERRALS_FOUND, LDAP_CANNOT_CHAIN */ 335#define LDAP_CONTROL_X_CHAINING_BEHAVIOR "1.3.6.1.4.1.4203.666.11.3" 336 337#define LDAP_CHAINING_PREFERRED 0 338#define LDAP_CHAINING_REQUIRED 1 339#define LDAP_REFERRALS_PREFERRED 2 340#define LDAP_REFERRALS_REQUIRED 3 341 342/* MS Active Directory controls (for compatibility) */ 343#define LDAP_CONTROL_X_INCREMENTAL_VALUES "1.2.840.113556.1.4.802" 344#define LDAP_CONTROL_X_DOMAIN_SCOPE "1.2.840.113556.1.4.1339" 345#define LDAP_CONTROL_X_PERMISSIVE_MODIFY "1.2.840.113556.1.4.1413" 346#define LDAP_CONTROL_X_SEARCH_OPTIONS "1.2.840.113556.1.4.1340" 347#define LDAP_SEARCH_FLAG_DOMAIN_SCOPE 1 /* do not generate referrals */ 348#define LDAP_SEARCH_FLAG_PHANTOM_ROOT 2 /* search all subordinate NCs */ 349#define LDAP_CONTROL_X_TREE_DELETE "1.2.840.113556.1.4.805" 350 351/* MS Active Directory controls - not implemented in slapd(8) */ 352#define LDAP_CONTROL_X_EXTENDED_DN "1.2.840.113556.1.4.529" 353 354/* <draft-wahl-ldap-session> */ 355#define LDAP_CONTROL_X_SESSION_TRACKING "1.3.6.1.4.1.21008.108.63.1" 356#define LDAP_CONTROL_X_SESSION_TRACKING_RADIUS_ACCT_SESSION_ID \ 357 LDAP_CONTROL_X_SESSION_TRACKING ".1" 358#define LDAP_CONTROL_X_SESSION_TRACKING_RADIUS_ACCT_MULTI_SESSION_ID \ 359 LDAP_CONTROL_X_SESSION_TRACKING ".2" 360#define LDAP_CONTROL_X_SESSION_TRACKING_USERNAME \ 361 LDAP_CONTROL_X_SESSION_TRACKING ".3" 362/* various expired works */ 363 364/* various expired works */ 365/* LDAP Duplicated Entry Control Extension *//* not implemented in slapd(8) */ 366#define LDAP_CONTROL_DUPENT_REQUEST "2.16.840.1.113719.1.27.101.1" 367#define LDAP_CONTROL_DUPENT_RESPONSE "2.16.840.1.113719.1.27.101.2" 368#define LDAP_CONTROL_DUPENT_ENTRY "2.16.840.1.113719.1.27.101.3" 369#define LDAP_CONTROL_DUPENT LDAP_CONTROL_DUPENT_REQUEST 370 371/* LDAP Persistent Search Control *//* not implemented in slapd(8) */ 372#define LDAP_CONTROL_PERSIST_REQUEST "2.16.840.1.113730.3.4.3" 373#define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE "2.16.840.1.113730.3.4.7" 374#define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_ADD 0x1 375#define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_DELETE 0x2 376#define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_MODIFY 0x4 377#define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_RENAME 0x8 378 379/* LDAP VLV */ 380#define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9" 381#define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10" 382 383/* LDAP Unsolicited Notifications */ 384#define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036" /* RFC 4511 */ 385#define LDAP_NOTICE_DISCONNECT LDAP_NOTICE_OF_DISCONNECTION 386 387/* LDAP Extended Operations */ 388#define LDAP_EXOP_START_TLS "1.3.6.1.4.1.1466.20037" /* RFC 4511 */ 389 390#define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1" /* RFC 3062 */ 391#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID ((ber_tag_t) 0x80U) 392#define LDAP_TAG_EXOP_MODIFY_PASSWD_OLD ((ber_tag_t) 0x81U) 393#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW ((ber_tag_t) 0x82U) 394#define LDAP_TAG_EXOP_MODIFY_PASSWD_GEN ((ber_tag_t) 0x80U) 395 396#define LDAP_EXOP_CANCEL "1.3.6.1.1.8" /* RFC 3909 */ 397#define LDAP_EXOP_X_CANCEL LDAP_EXOP_CANCEL 398 399#define LDAP_EXOP_REFRESH "1.3.6.1.4.1.1466.101.119.1" /* RFC 2589 */ 400#define LDAP_TAG_EXOP_REFRESH_REQ_DN ((ber_tag_t) 0x80U) 401#define LDAP_TAG_EXOP_REFRESH_REQ_TTL ((ber_tag_t) 0x81U) 402#define LDAP_TAG_EXOP_REFRESH_RES_TTL ((ber_tag_t) 0x81U) 403 404#define LDAP_EXOP_WHO_AM_I "1.3.6.1.4.1.4203.1.11.3" /* RFC 4532 */ 405#define LDAP_EXOP_X_WHO_AM_I LDAP_EXOP_WHO_AM_I 406 407/* various works in progress */ 408#define LDAP_EXOP_TURN "1.3.6.1.1.19" /* RFC 4531 */ 409#define LDAP_EXOP_X_TURN LDAP_EXOP_TURN 410 411/* LDAP Distributed Procedures <draft-sermersheim-ldap-distproc> */ 412/* a work in progress */ 413#define LDAP_X_DISTPROC_BASE "1.3.6.1.4.1.4203.666.11.6" 414#define LDAP_EXOP_X_CHAINEDREQUEST LDAP_X_DISTPROC_BASE ".1" 415#define LDAP_FEATURE_X_CANCHAINOPS LDAP_X_DISTPROC_BASE ".2" 416#define LDAP_CONTROL_X_RETURNCONTREF LDAP_X_DISTPROC_BASE ".3" 417#define LDAP_URLEXT_X_LOCALREFOID LDAP_X_DISTPROC_BASE ".4" 418#define LDAP_URLEXT_X_REFTYPEOID LDAP_X_DISTPROC_BASE ".5" 419#define LDAP_URLEXT_X_SEARCHEDSUBTREEOID \ 420 LDAP_X_DISTPROC_BASE ".6" 421#define LDAP_URLEXT_X_FAILEDNAMEOID LDAP_X_DISTPROC_BASE ".7" 422#define LDAP_URLEXT_X_LOCALREF "x-localReference" 423#define LDAP_URLEXT_X_REFTYPE "x-referenceType" 424#define LDAP_URLEXT_X_SEARCHEDSUBTREE "x-searchedSubtree" 425#define LDAP_URLEXT_X_FAILEDNAME "x-failedName" 426 427#ifdef LDAP_DEVEL 428#define LDAP_X_TXN "1.3.6.1.4.1.4203.666.11.7" /* tmp */ 429#define LDAP_EXOP_X_TXN_START LDAP_X_TXN ".1" 430#define LDAP_CONTROL_X_TXN_SPEC LDAP_X_TXN ".2" 431#define LDAP_EXOP_X_TXN_END LDAP_X_TXN ".3" 432#define LDAP_EXOP_X_TXN_ABORTED_NOTICE LDAP_X_TXN ".4" 433#endif 434 435/* LDAP Features */ 436#define LDAP_FEATURE_ALL_OP_ATTRS "1.3.6.1.4.1.4203.1.5.1" /* RFC 3673 */ 437#define LDAP_FEATURE_OBJECTCLASS_ATTRS \ 438 "1.3.6.1.4.1.4203.1.5.2" /* @objectClass - new number to be assigned */ 439#define LDAP_FEATURE_ABSOLUTE_FILTERS "1.3.6.1.4.1.4203.1.5.3" /* (&) (|) */ 440#define LDAP_FEATURE_LANGUAGE_TAG_OPTIONS "1.3.6.1.4.1.4203.1.5.4" 441#define LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS "1.3.6.1.4.1.4203.1.5.5" 442#define LDAP_FEATURE_MODIFY_INCREMENT "1.3.6.1.1.14" 443 444/* LDAP Experimental (works in progress) Features */ 445#define LDAP_FEATURE_SUBORDINATE_SCOPE \ 446 "1.3.6.1.4.1.4203.666.8.1" /* "children" */ 447#define LDAP_FEATURE_CHILDREN_SCOPE LDAP_FEATURE_SUBORDINATE_SCOPE 448 449/* 450 * specific LDAP instantiations of BER types we know about 451 */ 452 453/* Overview of LBER tag construction 454 * 455 * Bits 456 * ______ 457 * 8 7 | CLASS 458 * 0 0 = UNIVERSAL 459 * 0 1 = APPLICATION 460 * 1 0 = CONTEXT-SPECIFIC 461 * 1 1 = PRIVATE 462 * _____ 463 * | 6 | DATA-TYPE 464 * 0 = PRIMITIVE 465 * 1 = CONSTRUCTED 466 * ___________ 467 * | 5 ... 1 | TAG-NUMBER 468 */ 469 470/* general stuff */ 471#define LDAP_TAG_MESSAGE ((ber_tag_t) 0x30U) /* constructed + 16 */ 472#define LDAP_TAG_MSGID ((ber_tag_t) 0x02U) /* integer */ 473 474#define LDAP_TAG_LDAPDN ((ber_tag_t) 0x04U) /* octet string */ 475#define LDAP_TAG_LDAPCRED ((ber_tag_t) 0x04U) /* octet string */ 476 477#define LDAP_TAG_CONTROLS ((ber_tag_t) 0xa0U) /* context specific + constructed + 0 */ 478#define LDAP_TAG_REFERRAL ((ber_tag_t) 0xa3U) /* context specific + constructed + 3 */ 479 480#define LDAP_TAG_NEWSUPERIOR ((ber_tag_t) 0x80U) /* context-specific + primitive + 0 */ 481 482#define LDAP_TAG_EXOP_REQ_OID ((ber_tag_t) 0x80U) /* context specific + primitive */ 483#define LDAP_TAG_EXOP_REQ_VALUE ((ber_tag_t) 0x81U) /* context specific + primitive */ 484#define LDAP_TAG_EXOP_RES_OID ((ber_tag_t) 0x8aU) /* context specific + primitive */ 485#define LDAP_TAG_EXOP_RES_VALUE ((ber_tag_t) 0x8bU) /* context specific + primitive */ 486 487#define LDAP_TAG_IM_RES_OID ((ber_tag_t) 0x80U) /* context specific + primitive */ 488#define LDAP_TAG_IM_RES_VALUE ((ber_tag_t) 0x81U) /* context specific + primitive */ 489 490#define LDAP_TAG_SASL_RES_CREDS ((ber_tag_t) 0x87U) /* context specific + primitive */ 491 492/* LDAP Request Messages */ 493#define LDAP_REQ_BIND ((ber_tag_t) 0x60U) /* application + constructed */ 494#define LDAP_REQ_UNBIND ((ber_tag_t) 0x42U) /* application + primitive */ 495#define LDAP_REQ_SEARCH ((ber_tag_t) 0x63U) /* application + constructed */ 496#define LDAP_REQ_MODIFY ((ber_tag_t) 0x66U) /* application + constructed */ 497#define LDAP_REQ_ADD ((ber_tag_t) 0x68U) /* application + constructed */ 498#define LDAP_REQ_DELETE ((ber_tag_t) 0x4aU) /* application + primitive */ 499#define LDAP_REQ_MODDN ((ber_tag_t) 0x6cU) /* application + constructed */ 500#define LDAP_REQ_MODRDN LDAP_REQ_MODDN 501#define LDAP_REQ_RENAME LDAP_REQ_MODDN 502#define LDAP_REQ_COMPARE ((ber_tag_t) 0x6eU) /* application + constructed */ 503#define LDAP_REQ_ABANDON ((ber_tag_t) 0x50U) /* application + primitive */ 504#define LDAP_REQ_EXTENDED ((ber_tag_t) 0x77U) /* application + constructed */ 505 506/* LDAP Response Messages */ 507#define LDAP_RES_BIND ((ber_tag_t) 0x61U) /* application + constructed */ 508#define LDAP_RES_SEARCH_ENTRY ((ber_tag_t) 0x64U) /* application + constructed */ 509#define LDAP_RES_SEARCH_REFERENCE ((ber_tag_t) 0x73U) /* V3: application + constructed */ 510#define LDAP_RES_SEARCH_RESULT ((ber_tag_t) 0x65U) /* application + constructed */ 511#define LDAP_RES_MODIFY ((ber_tag_t) 0x67U) /* application + constructed */ 512#define LDAP_RES_ADD ((ber_tag_t) 0x69U) /* application + constructed */ 513#define LDAP_RES_DELETE ((ber_tag_t) 0x6bU) /* application + constructed */ 514#define LDAP_RES_MODDN ((ber_tag_t) 0x6dU) /* application + constructed */ 515#define LDAP_RES_MODRDN LDAP_RES_MODDN /* application + constructed */ 516#define LDAP_RES_RENAME LDAP_RES_MODDN /* application + constructed */ 517#define LDAP_RES_COMPARE ((ber_tag_t) 0x6fU) /* application + constructed */ 518#define LDAP_RES_EXTENDED ((ber_tag_t) 0x78U) /* V3: application + constructed */ 519#define LDAP_RES_INTERMEDIATE ((ber_tag_t) 0x79U) /* V3+: application + constructed */ 520 521#define LDAP_RES_ANY (-1) 522#define LDAP_RES_UNSOLICITED (0) 523 524 525/* sasl methods */ 526#define LDAP_SASL_SIMPLE ((char*)0) 527#define LDAP_SASL_NULL ("") 528 529 530/* authentication methods available */ 531#define LDAP_AUTH_NONE ((ber_tag_t) 0x00U) /* no authentication */ 532#define LDAP_AUTH_SIMPLE ((ber_tag_t) 0x80U) /* context specific + primitive */ 533#define LDAP_AUTH_SASL ((ber_tag_t) 0xa3U) /* context specific + constructed */ 534#define LDAP_AUTH_KRBV4 ((ber_tag_t) 0xffU) /* means do both of the following */ 535#define LDAP_AUTH_KRBV41 ((ber_tag_t) 0x81U) /* context specific + primitive */ 536#define LDAP_AUTH_KRBV42 ((ber_tag_t) 0x82U) /* context specific + primitive */ 537 538/* used by the Windows API but not used on the wire */ 539#define LDAP_AUTH_NEGOTIATE ((ber_tag_t) 0x04FFU) 540 541/* filter types */ 542#define LDAP_FILTER_AND ((ber_tag_t) 0xa0U) /* context specific + constructed */ 543#define LDAP_FILTER_OR ((ber_tag_t) 0xa1U) /* context specific + constructed */ 544#define LDAP_FILTER_NOT ((ber_tag_t) 0xa2U) /* context specific + constructed */ 545#define LDAP_FILTER_EQUALITY ((ber_tag_t) 0xa3U) /* context specific + constructed */ 546#define LDAP_FILTER_SUBSTRINGS ((ber_tag_t) 0xa4U) /* context specific + constructed */ 547#define LDAP_FILTER_GE ((ber_tag_t) 0xa5U) /* context specific + constructed */ 548#define LDAP_FILTER_LE ((ber_tag_t) 0xa6U) /* context specific + constructed */ 549#define LDAP_FILTER_PRESENT ((ber_tag_t) 0x87U) /* context specific + primitive */ 550#define LDAP_FILTER_APPROX ((ber_tag_t) 0xa8U) /* context specific + constructed */ 551#define LDAP_FILTER_EXT ((ber_tag_t) 0xa9U) /* context specific + constructed */ 552 553/* extended filter component types */ 554#define LDAP_FILTER_EXT_OID ((ber_tag_t) 0x81U) /* context specific */ 555#define LDAP_FILTER_EXT_TYPE ((ber_tag_t) 0x82U) /* context specific */ 556#define LDAP_FILTER_EXT_VALUE ((ber_tag_t) 0x83U) /* context specific */ 557#define LDAP_FILTER_EXT_DNATTRS ((ber_tag_t) 0x84U) /* context specific */ 558 559/* substring filter component types */ 560#define LDAP_SUBSTRING_INITIAL ((ber_tag_t) 0x80U) /* context specific */ 561#define LDAP_SUBSTRING_ANY ((ber_tag_t) 0x81U) /* context specific */ 562#define LDAP_SUBSTRING_FINAL ((ber_tag_t) 0x82U) /* context specific */ 563 564/* search scopes */ 565#define LDAP_SCOPE_BASE ((ber_int_t) 0x0000) 566#define LDAP_SCOPE_BASEOBJECT LDAP_SCOPE_BASE 567#define LDAP_SCOPE_ONELEVEL ((ber_int_t) 0x0001) 568#define LDAP_SCOPE_ONE LDAP_SCOPE_ONELEVEL 569#define LDAP_SCOPE_SUBTREE ((ber_int_t) 0x0002) 570#define LDAP_SCOPE_SUB LDAP_SCOPE_SUBTREE 571#define LDAP_SCOPE_SUBORDINATE ((ber_int_t) 0x0003) /* OpenLDAP extension */ 572#define LDAP_SCOPE_CHILDREN LDAP_SCOPE_SUBORDINATE 573#define LDAP_SCOPE_DEFAULT ((ber_int_t) -1) /* OpenLDAP extension */ 574 575/* substring filter component types */ 576#define LDAP_SUBSTRING_INITIAL ((ber_tag_t) 0x80U) /* context specific */ 577#define LDAP_SUBSTRING_ANY ((ber_tag_t) 0x81U) /* context specific */ 578#define LDAP_SUBSTRING_FINAL ((ber_tag_t) 0x82U) /* context specific */ 579 580/* 581 * LDAP Result Codes 582 */ 583#define LDAP_SUCCESS 0x00 584 585#define LDAP_RANGE(n,x,y) (((x) <= (n)) && ((n) <= (y))) 586 587#define LDAP_OPERATIONS_ERROR 0x01 588#define LDAP_PROTOCOL_ERROR 0x02 589#define LDAP_TIMELIMIT_EXCEEDED 0x03 590#define LDAP_SIZELIMIT_EXCEEDED 0x04 591#define LDAP_COMPARE_FALSE 0x05 592#define LDAP_COMPARE_TRUE 0x06 593#define LDAP_AUTH_METHOD_NOT_SUPPORTED 0x07 594#define LDAP_STRONG_AUTH_NOT_SUPPORTED LDAP_AUTH_METHOD_NOT_SUPPORTED 595#define LDAP_STRONG_AUTH_REQUIRED 0x08 596#define LDAP_STRONGER_AUTH_REQUIRED LDAP_STRONG_AUTH_REQUIRED 597#define LDAP_PARTIAL_RESULTS 0x09 /* LDAPv2+ (not LDAPv3) */ 598 599#define LDAP_REFERRAL 0x0a /* LDAPv3 */ 600#define LDAP_ADMINLIMIT_EXCEEDED 0x0b /* LDAPv3 */ 601#define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* LDAPv3 */ 602#define LDAP_CONFIDENTIALITY_REQUIRED 0x0d /* LDAPv3 */ 603#define LDAP_SASL_BIND_IN_PROGRESS 0x0e /* LDAPv3 */ 604 605#define LDAP_ATTR_ERROR(n) LDAP_RANGE((n),0x10,0x15) /* 16-21 */ 606 607#define LDAP_NO_SUCH_ATTRIBUTE 0x10 608#define LDAP_UNDEFINED_TYPE 0x11 609#define LDAP_INAPPROPRIATE_MATCHING 0x12 610#define LDAP_CONSTRAINT_VIOLATION 0x13 611#define LDAP_TYPE_OR_VALUE_EXISTS 0x14 612#define LDAP_INVALID_SYNTAX 0x15 613 614#define LDAP_NAME_ERROR(n) LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */ 615 616#define LDAP_NO_SUCH_OBJECT 0x20 617#define LDAP_ALIAS_PROBLEM 0x21 618#define LDAP_INVALID_DN_SYNTAX 0x22 619#define LDAP_IS_LEAF 0x23 /* not LDAPv3 */ 620#define LDAP_ALIAS_DEREF_PROBLEM 0x24 621 622#define LDAP_SECURITY_ERROR(n) LDAP_RANGE((n),0x2F,0x32) /* 47-50 */ 623 624#define LDAP_X_PROXY_AUTHZ_FAILURE 0x2F /* LDAPv3 proxy authorization */ 625#define LDAP_INAPPROPRIATE_AUTH 0x30 626#define LDAP_INVALID_CREDENTIALS 0x31 627#define LDAP_INSUFFICIENT_ACCESS 0x32 628 629#define LDAP_SERVICE_ERROR(n) LDAP_RANGE((n),0x33,0x36) /* 51-54 */ 630 631#define LDAP_BUSY 0x33 632#define LDAP_UNAVAILABLE 0x34 633#define LDAP_UNWILLING_TO_PERFORM 0x35 634#define LDAP_LOOP_DETECT 0x36 635 636#define LDAP_UPDATE_ERROR(n) LDAP_RANGE((n),0x40,0x47) /* 64-69,71 */ 637 638#define LDAP_NAMING_VIOLATION 0x40 639#define LDAP_OBJECT_CLASS_VIOLATION 0x41 640#define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42 641#define LDAP_NOT_ALLOWED_ON_RDN 0x43 642#define LDAP_ALREADY_EXISTS 0x44 643#define LDAP_NO_OBJECT_CLASS_MODS 0x45 644#define LDAP_RESULTS_TOO_LARGE 0x46 /* CLDAP */ 645#define LDAP_AFFECTS_MULTIPLE_DSAS 0x47 646 647#define LDAP_VLV_ERROR 0x4C 648 649#define LDAP_OTHER 0x50 650 651/* LCUP operation codes (113-117) - not implemented */ 652#define LDAP_CUP_RESOURCES_EXHAUSTED 0x71 653#define LDAP_CUP_SECURITY_VIOLATION 0x72 654#define LDAP_CUP_INVALID_DATA 0x73 655#define LDAP_CUP_UNSUPPORTED_SCHEME 0x74 656#define LDAP_CUP_RELOAD_REQUIRED 0x75 657 658/* Cancel operation codes (118-121) */ 659#define LDAP_CANCELLED 0x76 660#define LDAP_NO_SUCH_OPERATION 0x77 661#define LDAP_TOO_LATE 0x78 662#define LDAP_CANNOT_CANCEL 0x79 663 664/* Assertion control (122) */ 665#define LDAP_ASSERTION_FAILED 0x7A 666 667/* Proxied Authorization Denied (123) */ 668#define LDAP_PROXIED_AUTHORIZATION_DENIED 0x7B 669 670/* Experimental result codes */ 671#define LDAP_E_ERROR(n) LDAP_RANGE((n),0x1000,0x3FFF) 672 673/* LDAP Sync (4096) */ 674#define LDAP_SYNC_REFRESH_REQUIRED 0x1000 675 676 677/* Private Use result codes */ 678#define LDAP_X_ERROR(n) LDAP_RANGE((n),0x4000,0xFFFF) 679 680#define LDAP_X_SYNC_REFRESH_REQUIRED 0x4100 /* defunct */ 681#define LDAP_X_ASSERTION_FAILED 0x410f /* defunct */ 682 683/* for the LDAP No-Op control */ 684#define LDAP_X_NO_OPERATION 0x410e 685 686/* for the Chaining Behavior control (consecutive result codes requested; 687 * see <draft-sermersheim-ldap-chaining> ) */ 688#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR 689#define LDAP_X_NO_REFERRALS_FOUND 0x4110 690#define LDAP_X_CANNOT_CHAIN 0x4111 691#endif 692 693/* for Distributed Procedures (see <draft-sermersheim-ldap-distproc>) */ 694#ifdef LDAP_X_DISTPROC_BASE 695#define LDAP_X_INVALIDREFERENCE 0x4112 696#endif 697 698#ifdef LDAP_X_TXN 699#define LDAP_X_TXN_SPECIFY_OKAY 0x4120 700#define LDAP_X_TXN_ID_INVALID 0x4121 701#endif 702 703/* API Error Codes 704 * 705 * Based on draft-ietf-ldap-c-api-xx 706 * but with new negative code values 707 */ 708#define LDAP_API_ERROR(n) ((n)<0) 709#define LDAP_API_RESULT(n) ((n)<=0) 710 711#define LDAP_SERVER_DOWN (-1) 712#define LDAP_LOCAL_ERROR (-2) 713#define LDAP_ENCODING_ERROR (-3) 714#define LDAP_DECODING_ERROR (-4) 715#define LDAP_TIMEOUT (-5) 716#define LDAP_AUTH_UNKNOWN (-6) 717#define LDAP_FILTER_ERROR (-7) 718#define LDAP_USER_CANCELLED (-8) 719#define LDAP_PARAM_ERROR (-9) 720#define LDAP_NO_MEMORY (-10) 721#define LDAP_CONNECT_ERROR (-11) 722#define LDAP_NOT_SUPPORTED (-12) 723#define LDAP_CONTROL_NOT_FOUND (-13) 724#define LDAP_NO_RESULTS_RETURNED (-14) 725#define LDAP_MORE_RESULTS_TO_RETURN (-15) /* Obsolete */ 726#define LDAP_CLIENT_LOOP (-16) 727#define LDAP_REFERRAL_LIMIT_EXCEEDED (-17) 728#define LDAP_X_CONNECTING (-18) 729 730 731/* 732 * This structure represents both ldap messages and ldap responses. 733 * These are really the same, except in the case of search responses, 734 * where a response has multiple messages. 735 */ 736 737typedef struct ldapmsg LDAPMessage; 738 739/* for modifications */ 740typedef struct ldapmod { 741 int mod_op; 742 743#define LDAP_MOD_OP (0x0007) 744#define LDAP_MOD_ADD (0x0000) 745#define LDAP_MOD_DELETE (0x0001) 746#define LDAP_MOD_REPLACE (0x0002) 747#define LDAP_MOD_INCREMENT (0x0003) /* OpenLDAP extension */ 748#define LDAP_MOD_BVALUES (0x0080) 749/* IMPORTANT: do not use code 0x1000 (or above), 750 * it is used internally by the backends! 751 * (see ldap/servers/slapd/slap.h) 752 */ 753 754 char *mod_type; 755 union mod_vals_u { 756 char **modv_strvals; 757 struct berval **modv_bvals; 758 } mod_vals; 759#define mod_values mod_vals.modv_strvals 760#define mod_bvalues mod_vals.modv_bvals 761} LDAPMod; 762 763/* 764 * structure representing an ldap session which can 765 * encompass connections to multiple servers (in the 766 * face of referrals). 767 */ 768typedef struct ldap LDAP; 769 770#define LDAP_DEREF_NEVER 0x00 771#define LDAP_DEREF_SEARCHING 0x01 772#define LDAP_DEREF_FINDING 0x02 773#define LDAP_DEREF_ALWAYS 0x03 774 775#define LDAP_NO_LIMIT 0 776 777/* how many messages to retrieve results for */ 778#define LDAP_MSG_ONE 0x00 779#define LDAP_MSG_ALL 0x01 780#define LDAP_MSG_RECEIVED 0x02 781 782/* 783 * types for ldap URL handling 784 */ 785typedef struct ldap_url_desc { 786 struct ldap_url_desc *lud_next; 787 char *lud_scheme; 788 char *lud_host; 789 int lud_port; 790 char *lud_dn; 791 char **lud_attrs; 792 int lud_scope; 793 char *lud_filter; 794 char **lud_exts; 795 int lud_crit_exts; 796} LDAPURLDesc; 797 798#define LDAP_URL_SUCCESS 0x00 /* Success */ 799#define LDAP_URL_ERR_MEM 0x01 /* can't allocate memory space */ 800#define LDAP_URL_ERR_PARAM 0x02 /* parameter is bad */ 801 802#define LDAP_URL_ERR_BADSCHEME 0x03 /* URL doesn't begin with "ldap[si]://" */ 803#define LDAP_URL_ERR_BADENCLOSURE 0x04 /* URL is missing trailing ">" */ 804#define LDAP_URL_ERR_BADURL 0x05 /* URL is bad */ 805#define LDAP_URL_ERR_BADHOST 0x06 /* host port is bad */ 806#define LDAP_URL_ERR_BADATTRS 0x07 /* bad (or missing) attributes */ 807#define LDAP_URL_ERR_BADSCOPE 0x08 /* scope string is invalid (or missing) */ 808#define LDAP_URL_ERR_BADFILTER 0x09 /* bad or missing filter */ 809#define LDAP_URL_ERR_BADEXTS 0x0a /* bad or missing extensions */ 810 811/* 812 * LDAP sync (RFC4533) API 813 */ 814 815typedef struct ldap_sync_t ldap_sync_t; 816 817typedef enum { 818 /* these are private - the client should never see them */ 819 LDAP_SYNC_CAPI_NONE = -1, 820 821 LDAP_SYNC_CAPI_PHASE_FLAG = 0x10U, 822 LDAP_SYNC_CAPI_IDSET_FLAG = 0x20U, 823 LDAP_SYNC_CAPI_DONE_FLAG = 0x40U, 824 825 /* these are passed to ls_search_entry() */ 826 LDAP_SYNC_CAPI_PRESENT = LDAP_SYNC_PRESENT, 827 LDAP_SYNC_CAPI_ADD = LDAP_SYNC_ADD, 828 LDAP_SYNC_CAPI_MODIFY = LDAP_SYNC_MODIFY, 829 LDAP_SYNC_CAPI_DELETE = LDAP_SYNC_DELETE, 830 831 /* these are passed to ls_intermediate() */ 832 LDAP_SYNC_CAPI_PRESENTS = ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_PRESENT ), 833 LDAP_SYNC_CAPI_DELETES = ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_DELETE ), 834 835 LDAP_SYNC_CAPI_PRESENTS_IDSET = ( LDAP_SYNC_CAPI_PRESENTS | LDAP_SYNC_CAPI_IDSET_FLAG ), 836 LDAP_SYNC_CAPI_DELETES_IDSET = ( LDAP_SYNC_CAPI_DELETES | LDAP_SYNC_CAPI_IDSET_FLAG ), 837 838 LDAP_SYNC_CAPI_DONE = ( LDAP_SYNC_CAPI_DONE_FLAG | LDAP_SYNC_CAPI_PRESENTS ) 839} ldap_sync_refresh_t; 840 841/* 842 * Called when an entry is returned by ldap_result(). 843 * If phase is LDAP_SYNC_CAPI_ADD or LDAP_SYNC_CAPI_MODIFY, 844 * the entry has been either added or modified, and thus 845 * the complete view of the entry should be in the LDAPMessage. 846 * If phase is LDAP_SYNC_CAPI_PRESENT or LDAP_SYNC_CAPI_DELETE, 847 * only the DN should be in the LDAPMessage. 848 */ 849typedef int (*ldap_sync_search_entry_f) LDAP_P(( 850 ldap_sync_t *ls, 851 LDAPMessage *msg, 852 struct berval *entryUUID, 853 ldap_sync_refresh_t phase )); 854 855/* 856 * Called when a reference is returned; the client should know 857 * what to do with it. 858 */ 859typedef int (*ldap_sync_search_reference_f) LDAP_P(( 860 ldap_sync_t *ls, 861 LDAPMessage *msg )); 862 863/* 864 * Called when specific intermediate/final messages are returned. 865 * If phase is LDAP_SYNC_CAPI_PRESENTS or LDAP_SYNC_CAPI_DELETES, 866 * a "presents" or "deletes" phase begins. 867 * If phase is LDAP_SYNC_CAPI_DONE, a special "presents" phase 868 * with refreshDone set to "TRUE" has been returned, to indicate 869 * that the refresh phase of a refreshAndPersist is complete. 870 * In the above cases, syncUUIDs is NULL. 871 * 872 * If phase is LDAP_SYNC_CAPI_PRESENTS_IDSET or 873 * LDAP_SYNC_CAPI_DELETES_IDSET, syncUUIDs is an array of UUIDs 874 * that are either present or have been deleted. 875 */ 876typedef int (*ldap_sync_intermediate_f) LDAP_P(( 877 ldap_sync_t *ls, 878 LDAPMessage *msg, 879 BerVarray syncUUIDs, 880 ldap_sync_refresh_t phase )); 881 882/* 883 * Called when a searchResultDone is returned. In refreshAndPersist, 884 * this can only occur if the search for any reason is being terminated 885 * by the server. 886 */ 887typedef int (*ldap_sync_search_result_f) LDAP_P(( 888 ldap_sync_t *ls, 889 LDAPMessage *msg, 890 int refreshDeletes )); 891 892/* 893 * This structure contains all information about the persistent search; 894 * the caller is responsible for connecting, setting version, binding, tls... 895 */ 896struct ldap_sync_t { 897 /* conf search params */ 898 char *ls_base; 899 int ls_scope; 900 char *ls_filter; 901 char **ls_attrs; 902 int ls_timelimit; 903 int ls_sizelimit; 904 905 /* poll timeout */ 906 int ls_timeout; 907 908 /* helpers - add as appropriate */ 909 ldap_sync_search_entry_f ls_search_entry; 910 ldap_sync_search_reference_f ls_search_reference; 911 ldap_sync_intermediate_f ls_intermediate; 912 ldap_sync_search_result_f ls_search_result; 913 914 /* set by the caller as appropriate */ 915 void *ls_private; 916 917 /* conn stuff */ 918 LDAP *ls_ld; 919 920 /* --- the parameters below are private - do not modify --- */ 921 922 /* FIXME: make the structure opaque, and provide an interface 923 * to modify the public values? */ 924 925 /* result stuff */ 926 int ls_msgid; 927 928 /* sync stuff */ 929 /* needed by refreshOnly */ 930 int ls_reloadHint; 931 932 /* opaque - need to pass between sessions, updated by the API */ 933 struct berval ls_cookie; 934 935 /* state variable - do not modify */ 936 ldap_sync_refresh_t ls_refreshPhase; 937}; 938 939/* 940 * End of LDAP sync (RFC4533) API 941 */ 942 943/* 944 * Connection callbacks... 945 */ 946struct ldap_conncb; 947struct sockaddr; 948 949/* Called after a connection is established */ 950typedef int (ldap_conn_add_f) LDAP_P(( LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, struct sockaddr *addr, 951 struct ldap_conncb *ctx )); 952/* Called before a connection is closed */ 953typedef void (ldap_conn_del_f) LDAP_P(( LDAP *ld, Sockbuf *sb, struct ldap_conncb *ctx )); 954 955/* Callbacks are pushed on a stack. Last one pushed is first one executed. The 956 * delete callback is called with a NULL Sockbuf just before freeing the LDAP handle. 957 */ 958typedef struct ldap_conncb { 959 ldap_conn_add_f *lc_add; 960 ldap_conn_del_f *lc_del; 961 void *lc_arg; 962} ldap_conncb; 963 964/* 965 * The API draft spec says we should declare (or cause to be declared) 966 * 'struct timeval'. We don't. See IETF LDAPext discussions. 967 */ 968struct timeval; 969 970/* 971 * in options.c: 972 */ 973LDAP_F( int ) 974ldap_get_option LDAP_P(( 975 LDAP *ld, 976 int option, 977 void *outvalue)); 978 979LDAP_F( int ) 980ldap_set_option LDAP_P(( 981 LDAP *ld, 982 int option, 983 LDAP_CONST void *invalue)); 984 985/* V3 REBIND Function Callback Prototype */ 986typedef int (LDAP_REBIND_PROC) LDAP_P(( 987 LDAP *ld, LDAP_CONST char *url, 988 ber_tag_t request, ber_int_t msgid, 989 void *params )); 990 991LDAP_F( int ) 992ldap_set_rebind_proc LDAP_P(( 993 LDAP *ld, 994 LDAP_REBIND_PROC *rebind_proc, 995 void *params )); 996 997/* V3 referral selection Function Callback Prototype */ 998typedef int (LDAP_NEXTREF_PROC) LDAP_P(( 999 LDAP *ld, char ***refsp, int *cntp, 1000 void *params )); 1001 1002LDAP_F( int ) 1003ldap_set_nextref_proc LDAP_P(( 1004 LDAP *ld, 1005 LDAP_NEXTREF_PROC *nextref_proc, 1006 void *params )); 1007 1008/* V3 URLLIST Function Callback Prototype */ 1009typedef int (LDAP_URLLIST_PROC) LDAP_P(( 1010 LDAP *ld, 1011 LDAPURLDesc **urllist, 1012 LDAPURLDesc **url, 1013 void *params )); 1014 1015LDAP_F( int ) 1016ldap_set_urllist_proc LDAP_P(( 1017 LDAP *ld, 1018 LDAP_URLLIST_PROC *urllist_proc, 1019 void *params )); 1020 1021/* 1022 * in controls.c: 1023 */ 1024#if LDAP_DEPRECATED 1025LDAP_F( int ) 1026ldap_create_control LDAP_P(( /* deprecated, use ldap_control_create */ 1027 LDAP_CONST char *requestOID, 1028 BerElement *ber, 1029 int iscritical, 1030 LDAPControl **ctrlp )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_control_create"); 1031 1032LDAP_F( LDAPControl * ) 1033ldap_find_control LDAP_P(( /* deprecated, use ldap_control_find */ 1034 LDAP_CONST char *oid, 1035 LDAPControl **ctrls )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_control_find"); 1036#endif 1037 1038LDAP_F( int ) 1039ldap_control_create LDAP_P(( 1040 LDAP_CONST char *requestOID, 1041 int iscritical, 1042 struct berval *value, 1043 int dupval, 1044 LDAPControl **ctrlp )); 1045 1046LDAP_F( LDAPControl * ) 1047ldap_control_find LDAP_P(( 1048 LDAP_CONST char *oid, 1049 LDAPControl **ctrls, 1050 LDAPControl ***nextctrlp )); 1051 1052LDAP_F( void ) 1053ldap_control_free LDAP_P(( 1054 LDAPControl *ctrl )); 1055 1056LDAP_F( void ) 1057ldap_controls_free LDAP_P(( 1058 LDAPControl **ctrls )); 1059 1060LDAP_F( LDAPControl ** ) 1061ldap_controls_dup LDAP_P(( 1062 LDAPControl *LDAP_CONST *controls )); 1063 1064LDAP_F( LDAPControl * ) 1065ldap_control_dup LDAP_P(( 1066 LDAP_CONST LDAPControl *c )); 1067 1068/* 1069 * in dnssrv.c: 1070 */ 1071LDAP_F( int ) 1072ldap_domain2dn LDAP_P(( 1073 LDAP_CONST char* domain, 1074 char** dn )); 1075 1076LDAP_F( int ) 1077ldap_dn2domain LDAP_P(( 1078 LDAP_CONST char* dn, 1079 char** domain )); 1080 1081LDAP_F( int ) 1082ldap_domain2hostlist LDAP_P(( 1083 LDAP_CONST char *domain, 1084 char** hostlist )); 1085 1086/* 1087 * in extended.c: 1088 */ 1089LDAP_F( int ) 1090ldap_extended_operation LDAP_P(( 1091 LDAP *ld, 1092 LDAP_CONST char *reqoid, 1093 struct berval *reqdata, 1094 LDAPControl **serverctrls, 1095 LDAPControl **clientctrls, 1096 int *msgidp )); 1097 1098LDAP_F( int ) 1099ldap_extended_operation_s LDAP_P(( 1100 LDAP *ld, 1101 LDAP_CONST char *reqoid, 1102 struct berval *reqdata, 1103 LDAPControl **serverctrls, 1104 LDAPControl **clientctrls, 1105 char **retoidp, 1106 struct berval **retdatap )); 1107 1108LDAP_F( int ) 1109ldap_parse_extended_result LDAP_P(( 1110 LDAP *ld, 1111 LDAPMessage *res, 1112 char **retoidp, 1113 struct berval **retdatap, 1114 int freeit )); 1115 1116LDAP_F( int ) 1117ldap_parse_intermediate LDAP_P(( 1118 LDAP *ld, 1119 LDAPMessage *res, 1120 char **retoidp, 1121 struct berval **retdatap, 1122 LDAPControl ***serverctrls, 1123 int freeit )); 1124 1125 1126/* 1127 * in abandon.c: 1128 */ 1129LDAP_F( int ) 1130ldap_abandon_ext LDAP_P(( 1131 LDAP *ld, 1132 int msgid, 1133 LDAPControl **serverctrls, 1134 LDAPControl **clientctrls )); 1135 1136#if LDAP_DEPRECATED 1137LDAP_F( int ) 1138ldap_abandon LDAP_P(( /* deprecated, use ldap_abandon_ext */ 1139 LDAP *ld, 1140 int msgid )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_abandon_ext"); 1141#endif 1142 1143/* 1144 * in add.c: 1145 */ 1146LDAP_F( int ) 1147ldap_add_ext LDAP_P(( 1148 LDAP *ld, 1149 LDAP_CONST char *dn, 1150 LDAPMod **attrs, 1151 LDAPControl **serverctrls, 1152 LDAPControl **clientctrls, 1153 int *msgidp )); 1154 1155LDAP_F( int ) 1156ldap_add_ext_s LDAP_P(( 1157 LDAP *ld, 1158 LDAP_CONST char *dn, 1159 LDAPMod **attrs, 1160 LDAPControl **serverctrls, 1161 LDAPControl **clientctrls )); 1162 1163#if LDAP_DEPRECATED 1164LDAP_F( int ) 1165ldap_add LDAP_P(( /* deprecated, use ldap_add_ext */ 1166 LDAP *ld, 1167 LDAP_CONST char *dn, 1168 LDAPMod **attrs )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_add_ext"); 1169 1170LDAP_F( int ) 1171ldap_add_s LDAP_P(( /* deprecated, use ldap_add_ext_s */ 1172 LDAP *ld, 1173 LDAP_CONST char *dn, 1174 LDAPMod **attrs )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_add_ext_s"); 1175#endif 1176 1177 1178/* 1179 * in sasl.c: 1180 */ 1181LDAP_F( int ) 1182ldap_sasl_bind LDAP_P(( 1183 LDAP *ld, 1184 LDAP_CONST char *dn, 1185 LDAP_CONST char *mechanism, 1186 struct berval *cred, 1187 LDAPControl **serverctrls, 1188 LDAPControl **clientctrls, 1189 int *msgidp )); 1190 1191/* Interaction flags (should be passed about in a control) 1192 * Automatic (default): use defaults, prompt otherwise 1193 * Interactive: prompt always 1194 * Quiet: never prompt 1195 */ 1196#define LDAP_SASL_AUTOMATIC 0U 1197#define LDAP_SASL_INTERACTIVE 1U 1198#define LDAP_SASL_QUIET 2U 1199 1200/* 1201 * V3 SASL Interaction Function Callback Prototype 1202 * when using Cyrus SASL, interact is pointer to sasl_interact_t 1203 * should likely passed in a control (and provided controls) 1204 */ 1205typedef int (LDAP_SASL_INTERACT_PROC) LDAP_P(( 1206 LDAP *ld, unsigned flags, void* defaults, void *interact )); 1207 1208LDAP_F( int ) 1209ldap_sasl_interactive_bind LDAP_P(( 1210 LDAP *ld, 1211 LDAP_CONST char *dn, /* usually NULL */ 1212 LDAP_CONST char *saslMechanism, 1213 LDAPControl **serverControls, 1214 LDAPControl **clientControls, 1215 1216 /* should be client controls */ 1217 unsigned flags, 1218 LDAP_SASL_INTERACT_PROC *proc, 1219 void *defaults, 1220 1221 /* as obtained from ldap_result() */ 1222 LDAPMessage *result, 1223 1224 /* returned during bind processing */ 1225 const char **rmech, 1226 int *msgid )); 1227 1228LDAP_F( int ) 1229ldap_sasl_interactive_bind_s LDAP_P(( 1230 LDAP *ld, 1231 LDAP_CONST char *dn, /* usually NULL */ 1232 LDAP_CONST char *saslMechanism, 1233 LDAPControl **serverControls, 1234 LDAPControl **clientControls, 1235 1236 /* should be client controls */ 1237 unsigned flags, 1238 LDAP_SASL_INTERACT_PROC *proc, 1239 void *defaults )); 1240 1241LDAP_F( int ) 1242ldap_sasl_bind_s LDAP_P(( 1243 LDAP *ld, 1244 LDAP_CONST char *dn, 1245 LDAP_CONST char *mechanism, 1246 struct berval *cred, 1247 LDAPControl **serverctrls, 1248 LDAPControl **clientctrls, 1249 struct berval **servercredp )); 1250 1251LDAP_F( int ) 1252ldap_parse_sasl_bind_result LDAP_P(( 1253 LDAP *ld, 1254 LDAPMessage *res, 1255 struct berval **servercredp, 1256 int freeit )); 1257 1258#if LDAP_DEPRECATED 1259/* 1260 * in bind.c: 1261 * (deprecated) 1262 */ 1263LDAP_F( int ) 1264ldap_bind LDAP_P(( /* deprecated, use ldap_sasl_bind */ 1265 LDAP *ld, 1266 LDAP_CONST char *who, 1267 LDAP_CONST char *passwd, 1268 int authmethod )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_sasl_bind"); 1269 1270LDAP_F( int ) 1271ldap_bind_s LDAP_P(( /* deprecated, use ldap_sasl_bind_s */ 1272 LDAP *ld, 1273 LDAP_CONST char *who, 1274 LDAP_CONST char *cred, 1275 int authmethod )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_sasl_bind_s"); 1276 1277/* 1278 * in sbind.c: 1279 */ 1280LDAP_F( int ) 1281ldap_simple_bind LDAP_P(( /* deprecated, use ldap_sasl_bind */ 1282 LDAP *ld, 1283 LDAP_CONST char *who, 1284 LDAP_CONST char *passwd )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_sasl_bind"); 1285 1286LDAP_F( int ) 1287ldap_simple_bind_s LDAP_P(( /* deprecated, use ldap_sasl_bind_s */ 1288 LDAP *ld, 1289 LDAP_CONST char *who, 1290 LDAP_CONST char *passwd )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_sasl_bind_s"); 1291 1292#endif 1293 1294 1295/* 1296 * in compare.c: 1297 */ 1298LDAP_F( int ) 1299ldap_compare_ext LDAP_P(( 1300 LDAP *ld, 1301 LDAP_CONST char *dn, 1302 LDAP_CONST char *attr, 1303 struct berval *bvalue, 1304 LDAPControl **serverctrls, 1305 LDAPControl **clientctrls, 1306 int *msgidp )); 1307 1308LDAP_F( int ) 1309ldap_compare_ext_s LDAP_P(( 1310 LDAP *ld, 1311 LDAP_CONST char *dn, 1312 LDAP_CONST char *attr, 1313 struct berval *bvalue, 1314 LDAPControl **serverctrls, 1315 LDAPControl **clientctrls )); 1316 1317#if LDAP_DEPRECATED 1318LDAP_F( int ) 1319ldap_compare LDAP_P(( /* deprecated, use ldap_compare_ext */ 1320 LDAP *ld, 1321 LDAP_CONST char *dn, 1322 LDAP_CONST char *attr, 1323 LDAP_CONST char *value )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_compare_ext"); 1324 1325LDAP_F( int ) 1326ldap_compare_s LDAP_P(( /* deprecated, use ldap_compare_ext_s */ 1327 LDAP *ld, 1328 LDAP_CONST char *dn, 1329 LDAP_CONST char *attr, 1330 LDAP_CONST char *value )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_compare_ext_s"); 1331#endif 1332 1333 1334/* 1335 * in delete.c: 1336 */ 1337LDAP_F( int ) 1338ldap_delete_ext LDAP_P(( 1339 LDAP *ld, 1340 LDAP_CONST char *dn, 1341 LDAPControl **serverctrls, 1342 LDAPControl **clientctrls, 1343 int *msgidp )); 1344 1345LDAP_F( int ) 1346ldap_delete_ext_s LDAP_P(( 1347 LDAP *ld, 1348 LDAP_CONST char *dn, 1349 LDAPControl **serverctrls, 1350 LDAPControl **clientctrls )); 1351 1352#if LDAP_DEPRECATED 1353LDAP_F( int ) 1354ldap_delete LDAP_P(( /* deprecated, use ldap_delete_ext */ 1355 LDAP *ld, 1356 LDAP_CONST char *dn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_delete_ext"); 1357 1358LDAP_F( int ) 1359ldap_delete_s LDAP_P(( /* deprecated, use ldap_delete_ext_s */ 1360 LDAP *ld, 1361 LDAP_CONST char *dn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_delete_ext_s"); 1362#endif 1363 1364 1365/* 1366 * in error.c: 1367 */ 1368LDAP_F( int ) 1369ldap_parse_result LDAP_P(( 1370 LDAP *ld, 1371 LDAPMessage *res, 1372 int *errcodep, 1373 char **matcheddnp, 1374 char **errmsgp, 1375 char ***referralsp, 1376 LDAPControl ***serverctrls, 1377 int freeit )); 1378 1379LDAP_F( char * ) 1380ldap_err2string LDAP_P(( 1381 int err )); 1382 1383#if LDAP_DEPRECATED 1384LDAP_F( int ) 1385ldap_result2error LDAP_P(( /* deprecated, use ldap_parse_result */ 1386 LDAP *ld, 1387 LDAPMessage *r, 1388 int freeit )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_parse_result"); 1389 1390LDAP_F( void ) 1391ldap_perror LDAP_P(( /* deprecated, use ldap_err2string */ 1392 LDAP *ld, 1393 LDAP_CONST char *s )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_err2string"); 1394#endif 1395 1396 1397/* 1398 * gssapi.c: 1399 */ 1400LDAP_F( int ) 1401ldap_gssapi_bind LDAP_P(( 1402 LDAP *ld, 1403 LDAP_CONST char *dn, 1404 LDAP_CONST char *creds )); 1405 1406LDAP_F( int ) 1407ldap_gssapi_bind_s LDAP_P(( 1408 LDAP *ld, 1409 LDAP_CONST char *dn, 1410 LDAP_CONST char *creds )); 1411 1412 1413/* 1414 * in modify.c: 1415 */ 1416LDAP_F( int ) 1417ldap_modify_ext LDAP_P(( 1418 LDAP *ld, 1419 LDAP_CONST char *dn, 1420 LDAPMod **mods, 1421 LDAPControl **serverctrls, 1422 LDAPControl **clientctrls, 1423 int *msgidp )); 1424 1425LDAP_F( int ) 1426ldap_modify_ext_s LDAP_P(( 1427 LDAP *ld, 1428 LDAP_CONST char *dn, 1429 LDAPMod **mods, 1430 LDAPControl **serverctrls, 1431 LDAPControl **clientctrls )); 1432 1433#if LDAP_DEPRECATED 1434LDAP_F( int ) 1435ldap_modify LDAP_P(( /* deprecated, use ldap_modify_ext */ 1436 LDAP *ld, 1437 LDAP_CONST char *dn, 1438 LDAPMod **mods )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_modify_ext"); 1439 1440LDAP_F( int ) 1441ldap_modify_s LDAP_P(( /* deprecated, use ldap_modify_ext_s */ 1442 LDAP *ld, 1443 LDAP_CONST char *dn, 1444 LDAPMod **mods )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_modify_ext_s"); 1445#endif 1446 1447 1448/* 1449 * in modrdn.c: 1450 */ 1451LDAP_F( int ) 1452ldap_rename LDAP_P(( 1453 LDAP *ld, 1454 LDAP_CONST char *dn, 1455 LDAP_CONST char *newrdn, 1456 LDAP_CONST char *newSuperior, 1457 int deleteoldrdn, 1458 LDAPControl **sctrls, 1459 LDAPControl **cctrls, 1460 int *msgidp )); 1461 1462LDAP_F( int ) 1463ldap_rename_s LDAP_P(( 1464 LDAP *ld, 1465 LDAP_CONST char *dn, 1466 LDAP_CONST char *newrdn, 1467 LDAP_CONST char *newSuperior, 1468 int deleteoldrdn, 1469 LDAPControl **sctrls, 1470 LDAPControl **cctrls )); 1471 1472#if LDAP_DEPRECATED 1473LDAP_F( int ) 1474ldap_rename2 LDAP_P(( /* deprecated, use ldap_rename */ 1475 LDAP *ld, 1476 LDAP_CONST char *dn, 1477 LDAP_CONST char *newrdn, 1478 LDAP_CONST char *newSuperior, 1479 int deleteoldrdn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_rename"); 1480 1481LDAP_F( int ) 1482ldap_rename2_s LDAP_P(( /* deprecated, use ldap_rename_s */ 1483 LDAP *ld, 1484 LDAP_CONST char *dn, 1485 LDAP_CONST char *newrdn, 1486 LDAP_CONST char *newSuperior, 1487 int deleteoldrdn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_rename_s"); 1488 1489LDAP_F( int ) 1490ldap_modrdn LDAP_P(( /* deprecated, use ldap_rename */ 1491 LDAP *ld, 1492 LDAP_CONST char *dn, 1493 LDAP_CONST char *newrdn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_rename"); 1494 1495LDAP_F( int ) 1496ldap_modrdn_s LDAP_P(( /* deprecated, use ldap_rename_s */ 1497 LDAP *ld, 1498 LDAP_CONST char *dn, 1499 LDAP_CONST char *newrdn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_rename_s"); 1500 1501LDAP_F( int ) 1502ldap_modrdn2 LDAP_P(( /* deprecated, use ldap_rename */ 1503 LDAP *ld, 1504 LDAP_CONST char *dn, 1505 LDAP_CONST char *newrdn, 1506 int deleteoldrdn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_rename"); 1507 1508LDAP_F( int ) 1509ldap_modrdn2_s LDAP_P(( /* deprecated, use ldap_rename_s */ 1510 LDAP *ld, 1511 LDAP_CONST char *dn, 1512 LDAP_CONST char *newrdn, 1513 int deleteoldrdn)) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_rename_s"); 1514#endif 1515 1516 1517/* 1518 * in open.c: 1519 */ 1520#if LDAP_DEPRECATED 1521LDAP_F( LDAP * ) 1522ldap_init LDAP_P(( /* deprecated, use ldap_create or ldap_initialize */ 1523 LDAP_CONST char *host, 1524 int port )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_initialize"); 1525 1526LDAP_F( LDAP * ) 1527ldap_open LDAP_P(( /* deprecated, use ldap_create or ldap_initialize */ 1528 LDAP_CONST char *host, 1529 int port )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_initialize"); 1530#endif 1531 1532LDAP_F( int ) 1533ldap_create LDAP_P(( 1534 LDAP **ldp )); 1535 1536LDAP_F( int ) 1537ldap_initialize LDAP_P(( 1538 LDAP **ldp, 1539 LDAP_CONST char *url )); 1540 1541LDAP_F( LDAP * ) 1542ldap_dup LDAP_P(( 1543 LDAP *old )); 1544 1545/* 1546 * in tls.c 1547 */ 1548 1549LDAP_F( int ) 1550ldap_tls_inplace LDAP_P(( 1551 LDAP *ld )); 1552 1553LDAP_F( int ) 1554ldap_start_tls LDAP_P(( 1555 LDAP *ld, 1556 LDAPControl **serverctrls, 1557 LDAPControl **clientctrls, 1558 int *msgidp )); 1559 1560LDAP_F( int ) 1561ldap_install_tls LDAP_P(( 1562 LDAP *ld )); 1563 1564LDAP_F( int ) 1565ldap_start_tls_s LDAP_P(( 1566 LDAP *ld, 1567 LDAPControl **serverctrls, 1568 LDAPControl **clientctrls )); 1569 1570/* 1571 * in messages.c: 1572 */ 1573LDAP_F( LDAPMessage * ) 1574ldap_first_message LDAP_P(( 1575 LDAP *ld, 1576 LDAPMessage *chain )); 1577 1578LDAP_F( LDAPMessage * ) 1579ldap_next_message LDAP_P(( 1580 LDAP *ld, 1581 LDAPMessage *msg )); 1582 1583LDAP_F( int ) 1584ldap_count_messages LDAP_P(( 1585 LDAP *ld, 1586 LDAPMessage *chain )); 1587 1588/* 1589 * in references.c: 1590 */ 1591LDAP_F( LDAPMessage * ) 1592ldap_first_reference LDAP_P(( 1593 LDAP *ld, 1594 LDAPMessage *chain )); 1595 1596LDAP_F( LDAPMessage * ) 1597ldap_next_reference LDAP_P(( 1598 LDAP *ld, 1599 LDAPMessage *ref )); 1600 1601LDAP_F( int ) 1602ldap_count_references LDAP_P(( 1603 LDAP *ld, 1604 LDAPMessage *chain )); 1605 1606LDAP_F( int ) 1607ldap_parse_reference LDAP_P(( 1608 LDAP *ld, 1609 LDAPMessage *ref, 1610 char ***referralsp, 1611 LDAPControl ***serverctrls, 1612 int freeit)); 1613 1614 1615/* 1616 * in getentry.c: 1617 */ 1618LDAP_F( LDAPMessage * ) 1619ldap_first_entry LDAP_P(( 1620 LDAP *ld, 1621 LDAPMessage *chain )); 1622 1623LDAP_F( LDAPMessage * ) 1624ldap_next_entry LDAP_P(( 1625 LDAP *ld, 1626 LDAPMessage *entry )); 1627 1628LDAP_F( int ) 1629ldap_count_entries LDAP_P(( 1630 LDAP *ld, 1631 LDAPMessage *chain )); 1632 1633LDAP_F( int ) 1634ldap_get_entry_controls LDAP_P(( 1635 LDAP *ld, 1636 LDAPMessage *entry, 1637 LDAPControl ***serverctrls)); 1638 1639 1640/* 1641 * in addentry.c 1642 */ 1643LDAP_F( LDAPMessage * ) 1644ldap_delete_result_entry LDAP_P(( 1645 LDAPMessage **list, 1646 LDAPMessage *e )); 1647 1648LDAP_F( void ) 1649ldap_add_result_entry LDAP_P(( 1650 LDAPMessage **list, 1651 LDAPMessage *e )); 1652 1653 1654/* 1655 * in getdn.c 1656 */ 1657LDAP_F( char * ) 1658ldap_get_dn LDAP_P(( 1659 LDAP *ld, 1660 LDAPMessage *entry )); 1661 1662typedef struct ldap_ava { 1663 struct berval la_attr; 1664 struct berval la_value; 1665 unsigned la_flags; 1666#define LDAP_AVA_NULL 0x0000U 1667#define LDAP_AVA_STRING 0x0001U 1668#define LDAP_AVA_BINARY 0x0002U 1669#define LDAP_AVA_NONPRINTABLE 0x0004U 1670#define LDAP_AVA_FREE_ATTR 0x0010U 1671#define LDAP_AVA_FREE_VALUE 0x0020U 1672 1673 void *la_private; 1674} LDAPAVA; 1675 1676typedef LDAPAVA** LDAPRDN; 1677typedef LDAPRDN* LDAPDN; 1678 1679/* DN formats */ 1680#define LDAP_DN_FORMAT_LDAP 0x0000U 1681#define LDAP_DN_FORMAT_LDAPV3 0x0010U 1682#define LDAP_DN_FORMAT_LDAPV2 0x0020U 1683#define LDAP_DN_FORMAT_DCE 0x0030U 1684#define LDAP_DN_FORMAT_UFN 0x0040U /* dn2str only */ 1685#define LDAP_DN_FORMAT_AD_CANONICAL 0x0050U /* dn2str only */ 1686#define LDAP_DN_FORMAT_LBER 0x00F0U /* for testing only */ 1687#define LDAP_DN_FORMAT_MASK 0x00F0U 1688 1689/* DN flags */ 1690#define LDAP_DN_PRETTY 0x0100U 1691#define LDAP_DN_SKIP 0x0200U 1692#define LDAP_DN_P_NOLEADTRAILSPACES 0x1000U 1693#define LDAP_DN_P_NOSPACEAFTERRDN 0x2000U 1694#define LDAP_DN_PEDANTIC 0xF000U 1695 1696LDAP_F( void ) ldap_rdnfree LDAP_P(( LDAPRDN rdn )); 1697LDAP_F( void ) ldap_dnfree LDAP_P(( LDAPDN dn )); 1698 1699LDAP_F( int ) 1700ldap_bv2dn LDAP_P(( 1701 struct berval *bv, 1702 LDAPDN *dn, 1703 unsigned flags )); 1704 1705LDAP_F( int ) 1706ldap_str2dn LDAP_P(( 1707 LDAP_CONST char *str, 1708 LDAPDN *dn, 1709 unsigned flags )); 1710 1711LDAP_F( int ) 1712ldap_dn2bv LDAP_P(( 1713 LDAPDN dn, 1714 struct berval *bv, 1715 unsigned flags )); 1716 1717LDAP_F( int ) 1718ldap_dn2str LDAP_P(( 1719 LDAPDN dn, 1720 char **str, 1721 unsigned flags )); 1722 1723LDAP_F( int ) 1724ldap_bv2rdn LDAP_P(( 1725 struct berval *bv, 1726 LDAPRDN *rdn, 1727 char **next, 1728 unsigned flags )); 1729 1730LDAP_F( int ) 1731ldap_str2rdn LDAP_P(( 1732 LDAP_CONST char *str, 1733 LDAPRDN *rdn, 1734 char **next, 1735 unsigned flags )); 1736 1737LDAP_F( int ) 1738ldap_rdn2bv LDAP_P(( 1739 LDAPRDN rdn, 1740 struct berval *bv, 1741 unsigned flags )); 1742 1743LDAP_F( int ) 1744ldap_rdn2str LDAP_P(( 1745 LDAPRDN rdn, 1746 char **str, 1747 unsigned flags )); 1748 1749LDAP_F( int ) 1750ldap_dn_normalize LDAP_P(( 1751 LDAP_CONST char *in, unsigned iflags, 1752 char **out, unsigned oflags )); 1753 1754LDAP_F( char * ) 1755ldap_dn2ufn LDAP_P(( /* deprecated, use ldap_str2dn/dn2str */ 1756 LDAP_CONST char *dn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_str2dn/dn2str"); 1757 1758LDAP_F( char ** ) 1759ldap_explode_dn LDAP_P(( /* deprecated, ldap_str2dn */ 1760 LDAP_CONST char *dn, 1761 int notypes )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_str2dn"); 1762 1763LDAP_F( char ** ) 1764ldap_explode_rdn LDAP_P(( /* deprecated, ldap_str2rdn */ 1765 LDAP_CONST char *rdn, 1766 int notypes )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_str2rdn"); 1767 1768typedef int LDAPDN_rewrite_func 1769 LDAP_P(( LDAPDN dn, unsigned flags, void *ctx )); 1770 1771LDAP_F( int ) 1772ldap_X509dn2bv LDAP_P(( void *x509_name, struct berval *dn, 1773 LDAPDN_rewrite_func *func, unsigned flags )); 1774 1775LDAP_F( char * ) 1776ldap_dn2dcedn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */ 1777 LDAP_CONST char *dn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_str2dn/dn2str"); 1778 1779LDAP_F( char * ) 1780ldap_dcedn2dn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */ 1781 LDAP_CONST char *dce )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_str2dn/dn2str"); 1782 1783LDAP_F( char * ) 1784ldap_dn2ad_canonical LDAP_P(( /* deprecated, ldap_str2dn/dn2str */ 1785 LDAP_CONST char *dn )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_str2dn/dn2str"); 1786 1787LDAP_F( int ) 1788ldap_get_dn_ber LDAP_P(( 1789 LDAP *ld, LDAPMessage *e, BerElement **berout, struct berval *dn )); 1790 1791LDAP_F( int ) 1792ldap_get_attribute_ber LDAP_P(( 1793 LDAP *ld, LDAPMessage *e, BerElement *ber, struct berval *attr, 1794 struct berval **vals )); 1795 1796/* 1797 * in getattr.c 1798 */ 1799LDAP_F( char * ) 1800ldap_first_attribute LDAP_P(( 1801 LDAP *ld, 1802 LDAPMessage *entry, 1803 BerElement **ber )); 1804 1805LDAP_F( char * ) 1806ldap_next_attribute LDAP_P(( 1807 LDAP *ld, 1808 LDAPMessage *entry, 1809 BerElement *ber )); 1810 1811 1812/* 1813 * in getvalues.c 1814 */ 1815LDAP_F( struct berval ** ) 1816ldap_get_values_len LDAP_P(( 1817 LDAP *ld, 1818 LDAPMessage *entry, 1819 LDAP_CONST char *target )); 1820 1821LDAP_F( int ) 1822ldap_count_values_len LDAP_P(( 1823 struct berval **vals )); 1824 1825LDAP_F( void ) 1826ldap_value_free_len LDAP_P(( 1827 struct berval **vals )); 1828 1829#if LDAP_DEPRECATED 1830LDAP_F( char ** ) 1831ldap_get_values LDAP_P(( /* deprecated, use ldap_get_values_len */ 1832 LDAP *ld, 1833 LDAPMessage *entry, 1834 LDAP_CONST char *target )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_get_values_len"); 1835 1836LDAP_F( int ) 1837ldap_count_values LDAP_P(( /* deprecated, use ldap_count_values_len */ 1838 char **vals )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_count_values_len"); 1839 1840LDAP_F( void ) 1841ldap_value_free LDAP_P(( /* deprecated, use ldap_value_free_len */ 1842 char **vals )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_value_free_len"); 1843#endif 1844 1845/* 1846 * in result.c: 1847 */ 1848LDAP_F( int ) 1849ldap_result LDAP_P(( 1850 LDAP *ld, 1851 int msgid, 1852 int all, 1853 struct timeval *timeout, 1854 LDAPMessage **result )); 1855 1856LDAP_F( int ) 1857ldap_msgtype LDAP_P(( 1858 LDAPMessage *lm )); 1859 1860LDAP_F( int ) 1861ldap_msgid LDAP_P(( 1862 LDAPMessage *lm )); 1863 1864LDAP_F( int ) 1865ldap_msgfree LDAP_P(( 1866 LDAPMessage *lm )); 1867 1868LDAP_F( int ) 1869ldap_msgdelete LDAP_P(( 1870 LDAP *ld, 1871 int msgid )); 1872 1873 1874/* 1875 * in search.c: 1876 */ 1877LDAP_F( int ) 1878ldap_bv2escaped_filter_value LDAP_P(( 1879 struct berval *in, 1880 struct berval *out )); 1881 1882LDAP_F( int ) 1883ldap_search_ext LDAP_P(( 1884 LDAP *ld, 1885 LDAP_CONST char *base, 1886 int scope, 1887 LDAP_CONST char *filter, 1888 char **attrs, 1889 int attrsonly, 1890 LDAPControl **serverctrls, 1891 LDAPControl **clientctrls, 1892 struct timeval *timeout, 1893 int sizelimit, 1894 int *msgidp )); 1895 1896LDAP_F( int ) 1897ldap_search_ext_s LDAP_P(( 1898 LDAP *ld, 1899 LDAP_CONST char *base, 1900 int scope, 1901 LDAP_CONST char *filter, 1902 char **attrs, 1903 int attrsonly, 1904 LDAPControl **serverctrls, 1905 LDAPControl **clientctrls, 1906 struct timeval *timeout, 1907 int sizelimit, 1908 LDAPMessage **res )); 1909 1910#if LDAP_DEPRECATED 1911LDAP_F( int ) 1912ldap_search LDAP_P(( /* deprecated, use ldap_search_ext */ 1913 LDAP *ld, 1914 LDAP_CONST char *base, 1915 int scope, 1916 LDAP_CONST char *filter, 1917 char **attrs, 1918 int attrsonly )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_search_ext"); 1919 1920LDAP_F( int ) 1921ldap_search_s LDAP_P(( /* deprecated, use ldap_search_ext_s */ 1922 LDAP *ld, 1923 LDAP_CONST char *base, 1924 int scope, 1925 LDAP_CONST char *filter, 1926 char **attrs, 1927 int attrsonly, 1928 LDAPMessage **res )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_search_ext_s"); 1929 1930LDAP_F( int ) 1931ldap_search_st LDAP_P(( /* deprecated, use ldap_search_ext_s */ 1932 LDAP *ld, 1933 LDAP_CONST char *base, 1934 int scope, 1935 LDAP_CONST char *filter, 1936 char **attrs, 1937 int attrsonly, 1938 struct timeval *timeout, 1939 LDAPMessage **res )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_search_ext_s"); 1940#endif 1941 1942/* 1943 * in unbind.c 1944 */ 1945LDAP_F( int ) 1946ldap_unbind_ext LDAP_P(( 1947 LDAP *ld, 1948 LDAPControl **serverctrls, 1949 LDAPControl **clientctrls)); 1950 1951LDAP_F( int ) 1952ldap_unbind_ext_s LDAP_P(( 1953 LDAP *ld, 1954 LDAPControl **serverctrls, 1955 LDAPControl **clientctrls)); 1956 1957LDAP_F( int ) 1958ldap_destroy LDAP_P(( 1959 LDAP *ld)); 1960 1961#if LDAP_DEPRECATED 1962LDAP_F( int ) 1963ldap_unbind LDAP_P(( /* deprecated, use ldap_unbind_ext */ 1964 LDAP *ld )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_unbind_ext"); 1965 1966LDAP_F( int ) 1967ldap_unbind_s LDAP_P(( /* deprecated, use ldap_unbind_ext_s */ 1968 LDAP *ld )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_unbind_ext_s"); 1969#endif 1970 1971/* 1972 * in filter.c 1973 */ 1974LDAP_F( int ) 1975ldap_put_vrFilter LDAP_P(( 1976 BerElement *ber, 1977 const char *vrf )); 1978 1979/* 1980 * in free.c 1981 */ 1982 1983LDAP_F( void * ) 1984ldap_memalloc LDAP_P(( 1985 ber_len_t s )); 1986 1987LDAP_F( void * ) 1988ldap_memrealloc LDAP_P(( 1989 void* p, 1990 ber_len_t s )); 1991 1992LDAP_F( void * ) 1993ldap_memcalloc LDAP_P(( 1994 ber_len_t n, 1995 ber_len_t s )); 1996 1997LDAP_F( void ) 1998ldap_memfree LDAP_P(( 1999 void* p )); 2000 2001LDAP_F( void ) 2002ldap_memvfree LDAP_P(( 2003 void** v )); 2004 2005LDAP_F( char * ) 2006ldap_strdup LDAP_P(( 2007 LDAP_CONST char * )); 2008 2009LDAP_F( void ) 2010ldap_mods_free LDAP_P(( 2011 LDAPMod **mods, 2012 int freemods )); 2013 2014 2015#if LDAP_DEPRECATED 2016/* 2017 * in sort.c (deprecated, use custom code instead) 2018 */ 2019typedef int (LDAP_SORT_AD_CMP_PROC) LDAP_P(( /* deprecated */ 2020 LDAP_CONST char *left, 2021 LDAP_CONST char *right )) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA); 2022 2023typedef int (LDAP_SORT_AV_CMP_PROC) LDAP_P(( /* deprecated */ 2024 LDAP_CONST void *left, 2025 LDAP_CONST void *right )) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA); 2026 2027LDAP_F( int ) /* deprecated */ 2028ldap_sort_entries LDAP_P(( LDAP *ld, 2029 LDAPMessage **chain, 2030 LDAP_CONST char *attr, 2031 LDAP_SORT_AD_CMP_PROC *cmp )) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA); 2032 2033LDAP_F( int ) /* deprecated */ 2034ldap_sort_values LDAP_P(( 2035 LDAP *ld, 2036 char **vals, 2037 LDAP_SORT_AV_CMP_PROC *cmp )) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA); 2038 2039LDAP_F( int ) /* deprecated */ 2040ldap_sort_strcasecmp LDAP_P(( 2041 LDAP_CONST void *a, 2042 LDAP_CONST void *b )) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA); 2043#endif 2044 2045/* 2046 * in url.c 2047 */ 2048LDAP_F( int ) 2049ldap_is_ldap_url LDAP_P(( 2050 LDAP_CONST char *url )); 2051 2052LDAP_F( int ) 2053ldap_is_ldaps_url LDAP_P(( 2054 LDAP_CONST char *url )); 2055 2056LDAP_F( int ) 2057ldap_is_ldapi_url LDAP_P(( 2058 LDAP_CONST char *url )); 2059 2060LDAP_F( int ) 2061ldap_url_parse LDAP_P(( 2062 LDAP_CONST char *url, 2063 LDAPURLDesc **ludpp )); 2064 2065LDAP_F( char * ) 2066ldap_url_desc2str LDAP_P(( 2067 LDAPURLDesc *ludp )); 2068 2069LDAP_F( void ) 2070ldap_free_urldesc LDAP_P(( 2071 LDAPURLDesc *ludp )); 2072 2073 2074/* 2075 * LDAP Cancel Extended Operation <draft-zeilenga-ldap-cancel-xx.txt> 2076 * in cancel.c 2077 */ 2078#define LDAP_API_FEATURE_CANCEL 1000 2079 2080LDAP_F( int ) 2081ldap_cancel LDAP_P(( LDAP *ld, 2082 int cancelid, 2083 LDAPControl **sctrls, 2084 LDAPControl **cctrls, 2085 int *msgidp )); 2086 2087LDAP_F( int ) 2088ldap_cancel_s LDAP_P(( LDAP *ld, 2089 int cancelid, 2090 LDAPControl **sctrl, 2091 LDAPControl **cctrl )); 2092 2093/* 2094 * LDAP Turn Extended Operation <draft-zeilenga-ldap-turn-xx.txt> 2095 * in turn.c 2096 */ 2097#define LDAP_API_FEATURE_TURN 1000 2098 2099LDAP_F( int ) 2100ldap_turn LDAP_P(( LDAP *ld, 2101 int mutual, 2102 LDAP_CONST char* identifier, 2103 LDAPControl **sctrls, 2104 LDAPControl **cctrls, 2105 int *msgidp )); 2106 2107LDAP_F( int ) 2108ldap_turn_s LDAP_P(( LDAP *ld, 2109 int mutual, 2110 LDAP_CONST char* identifier, 2111 LDAPControl **sctrl, 2112 LDAPControl **cctrl )); 2113 2114/* 2115 * LDAP Paged Results 2116 * in pagectrl.c 2117 */ 2118#define LDAP_API_FEATURE_PAGED_RESULTS 2000 2119 2120LDAP_F( int ) 2121ldap_create_page_control_value LDAP_P(( 2122 LDAP *ld, 2123 ber_int_t pagesize, 2124 struct berval *cookie, 2125 struct berval *value )); 2126 2127LDAP_F( int ) 2128ldap_create_page_control LDAP_P(( 2129 LDAP *ld, 2130 ber_int_t pagesize, 2131 struct berval *cookie, 2132 int iscritical, 2133 LDAPControl **ctrlp )); 2134 2135#if LDAP_DEPRECATED 2136LDAP_F( int ) 2137ldap_parse_page_control LDAP_P(( 2138 /* deprecated, use ldap_parse_pageresponse_control */ 2139 LDAP *ld, 2140 LDAPControl **ctrls, 2141 ber_int_t *count, 2142 struct berval **cookie )) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_10, __IPHONE_NA, __IPHONE_NA, "use ldap_parse_pageresponse_control"); 2143#endif 2144 2145LDAP_F( int ) 2146ldap_parse_pageresponse_control LDAP_P(( 2147 LDAP *ld, 2148 LDAPControl *ctrl, 2149 ber_int_t *count, 2150 struct berval *cookie )); 2151 2152/* 2153 * LDAP Server Side Sort 2154 * in sortctrl.c 2155 */ 2156#define LDAP_API_FEATURE_SERVER_SIDE_SORT 2000 2157 2158/* structure for a sort-key */ 2159typedef struct ldapsortkey { 2160 char *attributeType; 2161 char *orderingRule; 2162 int reverseOrder; 2163} LDAPSortKey; 2164 2165LDAP_F( int ) 2166ldap_create_sort_keylist LDAP_P(( 2167 LDAPSortKey ***sortKeyList, 2168 char *keyString )); 2169 2170LDAP_F( void ) 2171ldap_free_sort_keylist LDAP_P(( 2172 LDAPSortKey **sortkeylist )); 2173 2174LDAP_F( int ) 2175ldap_create_sort_control_value LDAP_P(( 2176 LDAP *ld, 2177 LDAPSortKey **keyList, 2178 struct berval *value )); 2179 2180LDAP_F( int ) 2181ldap_create_sort_control LDAP_P(( 2182 LDAP *ld, 2183 LDAPSortKey **keyList, 2184 int iscritical, 2185 LDAPControl **ctrlp )); 2186 2187LDAP_F( int ) 2188ldap_parse_sort_control LDAP_P(( 2189 LDAP *ld, 2190 LDAPControl **ctrlp, 2191 unsigned long *result, 2192 char **attribute )); 2193 2194LDAP_F( int ) 2195ldap_parse_sortresponse_control LDAP_P(( 2196 LDAP *ld, 2197 LDAPControl *ctrl, 2198 ber_int_t *result, 2199 char **attribute )); 2200 2201/* 2202 * LDAP Virtual List View 2203 * in vlvctrl.c 2204 */ 2205#define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 2000 2206 2207/* structure for virtual list */ 2208typedef struct ldapvlvinfo { 2209 ber_int_t ldvlv_version; 2210 ber_int_t ldvlv_before_count; 2211 ber_int_t ldvlv_after_count; 2212 ber_int_t ldvlv_offset; 2213 ber_int_t ldvlv_count; 2214 struct berval * ldvlv_attrvalue; 2215 struct berval * ldvlv_context; 2216 void * ldvlv_extradata; 2217} LDAPVLVInfo; 2218 2219LDAP_F( int ) 2220ldap_create_vlv_control_value LDAP_P(( 2221 LDAP *ld, 2222 LDAPVLVInfo *ldvlistp, 2223 struct berval *value)); 2224 2225LDAP_F( int ) 2226ldap_create_vlv_control LDAP_P(( 2227 LDAP *ld, 2228 LDAPVLVInfo *ldvlistp, 2229 LDAPControl **ctrlp )); 2230 2231LDAP_F( int ) 2232ldap_parse_vlv_control LDAP_P(( 2233 LDAP *ld, 2234 LDAPControl **ctrls, 2235 unsigned long *target_posp, 2236 unsigned long *list_countp, 2237 struct berval **contextp, 2238 int *errcodep )); 2239 2240LDAP_F( int ) 2241ldap_parse_vlvresponse_control LDAP_P(( 2242 LDAP *ld, 2243 LDAPControl *ctrls, 2244 ber_int_t *target_posp, 2245 ber_int_t *list_countp, 2246 struct berval **contextp, 2247 int *errcodep )); 2248 2249/* 2250 * LDAP Who Am I? 2251 * in whoami.c 2252 */ 2253#define LDAP_API_FEATURE_WHOAMI 1000 2254 2255LDAP_F( int ) 2256ldap_parse_whoami LDAP_P(( 2257 LDAP *ld, 2258 LDAPMessage *res, 2259 struct berval **authzid )); 2260 2261LDAP_F( int ) 2262ldap_whoami LDAP_P(( LDAP *ld, 2263 LDAPControl **sctrls, 2264 LDAPControl **cctrls, 2265 int *msgidp )); 2266 2267LDAP_F( int ) 2268ldap_whoami_s LDAP_P(( 2269 LDAP *ld, 2270 struct berval **authzid, 2271 LDAPControl **sctrls, 2272 LDAPControl **cctrls )); 2273 2274/* 2275 * LDAP Password Modify 2276 * in passwd.c 2277 */ 2278#define LDAP_API_FEATURE_PASSWD_MODIFY 1000 2279 2280LDAP_F( int ) 2281ldap_parse_passwd LDAP_P(( 2282 LDAP *ld, 2283 LDAPMessage *res, 2284 struct berval *newpasswd )); 2285 2286LDAP_F( int ) 2287ldap_passwd LDAP_P(( LDAP *ld, 2288 struct berval *user, 2289 struct berval *oldpw, 2290 struct berval *newpw, 2291 LDAPControl **sctrls, 2292 LDAPControl **cctrls, 2293 int *msgidp )); 2294 2295LDAP_F( int ) 2296ldap_passwd_s LDAP_P(( 2297 LDAP *ld, 2298 struct berval *user, 2299 struct berval *oldpw, 2300 struct berval *newpw, 2301 struct berval *newpasswd, 2302 LDAPControl **sctrls, 2303 LDAPControl **cctrls )); 2304 2305#ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST 2306/* 2307 * LDAP Password Policy controls 2308 * in ppolicy.c 2309 */ 2310#define LDAP_API_FEATURE_PASSWORD_POLICY 1000 2311 2312typedef enum passpolicyerror_enum { 2313 PP_passwordExpired = 0, 2314 PP_accountLocked = 1, 2315 PP_changeAfterReset = 2, 2316 PP_passwordModNotAllowed = 3, 2317 PP_mustSupplyOldPassword = 4, 2318 PP_insufficientPasswordQuality = 5, 2319 PP_passwordTooShort = 6, 2320 PP_passwordTooYoung = 7, 2321 PP_passwordInHistory = 8, 2322 PP_noError = 65535 2323} LDAPPasswordPolicyError; 2324 2325LDAP_F( int ) 2326ldap_create_passwordpolicy_control LDAP_P(( 2327 LDAP *ld, 2328 LDAPControl **ctrlp )); 2329 2330LDAP_F( int ) 2331ldap_parse_passwordpolicy_control LDAP_P(( 2332 LDAP *ld, 2333 LDAPControl *ctrl, 2334 ber_int_t *expirep, 2335 ber_int_t *gracep, 2336 LDAPPasswordPolicyError *errorp )); 2337 2338LDAP_F( const char * ) 2339ldap_passwordpolicy_err2txt LDAP_P(( LDAPPasswordPolicyError )); 2340#endif /* LDAP_CONTROL_PASSWORDPOLICYREQUEST */ 2341 2342/* 2343 * LDAP Dynamic Directory Services Refresh -- RFC 2589 2344 * in dds.c 2345 */ 2346#define LDAP_API_FEATURE_REFRESH 1000 2347 2348LDAP_F( int ) 2349ldap_parse_refresh LDAP_P(( 2350 LDAP *ld, 2351 LDAPMessage *res, 2352 ber_int_t *newttl )); 2353 2354LDAP_F( int ) 2355ldap_refresh LDAP_P(( LDAP *ld, 2356 struct berval *dn, 2357 ber_int_t ttl, 2358 LDAPControl **sctrls, 2359 LDAPControl **cctrls, 2360 int *msgidp )); 2361 2362LDAP_F( int ) 2363ldap_refresh_s LDAP_P(( 2364 LDAP *ld, 2365 struct berval *dn, 2366 ber_int_t ttl, 2367 ber_int_t *newttl, 2368 LDAPControl **sctrls, 2369 LDAPControl **cctrls )); 2370 2371/* 2372 * LDAP Transactions 2373 */ 2374#ifdef LDAP_X_TXN 2375LDAP_F( int ) 2376ldap_txn_start LDAP_P(( LDAP *ld, 2377 LDAPControl **sctrls, 2378 LDAPControl **cctrls, 2379 int *msgidp )); 2380 2381LDAP_F( int ) 2382ldap_txn_start_s LDAP_P(( LDAP *ld, 2383 LDAPControl **sctrl, 2384 LDAPControl **cctrl, 2385 struct berval **rettxnid )); 2386 2387LDAP_F( int ) 2388ldap_txn_end LDAP_P(( LDAP *ld, 2389 int commit, 2390 struct berval *txnid, 2391 LDAPControl **sctrls, 2392 LDAPControl **cctrls, 2393 int *msgidp )); 2394 2395LDAP_F( int ) 2396ldap_txn_end_s LDAP_P(( LDAP *ld, 2397 int commit, 2398 struct berval *txnid, 2399 LDAPControl **sctrl, 2400 LDAPControl **cctrl, 2401 int *retidp )); 2402#endif 2403 2404/* 2405 * in ldap_sync.c 2406 */ 2407 2408/* 2409 * initialize the persistent search structure 2410 */ 2411LDAP_F( ldap_sync_t * ) 2412ldap_sync_initialize LDAP_P(( 2413 ldap_sync_t *ls )); 2414 2415/* 2416 * destroy the persistent search structure 2417 */ 2418LDAP_F( void ) 2419ldap_sync_destroy LDAP_P(( 2420 ldap_sync_t *ls, 2421 int freeit )); 2422 2423/* 2424 * initialize a refreshOnly sync 2425 */ 2426LDAP_F( int ) 2427ldap_sync_init LDAP_P(( 2428 ldap_sync_t *ls, 2429 int mode )); 2430 2431/* 2432 * initialize a refreshOnly sync 2433 */ 2434LDAP_F( int ) 2435ldap_sync_init_refresh_only LDAP_P(( 2436 ldap_sync_t *ls )); 2437 2438/* 2439 * initialize a refreshAndPersist sync 2440 */ 2441LDAP_F( int ) 2442ldap_sync_init_refresh_and_persist LDAP_P(( 2443 ldap_sync_t *ls )); 2444 2445/* 2446 * poll for new responses 2447 */ 2448LDAP_F( int ) 2449ldap_sync_poll LDAP_P(( 2450 ldap_sync_t *ls )); 2451 2452#ifdef LDAP_CONTROL_X_SESSION_TRACKING 2453 2454/* 2455 * in stctrl.c 2456 */ 2457LDAP_F( int ) 2458ldap_create_session_tracking_value LDAP_P(( 2459 LDAP *ld, 2460 char *sessionSourceIp, 2461 char *sessionSourceName, 2462 char *formatOID, 2463 struct berval *sessionTrackingIdentifier, 2464 struct berval *value )); 2465 2466LDAP_F( int ) 2467ldap_create_session_tracking LDAP_P(( 2468 LDAP *ld, 2469 char *sessionSourceIp, 2470 char *sessionSourceName, 2471 char *formatOID, 2472 struct berval *sessionTrackingIdentifier, 2473 LDAPControl **ctrlp )); 2474 2475LDAP_F( int ) 2476ldap_parse_session_tracking_control LDAP_P(( 2477 LDAP *ld, 2478 LDAPControl *ctrl, 2479 struct berval *ip, 2480 struct berval *name, 2481 struct berval *oid, 2482 struct berval *id )); 2483 2484#endif /* LDAP_CONTROL_X_SESSION_TRACKING */ 2485 2486/* 2487 * in assertion.c 2488 */ 2489LDAP_F (int) 2490ldap_create_assertion_control_value LDAP_P(( 2491 LDAP *ld, 2492 char *assertion, 2493 struct berval *value )); 2494 2495LDAP_F( int ) 2496ldap_create_assertion_control LDAP_P(( 2497 LDAP *ld, 2498 char *filter, 2499 int iscritical, 2500 LDAPControl **ctrlp )); 2501 2502/* 2503 * in deref.c 2504 */ 2505 2506typedef struct LDAPDerefSpec { 2507 char *derefAttr; 2508 char **attributes; 2509} LDAPDerefSpec; 2510 2511typedef struct LDAPDerefVal { 2512 char *type; 2513 BerVarray vals; 2514 struct LDAPDerefVal *next; 2515} LDAPDerefVal; 2516 2517typedef struct LDAPDerefRes { 2518 char *derefAttr; 2519 struct berval derefVal; 2520 LDAPDerefVal *attrVals; 2521 struct LDAPDerefRes *next; 2522} LDAPDerefRes; 2523 2524LDAP_F( int ) 2525ldap_create_deref_control_value LDAP_P(( 2526 LDAP *ld, 2527 LDAPDerefSpec *ds, 2528 struct berval *value )); 2529 2530LDAP_F( int ) 2531ldap_create_deref_control LDAP_P(( 2532 LDAP *ld, 2533 LDAPDerefSpec *ds, 2534 int iscritical, 2535 LDAPControl **ctrlp )); 2536 2537LDAP_F( void ) 2538ldap_derefresponse_free LDAP_P(( 2539 LDAPDerefRes *dr )); 2540 2541LDAP_F( int ) 2542ldap_parse_derefresponse_control LDAP_P(( 2543 LDAP *ld, 2544 LDAPControl *ctrl, 2545 LDAPDerefRes **drp )); 2546 2547LDAP_F( int ) 2548ldap_parse_deref_control LDAP_P(( 2549 LDAP *ld, 2550 LDAPControl **ctrls, 2551 LDAPDerefRes **drp )); 2552 2553LDAP_END_DECL 2554#endif /* _LDAP_H */ 2555