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