Back to index

openldap  2.4.31
ldap.h
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  * 
00004  * Copyright 1998-2012 The OpenLDAP Foundation.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted only as authorized by the OpenLDAP
00009  * Public License.
00010  *
00011  * A copy of this license is available in file LICENSE in the
00012  * top-level directory of the distribution or, alternatively, at
00013  * <http://www.OpenLDAP.org/license.html>.
00014  */
00015 /* Portions Copyright (c) 1990 Regents of the University of Michigan.
00016  * All rights reserved.
00017  *
00018  * Redistribution and use in source and binary forms are permitted
00019  * provided that this notice is preserved and that due credit is given
00020  * to the University of Michigan at Ann Arbor. The name of the University
00021  * may not be used to endorse or promote products derived from this
00022  * software without specific prior written permission. This software
00023  * is provided ``as is'' without express or implied warranty.
00024  */
00025 
00026 #ifndef _LDAP_H
00027 #define _LDAP_H
00028 
00029 /* pull in lber */
00030 #include <lber.h>
00031 
00032 /* include version and API feature defines */
00033 #include <ldap_features.h>
00034 
00035 LDAP_BEGIN_DECL
00036 
00037 #define LDAP_VERSION1       1
00038 #define LDAP_VERSION2       2
00039 #define LDAP_VERSION3       3
00040 
00041 #define LDAP_VERSION_MIN    LDAP_VERSION2
00042 #define       LDAP_VERSION         LDAP_VERSION2
00043 #define LDAP_VERSION_MAX    LDAP_VERSION3
00044 
00045 /*
00046  * We use 3000+n here because it is above 1823 (for RFC 1823),
00047  * above 2000+rev of IETF LDAPEXT draft (now quite dated),
00048  * yet below allocations for new RFCs (just in case there is
00049  * someday an RFC produced).
00050  */
00051 #define LDAP_API_VERSION    3001
00052 #define LDAP_VENDOR_NAME    "OpenLDAP"
00053 
00054 /* OpenLDAP API Features */
00055 #define LDAP_API_FEATURE_X_OPENLDAP LDAP_VENDOR_VERSION
00056 
00057 #if defined( LDAP_API_FEATURE_X_OPENLDAP_REENTRANT ) || \
00058        ( defined( LDAP_THREAD_SAFE ) && \
00059               defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) )
00060        /* -lldap may or may not be thread safe */
00061        /* -lldap_r, if available, is always thread safe */
00062 #      define LDAP_API_FEATURE_THREAD_SAFE              1
00063 #      define  LDAP_API_FEATURE_SESSION_THREAD_SAFE     1
00064 #      define  LDAP_API_FEATURE_OPERATION_THREAD_SAFE   1
00065 #endif
00066 #if defined( LDAP_THREAD_SAFE ) && \
00067        defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE )
00068 /* #define LDAP_API_FEATURE_SESSION_SAFE  1      */
00069 /* #define LDAP_API_OPERATION_SESSION_SAFE       1      */
00070 #endif
00071 
00072 
00073 #define LDAP_PORT           389           /* ldap:///          default LDAP port */
00074 #define LDAPS_PORT          636           /* ldaps:///  default LDAP over TLS port */
00075 
00076 #define LDAP_ROOT_DSE                            ""
00077 #define LDAP_NO_ATTRS                            "1.1"
00078 #define LDAP_ALL_USER_ATTRIBUTES   "*"
00079 #define LDAP_ALL_OPERATIONAL_ATTRIBUTES   "+" /* RFC 3673 */
00080 
00081 /* RFC 4511:  maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) -- */
00082 #define LDAP_MAXINT (2147483647)
00083 
00084 /*
00085  * LDAP_OPTions
00086  *     0x0000 - 0x0fff reserved for api options
00087  *     0x1000 - 0x3fff reserved for api extended options
00088  *     0x4000 - 0x7fff reserved for private and experimental options
00089  */
00090 
00091 #define LDAP_OPT_API_INFO                 0x0000
00092 #define LDAP_OPT_DESC                            0x0001 /* historic */
00093 #define LDAP_OPT_DEREF                           0x0002
00094 #define LDAP_OPT_SIZELIMIT                0x0003
00095 #define LDAP_OPT_TIMELIMIT                0x0004
00096 /* 0x05 - 0x07 not defined */
00097 #define LDAP_OPT_REFERRALS                0x0008
00098 #define LDAP_OPT_RESTART                  0x0009
00099 /* 0x0a - 0x10 not defined */
00100 #define LDAP_OPT_PROTOCOL_VERSION         0x0011
00101 #define LDAP_OPT_SERVER_CONTROLS          0x0012
00102 #define LDAP_OPT_CLIENT_CONTROLS          0x0013
00103 /* 0x14 not defined */
00104 #define LDAP_OPT_API_FEATURE_INFO         0x0015
00105 /* 0x16 - 0x2f not defined */
00106 #define LDAP_OPT_HOST_NAME                0x0030
00107 #define LDAP_OPT_RESULT_CODE                     0x0031
00108 #define LDAP_OPT_ERROR_NUMBER                    LDAP_OPT_RESULT_CODE
00109 #define LDAP_OPT_DIAGNOSTIC_MESSAGE              0x0032
00110 #define LDAP_OPT_ERROR_STRING                    LDAP_OPT_DIAGNOSTIC_MESSAGE
00111 #define LDAP_OPT_MATCHED_DN               0x0033
00112 /* 0x0034 - 0x3fff not defined */
00113 /* 0x0091 used by Microsoft for LDAP_OPT_AUTO_RECONNECT */
00114 #define LDAP_OPT_SSPI_FLAGS               0x0092
00115 /* 0x0093 used by Microsoft for LDAP_OPT_SSL_INFO */
00116 /* 0x0094 used by Microsoft for LDAP_OPT_REF_DEREF_CONN_PER_MSG */
00117 #define LDAP_OPT_SIGN                            0x0095
00118 #define LDAP_OPT_ENCRYPT                  0x0096
00119 #define LDAP_OPT_SASL_METHOD                     0x0097
00120 /* 0x0098 used by Microsoft for LDAP_OPT_AREC_EXCLUSIVE */
00121 #define LDAP_OPT_SECURITY_CONTEXT         0x0099
00122 /* 0x009A used by Microsoft for LDAP_OPT_ROOTDSE_CACHE */
00123 /* 0x009B - 0x3fff not defined */
00124 
00125 /* API Extensions */
00126 #define LDAP_OPT_API_EXTENSION_BASE 0x4000  /* API extensions */
00127 
00128 /* private and experimental options */
00129 /* OpenLDAP specific options */
00130 #define LDAP_OPT_DEBUG_LEVEL              0x5001 /* debug level */
00131 #define LDAP_OPT_TIMEOUT                  0x5002 /* default timeout */
00132 #define LDAP_OPT_REFHOPLIMIT              0x5003 /* ref hop limit */
00133 #define LDAP_OPT_NETWORK_TIMEOUT   0x5005 /* socket level timeout */
00134 #define LDAP_OPT_URI                      0x5006
00135 #define LDAP_OPT_REFERRAL_URLS      0x5007  /* Referral URLs */
00136 #define LDAP_OPT_SOCKBUF            0x5008  /* sockbuf */
00137 #define LDAP_OPT_DEFBASE           0x5009 /* searchbase */
00138 #define       LDAP_OPT_CONNECT_ASYNC             0x5010 /* create connections asynchronously */
00139 #define       LDAP_OPT_CONNECT_CB                0x5011 /* connection callbacks */
00140 #define       LDAP_OPT_SESSION_REFCNT            0x5012 /* session reference count */
00141 
00142 /* OpenLDAP TLS options */
00143 #define LDAP_OPT_X_TLS                           0x6000
00144 #define LDAP_OPT_X_TLS_CTX                0x6001 /* OpenSSL CTX* */
00145 #define LDAP_OPT_X_TLS_CACERTFILE  0x6002
00146 #define LDAP_OPT_X_TLS_CACERTDIR   0x6003
00147 #define LDAP_OPT_X_TLS_CERTFILE           0x6004
00148 #define LDAP_OPT_X_TLS_KEYFILE            0x6005
00149 #define LDAP_OPT_X_TLS_REQUIRE_CERT       0x6006
00150 #define LDAP_OPT_X_TLS_PROTOCOL_MIN       0x6007
00151 #define LDAP_OPT_X_TLS_CIPHER_SUITE       0x6008
00152 #define LDAP_OPT_X_TLS_RANDOM_FILE 0x6009
00153 #define LDAP_OPT_X_TLS_SSL_CTX            0x600a /* OpenSSL SSL* */
00154 #define LDAP_OPT_X_TLS_CRLCHECK           0x600b
00155 #define LDAP_OPT_X_TLS_CONNECT_CB  0x600c
00156 #define LDAP_OPT_X_TLS_CONNECT_ARG 0x600d
00157 #define LDAP_OPT_X_TLS_DHFILE             0x600e
00158 #define LDAP_OPT_X_TLS_NEWCTX             0x600f
00159 #define LDAP_OPT_X_TLS_CRLFILE            0x6010 /* GNUtls only */
00160 #define LDAP_OPT_X_TLS_PACKAGE            0x6011
00161 
00162 #define LDAP_OPT_X_TLS_NEVER       0
00163 #define LDAP_OPT_X_TLS_HARD        1
00164 #define LDAP_OPT_X_TLS_DEMAND      2
00165 #define LDAP_OPT_X_TLS_ALLOW       3
00166 #define LDAP_OPT_X_TLS_TRY         4
00167 
00168 #define LDAP_OPT_X_TLS_CRL_NONE    0
00169 #define LDAP_OPT_X_TLS_CRL_PEER    1
00170 #define LDAP_OPT_X_TLS_CRL_ALL     2
00171 
00172 /* for LDAP_OPT_X_TLS_PROTOCOL_MIN */
00173 #define LDAP_OPT_X_TLS_PROTOCOL(maj,min)  (((maj) << 8) + (min))
00174 #define LDAP_OPT_X_TLS_PROTOCOL_SSL2             (2 << 8)
00175 #define LDAP_OPT_X_TLS_PROTOCOL_SSL3             (3 << 8)
00176 #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_0           ((3 << 8) + 1)
00177 #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_1           ((3 << 8) + 2)
00178 #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_2           ((3 << 8) + 3)
00179 
00180 /* OpenLDAP SASL options */
00181 #define LDAP_OPT_X_SASL_MECH                     0x6100
00182 #define LDAP_OPT_X_SASL_REALM                    0x6101
00183 #define LDAP_OPT_X_SASL_AUTHCID                  0x6102
00184 #define LDAP_OPT_X_SASL_AUTHZID                  0x6103
00185 #define LDAP_OPT_X_SASL_SSF                      0x6104 /* read-only */
00186 #define LDAP_OPT_X_SASL_SSF_EXTERNAL      0x6105 /* write-only */
00187 #define LDAP_OPT_X_SASL_SECPROPS          0x6106 /* write-only */
00188 #define LDAP_OPT_X_SASL_SSF_MIN                  0x6107
00189 #define LDAP_OPT_X_SASL_SSF_MAX                  0x6108
00190 #define LDAP_OPT_X_SASL_MAXBUFSIZE        0x6109
00191 #define LDAP_OPT_X_SASL_MECHLIST          0x610a /* read-only */
00192 #define LDAP_OPT_X_SASL_NOCANON                  0x610b
00193 #define LDAP_OPT_X_SASL_USERNAME          0x610c /* read-only */
00194 #define LDAP_OPT_X_SASL_GSS_CREDS         0x610d
00195 
00196 /* OpenLDAP GSSAPI options */
00197 #define LDAP_OPT_X_GSSAPI_DO_NOT_FREE_CONTEXT      0x6200
00198 #define LDAP_OPT_X_GSSAPI_ALLOW_REMOTE_PRINCIPAL   0x6201
00199 
00200 /*
00201  * OpenLDAP per connection tcp-keepalive settings
00202  * (Linux only, ignored where unsupported)
00203  */
00204 #define LDAP_OPT_X_KEEPALIVE_IDLE         0x6300
00205 #define LDAP_OPT_X_KEEPALIVE_PROBES              0x6301
00206 #define LDAP_OPT_X_KEEPALIVE_INTERVAL     0x6302
00207 
00208 /* Private API Extensions -- reserved for application use */
00209 #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x7000  /* Private API inclusive */
00210 
00211 /*
00212  * ldap_get_option() and ldap_set_option() return values.
00213  * As later versions may return other values indicating
00214  * failure, current applications should only compare returned
00215  * value against LDAP_OPT_SUCCESS.
00216  */
00217 #define LDAP_OPT_SUCCESS    0
00218 #define       LDAP_OPT_ERROR              (-1)
00219 
00220 /* option on/off values */
00221 #define LDAP_OPT_ON         ((void *) &ber_pvt_opt_on)
00222 #define LDAP_OPT_OFF ((void *) 0)
00223 
00224 typedef struct ldapapiinfo {
00225        int           ldapai_info_version;        /* version of LDAPAPIInfo */
00226 #define LDAP_API_INFO_VERSION      (1)
00227        int           ldapai_api_version;                /* revision of API supported */
00228        int           ldapai_protocol_version;    /* highest LDAP version supported */
00229        char   **ldapai_extensions;        /* names of API extensions */
00230        char   *ldapai_vendor_name;        /* name of supplier */
00231        int           ldapai_vendor_version;             /* supplier-specific version * 100 */
00232 } LDAPAPIInfo;
00233 
00234 typedef struct ldap_apifeature_info {
00235        int           ldapaif_info_version;              /* version of LDAPAPIFeatureInfo */
00236 #define LDAP_FEATURE_INFO_VERSION (1)     /* apifeature_info struct version */
00237        char*  ldapaif_name;                      /* LDAP_API_FEATURE_* (less prefix) */
00238        int           ldapaif_version;                   /* value of LDAP_API_FEATURE_... */
00239 } LDAPAPIFeatureInfo;
00240 
00241 /*
00242  * LDAP Control structure
00243  */
00244 typedef struct ldapcontrol {
00245        char *               ldctl_oid;                  /* numericoid of control */
00246        struct berval ldctl_value;         /* encoded value of control */
00247        char                 ldctl_iscritical;    /* criticality */
00248 } LDAPControl;
00249 
00250 /* LDAP Controls */
00251 /*     standard track controls */
00252 #define LDAP_CONTROL_MANAGEDSAIT   "2.16.840.1.113730.3.4.2"  /* RFC 3296 */
00253 #define LDAP_CONTROL_PROXY_AUTHZ   "2.16.840.1.113730.3.4.18" /* RFC 4370 */
00254 #define LDAP_CONTROL_SUBENTRIES           "1.3.6.1.4.1.4203.1.10.1"  /* RFC 3672 */
00255 
00256 #define LDAP_CONTROL_VALUESRETURNFILTER "1.2.826.0.1.3344810.2.3"/* RFC 3876 */
00257 
00258 #define LDAP_CONTROL_ASSERT                      "1.3.6.1.1.12"                     /* RFC 4528 */
00259 #define LDAP_CONTROL_PRE_READ                    "1.3.6.1.1.13.1"            /* RFC 4527 */
00260 #define LDAP_CONTROL_POST_READ                   "1.3.6.1.1.13.2"            /* RFC 4527 */
00261 
00262 #define LDAP_CONTROL_SORTREQUEST    "1.2.840.113556.1.4.473" /* RFC 2891 */
00263 #define LDAP_CONTROL_SORTRESPONSE  "1.2.840.113556.1.4.474" /* RFC 2891 */
00264 
00265 /*     non-standard track controls */
00266 #define LDAP_CONTROL_PAGEDRESULTS  "1.2.840.113556.1.4.319"   /* RFC 2696 */
00267 
00268 /* LDAP Content Synchronization Operation -- RFC 4533 */
00269 #define LDAP_SYNC_OID                     "1.3.6.1.4.1.4203.1.9.1"
00270 #define LDAP_CONTROL_SYNC          LDAP_SYNC_OID ".1"
00271 #define LDAP_CONTROL_SYNC_STATE    LDAP_SYNC_OID ".2"
00272 #define LDAP_CONTROL_SYNC_DONE     LDAP_SYNC_OID ".3"
00273 #define LDAP_SYNC_INFO                    LDAP_SYNC_OID ".4"
00274 
00275 #define LDAP_SYNC_NONE                                  0x00
00276 #define LDAP_SYNC_REFRESH_ONLY                   0x01
00277 #define LDAP_SYNC_RESERVED                       0x02
00278 #define LDAP_SYNC_REFRESH_AND_PERSIST     0x03
00279 
00280 #define LDAP_SYNC_REFRESH_PRESENTS        0
00281 #define LDAP_SYNC_REFRESH_DELETES         1
00282 
00283 #define LDAP_TAG_SYNC_NEW_COOKIE          ((ber_tag_t) 0x80U)
00284 #define LDAP_TAG_SYNC_REFRESH_DELETE      ((ber_tag_t) 0xa1U)
00285 #define LDAP_TAG_SYNC_REFRESH_PRESENT     ((ber_tag_t) 0xa2U)
00286 #define       LDAP_TAG_SYNC_ID_SET               ((ber_tag_t) 0xa3U)
00287 
00288 #define LDAP_TAG_SYNC_COOKIE                     ((ber_tag_t) 0x04U)
00289 #define LDAP_TAG_REFRESHDELETES                  ((ber_tag_t) 0x01U)
00290 #define LDAP_TAG_REFRESHDONE                     ((ber_tag_t) 0x01U)
00291 #define LDAP_TAG_RELOAD_HINT                     ((ber_tag_t) 0x01U)
00292 
00293 #define LDAP_SYNC_PRESENT                        0
00294 #define LDAP_SYNC_ADD                                   1
00295 #define LDAP_SYNC_MODIFY                         2
00296 #define LDAP_SYNC_DELETE                         3
00297 #define LDAP_SYNC_NEW_COOKIE                     4
00298 
00299 
00300 /* Password policy Controls *//* work in progress */
00301 /* ITS#3458: released; disabled by default */
00302 #define LDAP_CONTROL_PASSWORDPOLICYREQUEST       "1.3.6.1.4.1.42.2.27.8.5.1"
00303 #define LDAP_CONTROL_PASSWORDPOLICYRESPONSE      "1.3.6.1.4.1.42.2.27.8.5.1"
00304 
00305 /* various works in progress */
00306 #define LDAP_CONTROL_NOOP                        "1.3.6.1.4.1.4203.666.5.2"
00307 #define LDAP_CONTROL_NO_SUBORDINATES      "1.3.6.1.4.1.4203.666.5.11"
00308 #define LDAP_CONTROL_RELAX                       "1.3.6.1.4.1.4203.666.5.12"
00309 #define LDAP_CONTROL_MANAGEDIT                   LDAP_CONTROL_RELAX
00310 #define LDAP_CONTROL_SLURP                       "1.3.6.1.4.1.4203.666.5.13"
00311 #define LDAP_CONTROL_VALSORT                     "1.3.6.1.4.1.4203.666.5.14"
00312 #define LDAP_CONTROL_DONTUSECOPY          "1.3.6.1.4.1.4203.666.5.15"
00313 #define       LDAP_CONTROL_X_DEREF               "1.3.6.1.4.1.4203.666.5.16"
00314 #define       LDAP_CONTROL_X_WHATFAILED          "1.3.6.1.4.1.4203.666.5.17"
00315 
00316 /* LDAP Chaining Behavior Control *//* work in progress */
00317 /* <draft-sermersheim-ldap-chaining>;
00318  * see also LDAP_NO_REFERRALS_FOUND, LDAP_CANNOT_CHAIN */
00319 #define LDAP_CONTROL_X_CHAINING_BEHAVIOR  "1.3.6.1.4.1.4203.666.11.3"
00320 
00321 #define       LDAP_CHAINING_PREFERRED                          0
00322 #define       LDAP_CHAINING_REQUIRED                           1
00323 #define LDAP_REFERRALS_PREFERRED                 2
00324 #define LDAP_REFERRALS_REQUIRED                         3
00325 
00326 /* MS Active Directory controls (for compatibility) */
00327 #define LDAP_CONTROL_X_INCREMENTAL_VALUES "1.2.840.113556.1.4.802"
00328 #define LDAP_CONTROL_X_DOMAIN_SCOPE                     "1.2.840.113556.1.4.1339"
00329 #define LDAP_CONTROL_X_PERMISSIVE_MODIFY  "1.2.840.113556.1.4.1413"
00330 #define LDAP_CONTROL_X_SEARCH_OPTIONS            "1.2.840.113556.1.4.1340"
00331 #define LDAP_SEARCH_FLAG_DOMAIN_SCOPE 1 /* do not generate referrals */
00332 #define LDAP_SEARCH_FLAG_PHANTOM_ROOT 2 /* search all subordinate NCs */
00333 #define LDAP_CONTROL_X_TREE_DELETE        "1.2.840.113556.1.4.805"
00334 
00335 /* MS Active Directory controls - not implemented in slapd(8) */
00336 #define LDAP_CONTROL_X_EXTENDED_DN        "1.2.840.113556.1.4.529"
00337 
00338 /* <draft-wahl-ldap-session> */
00339 #define LDAP_CONTROL_X_SESSION_TRACKING          "1.3.6.1.4.1.21008.108.63.1"
00340 #define LDAP_CONTROL_X_SESSION_TRACKING_RADIUS_ACCT_SESSION_ID \
00341                                           LDAP_CONTROL_X_SESSION_TRACKING ".1"
00342 #define LDAP_CONTROL_X_SESSION_TRACKING_RADIUS_ACCT_MULTI_SESSION_ID \
00343                                           LDAP_CONTROL_X_SESSION_TRACKING ".2"
00344 #define LDAP_CONTROL_X_SESSION_TRACKING_USERNAME \
00345                                           LDAP_CONTROL_X_SESSION_TRACKING ".3"
00346 /* various expired works */
00347 
00348 /* LDAP Duplicated Entry Control Extension *//* not implemented in slapd(8) */
00349 #define LDAP_CONTROL_DUPENT_REQUEST              "2.16.840.1.113719.1.27.101.1"
00350 #define LDAP_CONTROL_DUPENT_RESPONSE      "2.16.840.1.113719.1.27.101.2"
00351 #define LDAP_CONTROL_DUPENT_ENTRY         "2.16.840.1.113719.1.27.101.3"
00352 #define LDAP_CONTROL_DUPENT LDAP_CONTROL_DUPENT_REQUEST
00353 
00354 /* LDAP Persistent Search Control *//* not implemented in slapd(8) */
00355 #define LDAP_CONTROL_PERSIST_REQUEST                           "2.16.840.1.113730.3.4.3"
00356 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_NOTICE "2.16.840.1.113730.3.4.7"
00357 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_ADD           0x1
00358 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_DELETE 0x2
00359 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_MODIFY 0x4
00360 #define LDAP_CONTROL_PERSIST_ENTRY_CHANGE_RENAME 0x8
00361 
00362 /* LDAP VLV */
00363 #define LDAP_CONTROL_VLVREQUEST           "2.16.840.1.113730.3.4.9"
00364 #define LDAP_CONTROL_VLVRESPONSE    "2.16.840.1.113730.3.4.10"
00365 
00366 /* LDAP Unsolicited Notifications */
00367 #define       LDAP_NOTICE_OF_DISCONNECTION       "1.3.6.1.4.1.1466.20036" /* RFC 4511 */
00368 #define LDAP_NOTICE_DISCONNECT LDAP_NOTICE_OF_DISCONNECTION
00369 
00370 /* LDAP Extended Operations */
00371 #define LDAP_EXOP_START_TLS        "1.3.6.1.4.1.1466.20037"    /* RFC 4511 */
00372 
00373 #define LDAP_EXOP_MODIFY_PASSWD    "1.3.6.1.4.1.4203.1.11.1"   /* RFC 3062 */
00374 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID    ((ber_tag_t) 0x80U)
00375 #define LDAP_TAG_EXOP_MODIFY_PASSWD_OLD   ((ber_tag_t) 0x81U)
00376 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW   ((ber_tag_t) 0x82U)
00377 #define LDAP_TAG_EXOP_MODIFY_PASSWD_GEN   ((ber_tag_t) 0x80U)
00378 
00379 #define LDAP_EXOP_CANCEL           "1.3.6.1.1.8"                             /* RFC 3909 */
00380 #define LDAP_EXOP_X_CANCEL         LDAP_EXOP_CANCEL
00381 
00382 #define       LDAP_EXOP_REFRESH           "1.3.6.1.4.1.1466.101.119.1"       /* RFC 2589 */
00383 #define       LDAP_TAG_EXOP_REFRESH_REQ_DN       ((ber_tag_t) 0x80U)
00384 #define       LDAP_TAG_EXOP_REFRESH_REQ_TTL      ((ber_tag_t) 0x81U)
00385 #define       LDAP_TAG_EXOP_REFRESH_RES_TTL      ((ber_tag_t) 0x81U)
00386 
00387 #define LDAP_EXOP_WHO_AM_I         "1.3.6.1.4.1.4203.1.11.3"          /* RFC 4532 */
00388 #define LDAP_EXOP_X_WHO_AM_I       LDAP_EXOP_WHO_AM_I
00389 
00390 /* various works in progress */
00391 #define LDAP_EXOP_TURN             "1.3.6.1.1.19"                            /* RFC 4531 */
00392 #define LDAP_EXOP_X_TURN    LDAP_EXOP_TURN
00393 
00394 /* LDAP Distributed Procedures <draft-sermersheim-ldap-distproc> */
00395 /* a work in progress */
00396 #define LDAP_X_DISTPROC_BASE              "1.3.6.1.4.1.4203.666.11.6"
00397 #define LDAP_EXOP_X_CHAINEDREQUEST LDAP_X_DISTPROC_BASE ".1"
00398 #define LDAP_FEATURE_X_CANCHAINOPS LDAP_X_DISTPROC_BASE ".2"
00399 #define LDAP_CONTROL_X_RETURNCONTREF      LDAP_X_DISTPROC_BASE ".3"
00400 #define LDAP_URLEXT_X_LOCALREFOID  LDAP_X_DISTPROC_BASE ".4"
00401 #define LDAP_URLEXT_X_REFTYPEOID   LDAP_X_DISTPROC_BASE ".5"
00402 #define LDAP_URLEXT_X_SEARCHEDSUBTREEOID \
00403                                    LDAP_X_DISTPROC_BASE ".6"
00404 #define LDAP_URLEXT_X_FAILEDNAMEOID       LDAP_X_DISTPROC_BASE ".7"
00405 #define LDAP_URLEXT_X_LOCALREF            "x-localReference"
00406 #define LDAP_URLEXT_X_REFTYPE             "x-referenceType"
00407 #define LDAP_URLEXT_X_SEARCHEDSUBTREE     "x-searchedSubtree"
00408 #define LDAP_URLEXT_X_FAILEDNAME   "x-failedName"
00409 
00410 #ifdef LDAP_DEVEL
00411 #define LDAP_X_TXN                                      "1.3.6.1.4.1.4203.666.11.7" /* tmp */
00412 #define LDAP_EXOP_X_TXN_START                    LDAP_X_TXN ".1"
00413 #define LDAP_CONTROL_X_TXN_SPEC                  LDAP_X_TXN ".2"
00414 #define LDAP_EXOP_X_TXN_END                      LDAP_X_TXN ".3"
00415 #define LDAP_EXOP_X_TXN_ABORTED_NOTICE    LDAP_X_TXN ".4"
00416 #endif
00417 
00418 /* LDAP Features */
00419 #define LDAP_FEATURE_ALL_OP_ATTRS  "1.3.6.1.4.1.4203.1.5.1"    /* RFC 3673 */
00420 #define LDAP_FEATURE_OBJECTCLASS_ATTRS \
00421        "1.3.6.1.4.1.4203.1.5.2" /*  @objectClass - new number to be assigned */
00422 #define LDAP_FEATURE_ABSOLUTE_FILTERS "1.3.6.1.4.1.4203.1.5.3"  /* (&) (|) */
00423 #define LDAP_FEATURE_LANGUAGE_TAG_OPTIONS "1.3.6.1.4.1.4203.1.5.4"
00424 #define LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS "1.3.6.1.4.1.4203.1.5.5"
00425 #define LDAP_FEATURE_MODIFY_INCREMENT "1.3.6.1.1.14"
00426 
00427 /* LDAP Experimental (works in progress) Features */
00428 #define LDAP_FEATURE_SUBORDINATE_SCOPE \
00429        "1.3.6.1.4.1.4203.666.8.1" /* "children" */
00430 #define LDAP_FEATURE_CHILDREN_SCOPE LDAP_FEATURE_SUBORDINATE_SCOPE
00431 
00432 /*
00433  * specific LDAP instantiations of BER types we know about
00434  */
00435 
00436 /* Overview of LBER tag construction
00437  *
00438  *     Bits
00439  *     ______
00440  *     8 7 | CLASS
00441  *     0 0 = UNIVERSAL
00442  *     0 1 = APPLICATION
00443  *     1 0 = CONTEXT-SPECIFIC
00444  *     1 1 = PRIVATE
00445  *            _____
00446  *            | 6 | DATA-TYPE
00447  *              0 = PRIMITIVE
00448  *              1 = CONSTRUCTED
00449  *                   ___________
00450  *                   | 5 ... 1 | TAG-NUMBER
00451  */
00452 
00453 /* general stuff */
00454 #define LDAP_TAG_MESSAGE    ((ber_tag_t) 0x30U)  /* constructed + 16 */
00455 #define LDAP_TAG_MSGID             ((ber_tag_t) 0x02U)  /* integer */
00456 
00457 #define LDAP_TAG_LDAPDN            ((ber_tag_t) 0x04U)  /* octet string */
00458 #define LDAP_TAG_LDAPCRED   ((ber_tag_t) 0x04U)  /* octet string */
00459 
00460 #define LDAP_TAG_CONTROLS   ((ber_tag_t) 0xa0U)  /* context specific + constructed + 0 */
00461 #define LDAP_TAG_REFERRAL   ((ber_tag_t) 0xa3U)  /* context specific + constructed + 3 */
00462 
00463 #define LDAP_TAG_NEWSUPERIOR       ((ber_tag_t) 0x80U)  /* context-specific + primitive + 0 */
00464 
00465 #define LDAP_TAG_EXOP_REQ_OID   ((ber_tag_t) 0x80U)     /* context specific + primitive */
00466 #define LDAP_TAG_EXOP_REQ_VALUE ((ber_tag_t) 0x81U)     /* context specific + primitive */
00467 #define LDAP_TAG_EXOP_RES_OID   ((ber_tag_t) 0x8aU)     /* context specific + primitive */
00468 #define LDAP_TAG_EXOP_RES_VALUE ((ber_tag_t) 0x8bU)     /* context specific + primitive */
00469 
00470 #define LDAP_TAG_IM_RES_OID   ((ber_tag_t) 0x80U)       /* context specific + primitive */
00471 #define LDAP_TAG_IM_RES_VALUE ((ber_tag_t) 0x81U)       /* context specific + primitive */
00472 
00473 #define LDAP_TAG_SASL_RES_CREDS    ((ber_tag_t) 0x87U)  /* context specific + primitive */
00474 
00475 /* LDAP Request Messages */
00476 #define LDAP_REQ_BIND              ((ber_tag_t) 0x60U)  /* application + constructed */
00477 #define LDAP_REQ_UNBIND            ((ber_tag_t) 0x42U)  /* application + primitive   */
00478 #define LDAP_REQ_SEARCH            ((ber_tag_t) 0x63U)  /* application + constructed */
00479 #define LDAP_REQ_MODIFY            ((ber_tag_t) 0x66U)  /* application + constructed */
00480 #define LDAP_REQ_ADD        ((ber_tag_t) 0x68U)  /* application + constructed */
00481 #define LDAP_REQ_DELETE            ((ber_tag_t) 0x4aU)  /* application + primitive   */
00482 #define LDAP_REQ_MODDN             ((ber_tag_t) 0x6cU)  /* application + constructed */
00483 #define LDAP_REQ_MODRDN            LDAP_REQ_MODDN
00484 #define LDAP_REQ_RENAME            LDAP_REQ_MODDN
00485 #define LDAP_REQ_COMPARE    ((ber_tag_t) 0x6eU)  /* application + constructed */
00486 #define LDAP_REQ_ABANDON    ((ber_tag_t) 0x50U)  /* application + primitive   */
00487 #define LDAP_REQ_EXTENDED   ((ber_tag_t) 0x77U)  /* application + constructed */
00488 
00489 /* LDAP Response Messages */
00490 #define LDAP_RES_BIND              ((ber_tag_t) 0x61U)  /* application + constructed */
00491 #define LDAP_RES_SEARCH_ENTRY      ((ber_tag_t) 0x64U)  /* application + constructed */
00492 #define LDAP_RES_SEARCH_REFERENCE  ((ber_tag_t) 0x73U)  /* V3: application + constructed */
00493 #define LDAP_RES_SEARCH_RESULT     ((ber_tag_t) 0x65U)  /* application + constructed */
00494 #define LDAP_RES_MODIFY            ((ber_tag_t) 0x67U)  /* application + constructed */
00495 #define LDAP_RES_ADD        ((ber_tag_t) 0x69U)  /* application + constructed */
00496 #define LDAP_RES_DELETE            ((ber_tag_t) 0x6bU)  /* application + constructed */
00497 #define LDAP_RES_MODDN             ((ber_tag_t) 0x6dU)  /* application + constructed */
00498 #define LDAP_RES_MODRDN            LDAP_RES_MODDN       /* application + constructed */
00499 #define LDAP_RES_RENAME            LDAP_RES_MODDN       /* application + constructed */
00500 #define LDAP_RES_COMPARE    ((ber_tag_t) 0x6fU)  /* application + constructed */
00501 #define LDAP_RES_EXTENDED   ((ber_tag_t) 0x78U)  /* V3: application + constructed */
00502 #define LDAP_RES_INTERMEDIATE      ((ber_tag_t) 0x79U) /* V3+: application + constructed */
00503 
00504 #define LDAP_RES_ANY               (-1)
00505 #define LDAP_RES_UNSOLICITED       (0)
00506 
00507 
00508 /* sasl methods */
00509 #define LDAP_SASL_SIMPLE    ((char*)0)
00510 #define LDAP_SASL_NULL             ("")
00511 
00512 
00513 /* authentication methods available */
00514 #define LDAP_AUTH_NONE   ((ber_tag_t) 0x00U) /* no authentication */
00515 #define LDAP_AUTH_SIMPLE ((ber_tag_t) 0x80U) /* context specific + primitive */
00516 #define LDAP_AUTH_SASL   ((ber_tag_t) 0xa3U) /* context specific + constructed */
00517 #define LDAP_AUTH_KRBV4  ((ber_tag_t) 0xffU) /* means do both of the following */
00518 #define LDAP_AUTH_KRBV41 ((ber_tag_t) 0x81U) /* context specific + primitive */
00519 #define LDAP_AUTH_KRBV42 ((ber_tag_t) 0x82U) /* context specific + primitive */
00520 
00521 /* used by the Windows API but not used on the wire */
00522 #define LDAP_AUTH_NEGOTIATE ((ber_tag_t) 0x04FFU)
00523 
00524 /* filter types */
00525 #define LDAP_FILTER_AND     ((ber_tag_t) 0xa0U)  /* context specific + constructed */
00526 #define LDAP_FILTER_OR      ((ber_tag_t) 0xa1U)  /* context specific + constructed */
00527 #define LDAP_FILTER_NOT     ((ber_tag_t) 0xa2U)  /* context specific + constructed */
00528 #define LDAP_FILTER_EQUALITY ((ber_tag_t) 0xa3U) /* context specific + constructed */
00529 #define LDAP_FILTER_SUBSTRINGS ((ber_tag_t) 0xa4U) /* context specific + constructed */
00530 #define LDAP_FILTER_GE ((ber_tag_t) 0xa5U) /* context specific + constructed */
00531 #define LDAP_FILTER_LE ((ber_tag_t) 0xa6U) /* context specific + constructed */
00532 #define LDAP_FILTER_PRESENT ((ber_tag_t) 0x87U) /* context specific + primitive   */
00533 #define LDAP_FILTER_APPROX ((ber_tag_t) 0xa8U)   /* context specific + constructed */
00534 #define LDAP_FILTER_EXT     ((ber_tag_t) 0xa9U)  /* context specific + constructed */
00535 
00536 /* extended filter component types */
00537 #define LDAP_FILTER_EXT_OID        ((ber_tag_t) 0x81U)  /* context specific */
00538 #define LDAP_FILTER_EXT_TYPE       ((ber_tag_t) 0x82U)  /* context specific */
00539 #define LDAP_FILTER_EXT_VALUE      ((ber_tag_t) 0x83U)  /* context specific */
00540 #define LDAP_FILTER_EXT_DNATTRS    ((ber_tag_t) 0x84U)  /* context specific */
00541 
00542 /* substring filter component types */
00543 #define LDAP_SUBSTRING_INITIAL     ((ber_tag_t) 0x80U)  /* context specific */
00544 #define LDAP_SUBSTRING_ANY         ((ber_tag_t) 0x81U)  /* context specific */
00545 #define LDAP_SUBSTRING_FINAL       ((ber_tag_t) 0x82U)  /* context specific */
00546 
00547 /* search scopes */
00548 #define LDAP_SCOPE_BASE                   ((ber_int_t) 0x0000)
00549 #define LDAP_SCOPE_BASEOBJECT      LDAP_SCOPE_BASE
00550 #define LDAP_SCOPE_ONELEVEL        ((ber_int_t) 0x0001)
00551 #define LDAP_SCOPE_ONE                    LDAP_SCOPE_ONELEVEL
00552 #define LDAP_SCOPE_SUBTREE         ((ber_int_t) 0x0002)
00553 #define LDAP_SCOPE_SUB                    LDAP_SCOPE_SUBTREE
00554 #define LDAP_SCOPE_SUBORDINATE     ((ber_int_t) 0x0003) /* OpenLDAP extension */
00555 #define LDAP_SCOPE_CHILDREN        LDAP_SCOPE_SUBORDINATE
00556 #define LDAP_SCOPE_DEFAULT         ((ber_int_t) -1)      /* OpenLDAP extension */
00557 
00558 /* substring filter component types */
00559 #define LDAP_SUBSTRING_INITIAL     ((ber_tag_t) 0x80U)  /* context specific */
00560 #define LDAP_SUBSTRING_ANY         ((ber_tag_t) 0x81U)  /* context specific */
00561 #define LDAP_SUBSTRING_FINAL       ((ber_tag_t) 0x82U)  /* context specific */
00562 
00563 /*
00564  * LDAP Result Codes
00565  */
00566 #define LDAP_SUCCESS                      0x00
00567 
00568 #define LDAP_RANGE(n,x,y)   (((x) <= (n)) && ((n) <= (y)))
00569 
00570 #define LDAP_OPERATIONS_ERROR             0x01
00571 #define LDAP_PROTOCOL_ERROR               0x02
00572 #define LDAP_TIMELIMIT_EXCEEDED           0x03
00573 #define LDAP_SIZELIMIT_EXCEEDED           0x04
00574 #define LDAP_COMPARE_FALSE                0x05
00575 #define LDAP_COMPARE_TRUE                 0x06
00576 #define LDAP_AUTH_METHOD_NOT_SUPPORTED    0x07
00577 #define LDAP_STRONG_AUTH_NOT_SUPPORTED    LDAP_AUTH_METHOD_NOT_SUPPORTED
00578 #define LDAP_STRONG_AUTH_REQUIRED  0x08
00579 #define LDAP_STRONGER_AUTH_REQUIRED       LDAP_STRONG_AUTH_REQUIRED
00580 #define LDAP_PARTIAL_RESULTS              0x09   /* LDAPv2+ (not LDAPv3) */
00581 
00582 #define       LDAP_REFERRAL                      0x0a /* LDAPv3 */
00583 #define LDAP_ADMINLIMIT_EXCEEDED   0x0b /* LDAPv3 */
00584 #define       LDAP_UNAVAILABLE_CRITICAL_EXTENSION       0x0c /* LDAPv3 */
00585 #define LDAP_CONFIDENTIALITY_REQUIRED     0x0d /* LDAPv3 */
00586 #define       LDAP_SASL_BIND_IN_PROGRESS  0x0e /* LDAPv3 */
00587 
00588 #define LDAP_ATTR_ERROR(n)  LDAP_RANGE((n),0x10,0x15) /* 16-21 */
00589 
00590 #define LDAP_NO_SUCH_ATTRIBUTE            0x10
00591 #define LDAP_UNDEFINED_TYPE               0x11
00592 #define LDAP_INAPPROPRIATE_MATCHING       0x12
00593 #define LDAP_CONSTRAINT_VIOLATION  0x13
00594 #define LDAP_TYPE_OR_VALUE_EXISTS  0x14
00595 #define LDAP_INVALID_SYNTAX               0x15
00596 
00597 #define LDAP_NAME_ERROR(n)  LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
00598 
00599 #define LDAP_NO_SUCH_OBJECT               0x20
00600 #define LDAP_ALIAS_PROBLEM                0x21
00601 #define LDAP_INVALID_DN_SYNTAX            0x22
00602 #define LDAP_IS_LEAF                      0x23 /* not LDAPv3 */
00603 #define LDAP_ALIAS_DEREF_PROBLEM   0x24
00604 
00605 #define LDAP_SECURITY_ERROR(n)     LDAP_RANGE((n),0x2F,0x32) /* 47-50 */
00606 
00607 #define LDAP_X_PROXY_AUTHZ_FAILURE 0x2F /* LDAPv3 proxy authorization */
00608 #define LDAP_INAPPROPRIATE_AUTH           0x30
00609 #define LDAP_INVALID_CREDENTIALS   0x31
00610 #define LDAP_INSUFFICIENT_ACCESS   0x32
00611 
00612 #define LDAP_SERVICE_ERROR(n)      LDAP_RANGE((n),0x33,0x36) /* 51-54 */
00613 
00614 #define LDAP_BUSY                                0x33
00615 #define LDAP_UNAVAILABLE                  0x34
00616 #define LDAP_UNWILLING_TO_PERFORM  0x35
00617 #define LDAP_LOOP_DETECT                  0x36
00618 
00619 #define LDAP_UPDATE_ERROR(n)       LDAP_RANGE((n),0x40,0x47) /* 64-69,71 */
00620 
00621 #define LDAP_NAMING_VIOLATION             0x40
00622 #define LDAP_OBJECT_CLASS_VIOLATION       0x41
00623 #define LDAP_NOT_ALLOWED_ON_NONLEAF       0x42
00624 #define LDAP_NOT_ALLOWED_ON_RDN           0x43
00625 #define LDAP_ALREADY_EXISTS               0x44
00626 #define LDAP_NO_OBJECT_CLASS_MODS  0x45
00627 #define LDAP_RESULTS_TOO_LARGE            0x46 /* CLDAP */
00628 #define LDAP_AFFECTS_MULTIPLE_DSAS 0x47
00629 
00630 #define LDAP_VLV_ERROR                           0x4C
00631 
00632 #define LDAP_OTHER                               0x50
00633 
00634 /* LCUP operation codes (113-117) - not implemented */
00635 #define LDAP_CUP_RESOURCES_EXHAUSTED      0x71
00636 #define LDAP_CUP_SECURITY_VIOLATION              0x72
00637 #define LDAP_CUP_INVALID_DATA                    0x73
00638 #define LDAP_CUP_UNSUPPORTED_SCHEME              0x74
00639 #define LDAP_CUP_RELOAD_REQUIRED          0x75
00640 
00641 /* Cancel operation codes (118-121) */
00642 #define LDAP_CANCELLED                           0x76
00643 #define LDAP_NO_SUCH_OPERATION            0x77
00644 #define LDAP_TOO_LATE                            0x78
00645 #define LDAP_CANNOT_CANCEL                0x79
00646 
00647 /* Assertion control (122) */ 
00648 #define LDAP_ASSERTION_FAILED             0x7A
00649 
00650 /* Proxied Authorization Denied (123) */ 
00651 #define LDAP_PROXIED_AUTHORIZATION_DENIED        0x7B
00652 
00653 /* Experimental result codes */
00654 #define LDAP_E_ERROR(n)     LDAP_RANGE((n),0x1000,0x3FFF)
00655 
00656 /* LDAP Sync (4096) */
00657 #define LDAP_SYNC_REFRESH_REQUIRED        0x1000
00658 
00659 
00660 /* Private Use result codes */
00661 #define LDAP_X_ERROR(n)     LDAP_RANGE((n),0x4000,0xFFFF)
00662 
00663 #define LDAP_X_SYNC_REFRESH_REQUIRED      0x4100 /* defunct */
00664 #define LDAP_X_ASSERTION_FAILED                  0x410f /* defunct */
00665 
00666 /* for the LDAP No-Op control */
00667 #define LDAP_X_NO_OPERATION                      0x410e
00668 
00669 /* for the Chaining Behavior control (consecutive result codes requested;
00670  * see <draft-sermersheim-ldap-chaining> ) */
00671 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
00672 #define       LDAP_X_NO_REFERRALS_FOUND          0x4110
00673 #define LDAP_X_CANNOT_CHAIN               0x4111
00674 #endif
00675 
00676 /* for Distributed Procedures (see <draft-sermersheim-ldap-distproc>) */
00677 #ifdef LDAP_X_DISTPROC_BASE
00678 #define LDAP_X_INVALIDREFERENCE                  0x4112
00679 #endif
00680 
00681 #ifdef LDAP_X_TXN
00682 #define LDAP_X_TXN_SPECIFY_OKAY           0x4120
00683 #define LDAP_X_TXN_ID_INVALID             0x4121
00684 #endif
00685 
00686 /* API Error Codes
00687  *
00688  * Based on draft-ietf-ldap-c-api-xx
00689  * but with new negative code values
00690  */
00691 #define LDAP_API_ERROR(n)          ((n)<0)
00692 #define LDAP_API_RESULT(n)         ((n)<=0)
00693 
00694 #define LDAP_SERVER_DOWN                         (-1)
00695 #define LDAP_LOCAL_ERROR                         (-2)
00696 #define LDAP_ENCODING_ERROR                      (-3)
00697 #define LDAP_DECODING_ERROR                      (-4)
00698 #define LDAP_TIMEOUT                             (-5)
00699 #define LDAP_AUTH_UNKNOWN                        (-6)
00700 #define LDAP_FILTER_ERROR                        (-7)
00701 #define LDAP_USER_CANCELLED                      (-8)
00702 #define LDAP_PARAM_ERROR                         (-9)
00703 #define LDAP_NO_MEMORY                                  (-10)
00704 #define LDAP_CONNECT_ERROR                       (-11)
00705 #define LDAP_NOT_SUPPORTED                       (-12)
00706 #define LDAP_CONTROL_NOT_FOUND                   (-13)
00707 #define LDAP_NO_RESULTS_RETURNED          (-14)
00708 #define LDAP_MORE_RESULTS_TO_RETURN              (-15)  /* Obsolete */
00709 #define LDAP_CLIENT_LOOP                         (-16)
00710 #define LDAP_REFERRAL_LIMIT_EXCEEDED      (-17)
00711 #define       LDAP_X_CONNECTING                  (-18)
00712 
00713 
00714 /*
00715  * This structure represents both ldap messages and ldap responses.
00716  * These are really the same, except in the case of search responses,
00717  * where a response has multiple messages.
00718  */
00719 
00720 typedef struct ldapmsg LDAPMessage;
00721 
00722 /* for modifications */
00723 typedef struct ldapmod {
00724        int           mod_op;
00725 
00726 #define LDAP_MOD_OP                (0x0007)
00727 #define LDAP_MOD_ADD        (0x0000)
00728 #define LDAP_MOD_DELETE            (0x0001)
00729 #define LDAP_MOD_REPLACE    (0x0002)
00730 #define LDAP_MOD_INCREMENT  (0x0003) /* OpenLDAP extension */
00731 #define LDAP_MOD_BVALUES    (0x0080)
00732 /* IMPORTANT: do not use code 0x1000 (or above),
00733  * it is used internally by the backends!
00734  * (see ldap/servers/slapd/slap.h)
00735  */
00736 
00737        char          *mod_type;
00738        union mod_vals_u {
00739               char          **modv_strvals;
00740               struct berval **modv_bvals;
00741        } mod_vals;
00742 #define mod_values   mod_vals.modv_strvals
00743 #define mod_bvalues  mod_vals.modv_bvals
00744 } LDAPMod;
00745 
00746 /*
00747  * structure representing an ldap session which can
00748  * encompass connections to multiple servers (in the
00749  * face of referrals).
00750  */
00751 typedef struct ldap LDAP;
00752 
00753 #define LDAP_DEREF_NEVER           0x00
00754 #define LDAP_DEREF_SEARCHING       0x01
00755 #define LDAP_DEREF_FINDING         0x02
00756 #define LDAP_DEREF_ALWAYS          0x03
00757 
00758 #define LDAP_NO_LIMIT                     0
00759 
00760 /* how many messages to retrieve results for */
00761 #define LDAP_MSG_ONE               0x00
00762 #define LDAP_MSG_ALL               0x01
00763 #define LDAP_MSG_RECEIVED          0x02
00764 
00765 /*
00766  * types for ldap URL handling
00767  */
00768 typedef struct ldap_url_desc {
00769        struct ldap_url_desc *lud_next;
00770        char   *lud_scheme;
00771        char   *lud_host;
00772        int           lud_port;
00773        char   *lud_dn;
00774        char   **lud_attrs;
00775        int           lud_scope;
00776        char   *lud_filter;
00777        char   **lud_exts;
00778        int           lud_crit_exts;
00779 } LDAPURLDesc;
00780 
00781 #define LDAP_URL_SUCCESS           0x00   /* Success */
00782 #define LDAP_URL_ERR_MEM           0x01   /* can't allocate memory space */
00783 #define LDAP_URL_ERR_PARAM         0x02   /* parameter is bad */
00784 
00785 #define LDAP_URL_ERR_BADSCHEME     0x03   /* URL doesn't begin with "ldap[si]://" */
00786 #define LDAP_URL_ERR_BADENCLOSURE 0x04    /* URL is missing trailing ">" */
00787 #define LDAP_URL_ERR_BADURL        0x05   /* URL is bad */
00788 #define LDAP_URL_ERR_BADHOST       0x06   /* host port is bad */
00789 #define LDAP_URL_ERR_BADATTRS      0x07   /* bad (or missing) attributes */
00790 #define LDAP_URL_ERR_BADSCOPE      0x08   /* scope string is invalid (or missing) */
00791 #define LDAP_URL_ERR_BADFILTER     0x09   /* bad or missing filter */
00792 #define LDAP_URL_ERR_BADEXTS       0x0a   /* bad or missing extensions */
00793 
00794 /*
00795  * LDAP sync (RFC4533) API
00796  */
00797 
00798 typedef struct ldap_sync_t ldap_sync_t;
00799 
00800 typedef enum {
00801        /* these are private - the client should never see them */
00802        LDAP_SYNC_CAPI_NONE         = -1,
00803 
00804        LDAP_SYNC_CAPI_PHASE_FLAG   = 0x10U,
00805        LDAP_SYNC_CAPI_IDSET_FLAG   = 0x20U,
00806        LDAP_SYNC_CAPI_DONE_FLAG    = 0x40U,
00807 
00808        /* these are passed to ls_search_entry() */
00809        LDAP_SYNC_CAPI_PRESENT             = LDAP_SYNC_PRESENT,
00810        LDAP_SYNC_CAPI_ADD          = LDAP_SYNC_ADD,
00811        LDAP_SYNC_CAPI_MODIFY              = LDAP_SYNC_MODIFY,
00812        LDAP_SYNC_CAPI_DELETE              = LDAP_SYNC_DELETE,
00813 
00814        /* these are passed to ls_intermediate() */
00815        LDAP_SYNC_CAPI_PRESENTS            = ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_PRESENT ),
00816        LDAP_SYNC_CAPI_DELETES             = ( LDAP_SYNC_CAPI_PHASE_FLAG | LDAP_SYNC_CAPI_DELETE ),
00817 
00818        LDAP_SYNC_CAPI_PRESENTS_IDSET      = ( LDAP_SYNC_CAPI_PRESENTS | LDAP_SYNC_CAPI_IDSET_FLAG ),
00819        LDAP_SYNC_CAPI_DELETES_IDSET       = ( LDAP_SYNC_CAPI_DELETES | LDAP_SYNC_CAPI_IDSET_FLAG ),
00820 
00821        LDAP_SYNC_CAPI_DONE         = ( LDAP_SYNC_CAPI_DONE_FLAG | LDAP_SYNC_CAPI_PRESENTS )
00822 } ldap_sync_refresh_t;
00823 
00824 /*
00825  * Called when an entry is returned by ldap_result().
00826  * If phase is LDAP_SYNC_CAPI_ADD or LDAP_SYNC_CAPI_MODIFY,
00827  * the entry has been either added or modified, and thus
00828  * the complete view of the entry should be in the LDAPMessage.
00829  * If phase is LDAP_SYNC_CAPI_PRESENT or LDAP_SYNC_CAPI_DELETE,
00830  * only the DN should be in the LDAPMessage.
00831  */
00832 typedef int (*ldap_sync_search_entry_f) LDAP_P((
00833        ldap_sync_t                 *ls,
00834        LDAPMessage                 *msg,
00835        struct berval               *entryUUID,
00836        ldap_sync_refresh_t         phase ));
00837 
00838 /*
00839  * Called when a reference is returned; the client should know 
00840  * what to do with it.
00841  */
00842 typedef int (*ldap_sync_search_reference_f) LDAP_P((
00843        ldap_sync_t                 *ls,
00844        LDAPMessage                 *msg ));
00845 
00846 /*
00847  * Called when specific intermediate/final messages are returned.
00848  * If phase is LDAP_SYNC_CAPI_PRESENTS or LDAP_SYNC_CAPI_DELETES,
00849  * a "presents" or "deletes" phase begins.
00850  * If phase is LDAP_SYNC_CAPI_DONE, a special "presents" phase
00851  * with refreshDone set to "TRUE" has been returned, to indicate
00852  * that the refresh phase of a refreshAndPersist is complete.
00853  * In the above cases, syncUUIDs is NULL.
00854  *
00855  * If phase is LDAP_SYNC_CAPI_PRESENTS_IDSET or 
00856  * LDAP_SYNC_CAPI_DELETES_IDSET, syncUUIDs is an array of UUIDs
00857  * that are either present or have been deleted.
00858  */
00859 typedef int (*ldap_sync_intermediate_f) LDAP_P((
00860        ldap_sync_t                 *ls,
00861        LDAPMessage                 *msg,
00862        BerVarray                   syncUUIDs,
00863        ldap_sync_refresh_t         phase ));
00864 
00865 /*
00866  * Called when a searchResultDone is returned.  In refreshAndPersist,
00867  * this can only occur if the search for any reason is being terminated
00868  * by the server.
00869  */
00870 typedef int (*ldap_sync_search_result_f) LDAP_P((
00871        ldap_sync_t                 *ls,
00872        LDAPMessage                 *msg,
00873        int                         refreshDeletes ));
00874 
00875 /*
00876  * This structure contains all information about the persistent search;
00877  * the caller is responsible for connecting, setting version, binding, tls...
00878  */
00879 struct ldap_sync_t {
00880        /* conf search params */
00881        char                        *ls_base;
00882        int                         ls_scope;
00883        char                        *ls_filter;
00884        char                        **ls_attrs;
00885        int                         ls_timelimit;
00886        int                         ls_sizelimit;
00887 
00888        /* poll timeout */
00889        int                         ls_timeout;
00890 
00891        /* helpers - add as appropriate */
00892        ldap_sync_search_entry_f    ls_search_entry;
00893        ldap_sync_search_reference_f       ls_search_reference;
00894        ldap_sync_intermediate_f    ls_intermediate;
00895        ldap_sync_search_result_f   ls_search_result;
00896 
00897        /* set by the caller as appropriate */
00898        void                        *ls_private;
00899 
00900        /* conn stuff */
00901        LDAP                        *ls_ld;
00902 
00903        /* --- the parameters below are private - do not modify --- */
00904 
00905        /* FIXME: make the structure opaque, and provide an interface
00906         * to modify the public values? */
00907 
00908        /* result stuff */
00909        int                         ls_msgid;
00910 
00911        /* sync stuff */
00912        /* needed by refreshOnly */
00913        int                         ls_reloadHint;
00914 
00915        /* opaque - need to pass between sessions, updated by the API */
00916        struct berval               ls_cookie;
00917 
00918        /* state variable - do not modify */
00919        ldap_sync_refresh_t         ls_refreshPhase;
00920 };
00921 
00922 /*
00923  * End of LDAP sync (RFC4533) API
00924  */
00925 
00926 /*
00927  * Connection callbacks...
00928  */
00929 struct ldap_conncb;
00930 struct sockaddr;
00931 
00932 /* Called after a connection is established */
00933 typedef int (ldap_conn_add_f) LDAP_P(( LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, struct sockaddr *addr,
00934        struct ldap_conncb *ctx ));
00935 /* Called before a connection is closed */
00936 typedef void (ldap_conn_del_f) LDAP_P(( LDAP *ld, Sockbuf *sb, struct ldap_conncb *ctx ));
00937 
00938 /* Callbacks are pushed on a stack. Last one pushed is first one executed. The
00939  * delete callback is called with a NULL Sockbuf just before freeing the LDAP handle.
00940  */
00941 typedef struct ldap_conncb {
00942        ldap_conn_add_f *lc_add;
00943        ldap_conn_del_f *lc_del;
00944        void *lc_arg;
00945 } ldap_conncb;
00946 
00947 /*
00948  * The API draft spec says we should declare (or cause to be declared)
00949  * 'struct timeval'.   We don't.  See IETF LDAPext discussions.
00950  */
00951 struct timeval;
00952 
00953 /*
00954  * in options.c:
00955  */
00956 LDAP_F( int )
00957 ldap_get_option LDAP_P((
00958        LDAP *ld,
00959        int option,
00960        void *outvalue));
00961 
00962 LDAP_F( int )
00963 ldap_set_option LDAP_P((
00964        LDAP *ld,
00965        int option,
00966        LDAP_CONST void *invalue));
00967 
00968 /* V3 REBIND Function Callback Prototype */
00969 typedef int (LDAP_REBIND_PROC) LDAP_P((
00970        LDAP *ld, LDAP_CONST char *url,
00971        ber_tag_t request, ber_int_t msgid,
00972        void *params ));
00973 
00974 LDAP_F( int )
00975 ldap_set_rebind_proc LDAP_P((
00976        LDAP *ld,
00977        LDAP_REBIND_PROC *rebind_proc,
00978        void *params ));
00979 
00980 /* V3 referral selection Function Callback Prototype */
00981 typedef int (LDAP_NEXTREF_PROC) LDAP_P((
00982        LDAP *ld, char ***refsp, int *cntp,
00983        void *params ));
00984 
00985 LDAP_F( int )
00986 ldap_set_nextref_proc LDAP_P((
00987        LDAP *ld,
00988        LDAP_NEXTREF_PROC *nextref_proc,
00989        void *params ));
00990 
00991 /* V3 URLLIST Function Callback Prototype */
00992 typedef int (LDAP_URLLIST_PROC) LDAP_P((
00993        LDAP *ld, 
00994        LDAPURLDesc **urllist,
00995        LDAPURLDesc **url,
00996        void *params ));
00997 
00998 LDAP_F( int )
00999 ldap_set_urllist_proc LDAP_P((
01000        LDAP *ld,
01001        LDAP_URLLIST_PROC *urllist_proc,
01002        void *params ));
01003 
01004 /*
01005  * in controls.c:
01006  */
01007 #if LDAP_DEPRECATED  
01008 LDAP_F( int )
01009 ldap_create_control LDAP_P((       /* deprecated, use ldap_control_create */
01010        LDAP_CONST char *requestOID,
01011        BerElement *ber,
01012        int iscritical,
01013        LDAPControl **ctrlp ));
01014 
01015 LDAP_F( LDAPControl * )
01016 ldap_find_control LDAP_P((  /* deprecated, use ldap_control_find */
01017        LDAP_CONST char *oid,
01018        LDAPControl **ctrls ));
01019 #endif
01020 
01021 LDAP_F( int )
01022 ldap_control_create LDAP_P((
01023        LDAP_CONST char *requestOID,
01024        int iscritical,
01025        struct berval *value,
01026        int dupval,
01027        LDAPControl **ctrlp ));
01028 
01029 LDAP_F( LDAPControl * )
01030 ldap_control_find LDAP_P((
01031        LDAP_CONST char *oid,
01032        LDAPControl **ctrls,
01033        LDAPControl ***nextctrlp ));
01034 
01035 LDAP_F( void )
01036 ldap_control_free LDAP_P((
01037        LDAPControl *ctrl ));
01038 
01039 LDAP_F( void )
01040 ldap_controls_free LDAP_P((
01041        LDAPControl **ctrls ));
01042 
01043 LDAP_F( LDAPControl ** )
01044 ldap_controls_dup LDAP_P((
01045        LDAPControl *LDAP_CONST *controls ));
01046 
01047 LDAP_F( LDAPControl * )
01048 ldap_control_dup LDAP_P((
01049        LDAP_CONST LDAPControl *c ));
01050 
01051 /*
01052  * in dnssrv.c:
01053  */
01054 LDAP_F( int )
01055 ldap_domain2dn LDAP_P((
01056        LDAP_CONST char* domain,
01057        char** dn ));
01058 
01059 LDAP_F( int )
01060 ldap_dn2domain LDAP_P((
01061        LDAP_CONST char* dn,
01062        char** domain ));
01063 
01064 LDAP_F( int )
01065 ldap_domain2hostlist LDAP_P((
01066        LDAP_CONST char *domain,
01067        char** hostlist ));
01068 
01069 /*
01070  * in extended.c:
01071  */
01072 LDAP_F( int )
01073 ldap_extended_operation LDAP_P((
01074        LDAP                 *ld,
01075        LDAP_CONST char      *reqoid,
01076        struct berval *reqdata,
01077        LDAPControl          **serverctrls,
01078        LDAPControl          **clientctrls,
01079        int                         *msgidp ));
01080 
01081 LDAP_F( int )
01082 ldap_extended_operation_s LDAP_P((
01083        LDAP                 *ld,
01084        LDAP_CONST char      *reqoid,
01085        struct berval *reqdata,
01086        LDAPControl          **serverctrls,
01087        LDAPControl          **clientctrls,
01088        char                 **retoidp,
01089        struct berval **retdatap ));
01090 
01091 LDAP_F( int )
01092 ldap_parse_extended_result LDAP_P((
01093        LDAP                 *ld,
01094        LDAPMessage          *res,
01095        char                 **retoidp,
01096        struct berval **retdatap,
01097        int                         freeit ));
01098 
01099 LDAP_F( int )
01100 ldap_parse_intermediate LDAP_P((
01101        LDAP                 *ld,
01102        LDAPMessage          *res,
01103        char                 **retoidp,
01104        struct berval **retdatap,
01105        LDAPControl          ***serverctrls,
01106        int                         freeit ));
01107 
01108 
01109 /*
01110  * in abandon.c:
01111  */
01112 LDAP_F( int )
01113 ldap_abandon_ext LDAP_P((
01114        LDAP                 *ld,
01115        int                         msgid,
01116        LDAPControl          **serverctrls,
01117        LDAPControl          **clientctrls ));
01118 
01119 #if LDAP_DEPRECATED  
01120 LDAP_F( int )
01121 ldap_abandon LDAP_P((       /* deprecated, use ldap_abandon_ext */
01122        LDAP *ld,
01123        int msgid ));
01124 #endif
01125 
01126 /*
01127  * in add.c:
01128  */
01129 LDAP_F( int )
01130 ldap_add_ext LDAP_P((
01131        LDAP                 *ld,
01132        LDAP_CONST char      *dn,
01133        LDAPMod                     **attrs,
01134        LDAPControl          **serverctrls,
01135        LDAPControl          **clientctrls,
01136        int                  *msgidp ));
01137 
01138 LDAP_F( int )
01139 ldap_add_ext_s LDAP_P((
01140        LDAP                 *ld,
01141        LDAP_CONST char      *dn,
01142        LDAPMod                     **attrs,
01143        LDAPControl          **serverctrls,
01144        LDAPControl          **clientctrls ));
01145 
01146 #if LDAP_DEPRECATED
01147 LDAP_F( int )
01148 ldap_add LDAP_P((    /* deprecated, use ldap_add_ext */
01149        LDAP *ld,
01150        LDAP_CONST char *dn,
01151        LDAPMod **attrs ));
01152 
01153 LDAP_F( int )
01154 ldap_add_s LDAP_P((  /* deprecated, use ldap_add_ext_s */
01155        LDAP *ld,
01156        LDAP_CONST char *dn,
01157        LDAPMod **attrs ));
01158 #endif
01159 
01160 
01161 /*
01162  * in sasl.c:
01163  */
01164 LDAP_F( int )
01165 ldap_sasl_bind LDAP_P((
01166        LDAP                 *ld,
01167        LDAP_CONST char      *dn,
01168        LDAP_CONST char      *mechanism,
01169        struct berval *cred,
01170        LDAPControl          **serverctrls,
01171        LDAPControl          **clientctrls,
01172        int                         *msgidp ));
01173 
01174 /* Interaction flags (should be passed about in a control)
01175  *  Automatic (default): use defaults, prompt otherwise
01176  *  Interactive: prompt always
01177  *  Quiet: never prompt
01178  */
01179 #define LDAP_SASL_AUTOMATIC        0U
01180 #define LDAP_SASL_INTERACTIVE      1U
01181 #define LDAP_SASL_QUIET                   2U
01182 
01183 /*
01184  * V3 SASL Interaction Function Callback Prototype
01185  *     when using Cyrus SASL, interact is pointer to sasl_interact_t
01186  *  should likely passed in a control (and provided controls)
01187  */
01188 typedef int (LDAP_SASL_INTERACT_PROC) LDAP_P((
01189        LDAP *ld, unsigned flags, void* defaults, void *interact ));
01190 
01191 LDAP_F( int )
01192 ldap_sasl_interactive_bind LDAP_P((
01193        LDAP *ld,
01194        LDAP_CONST char *dn, /* usually NULL */
01195        LDAP_CONST char *saslMechanism,
01196        LDAPControl **serverControls,
01197        LDAPControl **clientControls,
01198 
01199        /* should be client controls */
01200        unsigned flags,
01201        LDAP_SASL_INTERACT_PROC *proc,
01202        void *defaults,
01203        
01204        /* as obtained from ldap_result() */
01205        LDAPMessage *result,
01206 
01207        /* returned during bind processing */
01208        const char **rmech,
01209        int *msgid ));
01210 
01211 LDAP_F( int )
01212 ldap_sasl_interactive_bind_s LDAP_P((
01213        LDAP *ld,
01214        LDAP_CONST char *dn, /* usually NULL */
01215        LDAP_CONST char *saslMechanism,
01216        LDAPControl **serverControls,
01217        LDAPControl **clientControls,
01218 
01219        /* should be client controls */
01220        unsigned flags,
01221        LDAP_SASL_INTERACT_PROC *proc,
01222        void *defaults ));
01223 
01224 LDAP_F( int )
01225 ldap_sasl_bind_s LDAP_P((
01226        LDAP                 *ld,
01227        LDAP_CONST char      *dn,
01228        LDAP_CONST char      *mechanism,
01229        struct berval *cred,
01230        LDAPControl          **serverctrls,
01231        LDAPControl          **clientctrls,
01232        struct berval **servercredp ));
01233 
01234 LDAP_F( int )
01235 ldap_parse_sasl_bind_result LDAP_P((
01236        LDAP                 *ld,
01237        LDAPMessage          *res,
01238        struct berval **servercredp,
01239        int                         freeit ));
01240 
01241 #if LDAP_DEPRECATED
01242 /*
01243  * in bind.c:
01244  *     (deprecated)
01245  */
01246 LDAP_F( int )
01247 ldap_bind LDAP_P((   /* deprecated, use ldap_sasl_bind */
01248        LDAP *ld,
01249        LDAP_CONST char *who,
01250        LDAP_CONST char *passwd,
01251        int authmethod ));
01252 
01253 LDAP_F( int )
01254 ldap_bind_s LDAP_P(( /* deprecated, use ldap_sasl_bind_s */
01255        LDAP *ld,
01256        LDAP_CONST char *who,
01257        LDAP_CONST char *cred,
01258        int authmethod ));
01259 
01260 /*
01261  * in sbind.c:
01262  */
01263 LDAP_F( int )
01264 ldap_simple_bind LDAP_P(( /* deprecated, use ldap_sasl_bind */
01265        LDAP *ld,
01266        LDAP_CONST char *who,
01267        LDAP_CONST char *passwd ));
01268 
01269 LDAP_F( int )
01270 ldap_simple_bind_s LDAP_P(( /* deprecated, use ldap_sasl_bind_s */
01271        LDAP *ld,
01272        LDAP_CONST char *who,
01273        LDAP_CONST char *passwd ));
01274 
01275 #endif
01276 
01277 
01278 /*
01279  * in compare.c:
01280  */
01281 LDAP_F( int )
01282 ldap_compare_ext LDAP_P((
01283        LDAP                 *ld,
01284        LDAP_CONST char      *dn,
01285        LDAP_CONST char      *attr,
01286        struct berval *bvalue,
01287        LDAPControl          **serverctrls,
01288        LDAPControl          **clientctrls,
01289        int                  *msgidp ));
01290 
01291 LDAP_F( int )
01292 ldap_compare_ext_s LDAP_P((
01293        LDAP                 *ld,
01294        LDAP_CONST char      *dn,
01295        LDAP_CONST char      *attr,
01296        struct berval *bvalue,
01297        LDAPControl          **serverctrls,
01298        LDAPControl          **clientctrls ));
01299 
01300 #if LDAP_DEPRECATED
01301 LDAP_F( int )
01302 ldap_compare LDAP_P((       /* deprecated, use ldap_compare_ext */
01303        LDAP *ld,
01304        LDAP_CONST char *dn,
01305        LDAP_CONST char *attr,
01306        LDAP_CONST char *value ));
01307 
01308 LDAP_F( int )
01309 ldap_compare_s LDAP_P((     /* deprecated, use ldap_compare_ext_s */
01310        LDAP *ld,
01311        LDAP_CONST char *dn,
01312        LDAP_CONST char *attr,
01313        LDAP_CONST char *value ));
01314 #endif
01315 
01316 
01317 /*
01318  * in delete.c:
01319  */
01320 LDAP_F( int )
01321 ldap_delete_ext LDAP_P((
01322        LDAP                 *ld,
01323        LDAP_CONST char      *dn,
01324        LDAPControl          **serverctrls,
01325        LDAPControl          **clientctrls,
01326        int                  *msgidp ));
01327 
01328 LDAP_F( int )
01329 ldap_delete_ext_s LDAP_P((
01330        LDAP                 *ld,
01331        LDAP_CONST char      *dn,
01332        LDAPControl          **serverctrls,
01333        LDAPControl          **clientctrls ));
01334 
01335 #if LDAP_DEPRECATED
01336 LDAP_F( int )
01337 ldap_delete LDAP_P(( /* deprecated, use ldap_delete_ext */
01338        LDAP *ld,
01339        LDAP_CONST char *dn ));
01340 
01341 LDAP_F( int )
01342 ldap_delete_s LDAP_P((      /* deprecated, use ldap_delete_ext_s */
01343        LDAP *ld,
01344        LDAP_CONST char *dn ));
01345 #endif
01346 
01347 
01348 /*
01349  * in error.c:
01350  */
01351 LDAP_F( int )
01352 ldap_parse_result LDAP_P((
01353        LDAP                 *ld,
01354        LDAPMessage          *res,
01355        int                         *errcodep,
01356        char                 **matcheddnp,
01357        char                 **errmsgp,
01358        char                 ***referralsp,
01359        LDAPControl          ***serverctrls,
01360        int                         freeit ));
01361 
01362 LDAP_F( char * )
01363 ldap_err2string LDAP_P((
01364        int err ));
01365 
01366 #if LDAP_DEPRECATED
01367 LDAP_F( int )
01368 ldap_result2error LDAP_P((  /* deprecated, use ldap_parse_result */
01369        LDAP *ld,
01370        LDAPMessage *r,
01371        int freeit ));
01372 
01373 LDAP_F( void )
01374 ldap_perror LDAP_P(( /* deprecated, use ldap_err2string */
01375        LDAP *ld,
01376        LDAP_CONST char *s ));
01377 #endif
01378 
01379 
01380 /*
01381  * gssapi.c:
01382  */
01383 LDAP_F( int )
01384 ldap_gssapi_bind LDAP_P((
01385        LDAP *ld,
01386        LDAP_CONST char *dn,
01387        LDAP_CONST char *creds ));
01388 
01389 LDAP_F( int )
01390 ldap_gssapi_bind_s LDAP_P((
01391        LDAP *ld,
01392        LDAP_CONST char *dn,
01393        LDAP_CONST char *creds ));
01394 
01395 
01396 /*
01397  * in modify.c:
01398  */
01399 LDAP_F( int )
01400 ldap_modify_ext LDAP_P((
01401        LDAP                 *ld,
01402        LDAP_CONST char      *dn,
01403        LDAPMod                     **mods,
01404        LDAPControl          **serverctrls,
01405        LDAPControl          **clientctrls,
01406        int                  *msgidp ));
01407 
01408 LDAP_F( int )
01409 ldap_modify_ext_s LDAP_P((
01410        LDAP                 *ld,
01411        LDAP_CONST char      *dn,
01412        LDAPMod                     **mods,
01413        LDAPControl          **serverctrls,
01414        LDAPControl          **clientctrls ));
01415 
01416 #if LDAP_DEPRECATED
01417 LDAP_F( int )
01418 ldap_modify LDAP_P(( /* deprecated, use ldap_modify_ext */
01419        LDAP *ld,
01420        LDAP_CONST char *dn,
01421        LDAPMod **mods ));
01422 
01423 LDAP_F( int )
01424 ldap_modify_s LDAP_P((      /* deprecated, use ldap_modify_ext_s */
01425        LDAP *ld,
01426        LDAP_CONST char *dn,
01427        LDAPMod **mods ));
01428 #endif
01429 
01430 
01431 /*
01432  * in modrdn.c:
01433  */
01434 LDAP_F( int )
01435 ldap_rename LDAP_P((
01436        LDAP *ld,
01437        LDAP_CONST char *dn,
01438        LDAP_CONST char *newrdn,
01439        LDAP_CONST char *newSuperior,
01440        int deleteoldrdn,
01441        LDAPControl **sctrls,
01442        LDAPControl **cctrls,
01443        int *msgidp ));
01444 
01445 LDAP_F( int )
01446 ldap_rename_s LDAP_P((
01447        LDAP *ld,
01448        LDAP_CONST char *dn,
01449        LDAP_CONST char *newrdn,
01450        LDAP_CONST char *newSuperior,
01451        int deleteoldrdn,
01452        LDAPControl **sctrls,
01453        LDAPControl **cctrls ));
01454 
01455 #if LDAP_DEPRECATED
01456 LDAP_F( int )
01457 ldap_rename2 LDAP_P((       /* deprecated, use ldap_rename */
01458        LDAP *ld,
01459        LDAP_CONST char *dn,
01460        LDAP_CONST char *newrdn,
01461        LDAP_CONST char *newSuperior,
01462        int deleteoldrdn ));
01463 
01464 LDAP_F( int )
01465 ldap_rename2_s LDAP_P((     /* deprecated, use ldap_rename_s */
01466        LDAP *ld,
01467        LDAP_CONST char *dn,
01468        LDAP_CONST char *newrdn,
01469        LDAP_CONST char *newSuperior,
01470        int deleteoldrdn ));
01471 
01472 LDAP_F( int )
01473 ldap_modrdn LDAP_P(( /* deprecated, use ldap_rename */
01474        LDAP *ld,
01475        LDAP_CONST char *dn,
01476        LDAP_CONST char *newrdn ));
01477 
01478 LDAP_F( int )
01479 ldap_modrdn_s LDAP_P((      /* deprecated, use ldap_rename_s */
01480        LDAP *ld,
01481        LDAP_CONST char *dn,
01482        LDAP_CONST char *newrdn ));
01483 
01484 LDAP_F( int )
01485 ldap_modrdn2 LDAP_P((       /* deprecated, use ldap_rename */
01486        LDAP *ld,
01487        LDAP_CONST char *dn,
01488        LDAP_CONST char *newrdn,
01489        int deleteoldrdn ));
01490 
01491 LDAP_F( int )
01492 ldap_modrdn2_s LDAP_P((     /* deprecated, use ldap_rename_s */
01493        LDAP *ld,
01494        LDAP_CONST char *dn,
01495        LDAP_CONST char *newrdn,
01496        int deleteoldrdn));
01497 #endif
01498 
01499 
01500 /*
01501  * in open.c:
01502  */
01503 #if LDAP_DEPRECATED
01504 LDAP_F( LDAP * )
01505 ldap_init LDAP_P(( /* deprecated, use ldap_create or ldap_initialize */
01506        LDAP_CONST char *host,
01507        int port ));
01508 
01509 LDAP_F( LDAP * )
01510 ldap_open LDAP_P((   /* deprecated, use ldap_create or ldap_initialize */
01511        LDAP_CONST char *host,
01512        int port ));
01513 #endif
01514 
01515 LDAP_F( int )
01516 ldap_create LDAP_P((
01517        LDAP **ldp ));
01518 
01519 LDAP_F( int )
01520 ldap_initialize LDAP_P((
01521        LDAP **ldp,
01522        LDAP_CONST char *url ));
01523 
01524 LDAP_F( LDAP * )
01525 ldap_dup LDAP_P((
01526        LDAP *old ));
01527 
01528 /*
01529  * in tls.c
01530  */
01531 
01532 LDAP_F( int )
01533 ldap_tls_inplace LDAP_P((
01534        LDAP *ld ));
01535 
01536 LDAP_F( int )
01537 ldap_start_tls LDAP_P((
01538        LDAP *ld,
01539        LDAPControl **serverctrls,
01540        LDAPControl **clientctrls,
01541        int *msgidp ));
01542 
01543 LDAP_F( int )
01544 ldap_install_tls LDAP_P((
01545        LDAP *ld ));
01546 
01547 LDAP_F( int )
01548 ldap_start_tls_s LDAP_P((
01549        LDAP *ld,
01550        LDAPControl **serverctrls,
01551        LDAPControl **clientctrls ));
01552 
01553 /*
01554  * in messages.c:
01555  */
01556 LDAP_F( LDAPMessage * )
01557 ldap_first_message LDAP_P((
01558        LDAP *ld,
01559        LDAPMessage *chain ));
01560 
01561 LDAP_F( LDAPMessage * )
01562 ldap_next_message LDAP_P((
01563        LDAP *ld,
01564        LDAPMessage *msg ));
01565 
01566 LDAP_F( int )
01567 ldap_count_messages LDAP_P((
01568        LDAP *ld,
01569        LDAPMessage *chain ));
01570 
01571 /*
01572  * in references.c:
01573  */
01574 LDAP_F( LDAPMessage * )
01575 ldap_first_reference LDAP_P((
01576        LDAP *ld,
01577        LDAPMessage *chain ));
01578 
01579 LDAP_F( LDAPMessage * )
01580 ldap_next_reference LDAP_P((
01581        LDAP *ld,
01582        LDAPMessage *ref ));
01583 
01584 LDAP_F( int )
01585 ldap_count_references LDAP_P((
01586        LDAP *ld,
01587        LDAPMessage *chain ));
01588 
01589 LDAP_F( int )
01590 ldap_parse_reference LDAP_P((
01591        LDAP                 *ld,
01592        LDAPMessage          *ref,
01593        char                 ***referralsp,
01594        LDAPControl          ***serverctrls,
01595        int                         freeit));
01596 
01597 
01598 /*
01599  * in getentry.c:
01600  */
01601 LDAP_F( LDAPMessage * )
01602 ldap_first_entry LDAP_P((
01603        LDAP *ld,
01604        LDAPMessage *chain ));
01605 
01606 LDAP_F( LDAPMessage * )
01607 ldap_next_entry LDAP_P((
01608        LDAP *ld,
01609        LDAPMessage *entry ));
01610 
01611 LDAP_F( int )
01612 ldap_count_entries LDAP_P((
01613        LDAP *ld,
01614        LDAPMessage *chain ));
01615 
01616 LDAP_F( int )
01617 ldap_get_entry_controls LDAP_P((
01618        LDAP                 *ld,
01619        LDAPMessage          *entry,
01620        LDAPControl          ***serverctrls));
01621 
01622 
01623 /*
01624  * in addentry.c
01625  */
01626 LDAP_F( LDAPMessage * )
01627 ldap_delete_result_entry LDAP_P((
01628        LDAPMessage **list,
01629        LDAPMessage *e ));
01630 
01631 LDAP_F( void )
01632 ldap_add_result_entry LDAP_P((
01633        LDAPMessage **list,
01634        LDAPMessage *e ));
01635 
01636 
01637 /*
01638  * in getdn.c
01639  */
01640 LDAP_F( char * )
01641 ldap_get_dn LDAP_P((
01642        LDAP *ld,
01643        LDAPMessage *entry ));
01644 
01645 typedef struct ldap_ava {
01646        struct berval la_attr;
01647        struct berval la_value;
01648        unsigned la_flags;
01649 #define LDAP_AVA_NULL                            0x0000U
01650 #define LDAP_AVA_STRING                          0x0001U
01651 #define LDAP_AVA_BINARY                          0x0002U
01652 #define LDAP_AVA_NONPRINTABLE             0x0004U
01653 #define LDAP_AVA_FREE_ATTR                0x0010U
01654 #define LDAP_AVA_FREE_VALUE               0x0020U
01655 
01656        void *la_private;
01657 } LDAPAVA;
01658 
01659 typedef LDAPAVA** LDAPRDN;
01660 typedef LDAPRDN* LDAPDN;
01661 
01662 /* DN formats */
01663 #define LDAP_DN_FORMAT_LDAP               0x0000U
01664 #define LDAP_DN_FORMAT_LDAPV3             0x0010U
01665 #define LDAP_DN_FORMAT_LDAPV2             0x0020U
01666 #define LDAP_DN_FORMAT_DCE                0x0030U
01667 #define LDAP_DN_FORMAT_UFN                0x0040U       /* dn2str only */
01668 #define LDAP_DN_FORMAT_AD_CANONICAL       0x0050U       /* dn2str only */
01669 #define LDAP_DN_FORMAT_LBER               0x00F0U /* for testing only */
01670 #define LDAP_DN_FORMAT_MASK               0x00F0U
01671 
01672 /* DN flags */
01673 #define LDAP_DN_PRETTY                           0x0100U
01674 #define LDAP_DN_SKIP                      0x0200U
01675 #define LDAP_DN_P_NOLEADTRAILSPACES       0x1000U
01676 #define LDAP_DN_P_NOSPACEAFTERRDN  0x2000U
01677 #define LDAP_DN_PEDANTIC                  0xF000U
01678 
01679 LDAP_F( void ) ldap_rdnfree LDAP_P(( LDAPRDN rdn ));
01680 LDAP_F( void ) ldap_dnfree LDAP_P(( LDAPDN dn ));
01681 
01682 LDAP_F( int )
01683 ldap_bv2dn LDAP_P(( 
01684        struct berval *bv, 
01685        LDAPDN *dn, 
01686        unsigned flags ));
01687 
01688 LDAP_F( int )
01689 ldap_str2dn LDAP_P((
01690        LDAP_CONST char *str,
01691        LDAPDN *dn,
01692        unsigned flags ));
01693 
01694 LDAP_F( int )
01695 ldap_dn2bv LDAP_P((
01696        LDAPDN dn,
01697        struct berval *bv,
01698        unsigned flags ));
01699 
01700 LDAP_F( int )
01701 ldap_dn2str LDAP_P((
01702        LDAPDN dn,
01703        char **str,
01704        unsigned flags ));
01705 
01706 LDAP_F( int )
01707 ldap_bv2rdn LDAP_P((
01708        struct berval *bv,
01709        LDAPRDN *rdn,
01710        char **next,
01711        unsigned flags ));
01712 
01713 LDAP_F( int )
01714 ldap_str2rdn LDAP_P((
01715        LDAP_CONST char *str,
01716        LDAPRDN *rdn,
01717        char **next,
01718        unsigned flags ));
01719 
01720 LDAP_F( int )
01721 ldap_rdn2bv LDAP_P((
01722        LDAPRDN rdn,
01723        struct berval *bv,
01724        unsigned flags ));
01725 
01726 LDAP_F( int )
01727 ldap_rdn2str LDAP_P((
01728        LDAPRDN rdn,
01729        char **str,
01730        unsigned flags ));
01731 
01732 LDAP_F( int )
01733 ldap_dn_normalize LDAP_P((
01734        LDAP_CONST char *in, unsigned iflags,
01735        char **out, unsigned oflags ));
01736 
01737 LDAP_F( char * )
01738 ldap_dn2ufn LDAP_P(( /* deprecated, use ldap_str2dn/dn2str */
01739        LDAP_CONST char *dn ));
01740 
01741 LDAP_F( char ** )
01742 ldap_explode_dn LDAP_P(( /* deprecated, ldap_str2dn */
01743        LDAP_CONST char *dn,
01744        int notypes ));
01745 
01746 LDAP_F( char ** )
01747 ldap_explode_rdn LDAP_P(( /* deprecated, ldap_str2rdn */
01748        LDAP_CONST char *rdn,
01749        int notypes ));
01750 
01751 typedef int LDAPDN_rewrite_func
01752        LDAP_P(( LDAPDN dn, unsigned flags, void *ctx ));
01753 
01754 LDAP_F( int )
01755 ldap_X509dn2bv LDAP_P(( void *x509_name, struct berval *dn,
01756        LDAPDN_rewrite_func *func, unsigned flags ));
01757 
01758 LDAP_F( char * )
01759 ldap_dn2dcedn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
01760        LDAP_CONST char *dn ));
01761 
01762 LDAP_F( char * )
01763 ldap_dcedn2dn LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
01764        LDAP_CONST char *dce ));
01765 
01766 LDAP_F( char * )
01767 ldap_dn2ad_canonical LDAP_P(( /* deprecated, ldap_str2dn/dn2str */
01768        LDAP_CONST char *dn ));
01769 
01770 LDAP_F( int )
01771 ldap_get_dn_ber LDAP_P((
01772        LDAP *ld, LDAPMessage *e, BerElement **berout, struct berval *dn ));
01773 
01774 LDAP_F( int )
01775 ldap_get_attribute_ber LDAP_P((
01776        LDAP *ld, LDAPMessage *e, BerElement *ber, struct berval *attr,
01777        struct berval **vals ));
01778 
01779 /*
01780  * in getattr.c
01781  */
01782 LDAP_F( char * )
01783 ldap_first_attribute LDAP_P((
01784        LDAP *ld,
01785        LDAPMessage *entry,
01786        BerElement **ber ));
01787 
01788 LDAP_F( char * )
01789 ldap_next_attribute LDAP_P((
01790        LDAP *ld,
01791        LDAPMessage *entry,
01792        BerElement *ber ));
01793 
01794 
01795 /*
01796  * in getvalues.c
01797  */
01798 LDAP_F( struct berval ** )
01799 ldap_get_values_len LDAP_P((
01800        LDAP *ld,
01801        LDAPMessage *entry,
01802        LDAP_CONST char *target ));
01803 
01804 LDAP_F( int )
01805 ldap_count_values_len LDAP_P((
01806        struct berval **vals ));
01807 
01808 LDAP_F( void )
01809 ldap_value_free_len LDAP_P((
01810        struct berval **vals ));
01811 
01812 #if LDAP_DEPRECATED
01813 LDAP_F( char ** )
01814 ldap_get_values LDAP_P((    /* deprecated, use ldap_get_values_len */
01815        LDAP *ld,
01816        LDAPMessage *entry,
01817        LDAP_CONST char *target ));
01818 
01819 LDAP_F( int )
01820 ldap_count_values LDAP_P((  /* deprecated, use ldap_count_values_len */
01821        char **vals ));
01822 
01823 LDAP_F( void )
01824 ldap_value_free LDAP_P((    /* deprecated, use ldap_value_free_len */
01825        char **vals ));
01826 #endif
01827 
01828 /*
01829  * in result.c:
01830  */
01831 LDAP_F( int )
01832 ldap_result LDAP_P((
01833        LDAP *ld,
01834        int msgid,
01835        int all,
01836        struct timeval *timeout,
01837        LDAPMessage **result ));
01838 
01839 LDAP_F( int )
01840 ldap_msgtype LDAP_P((
01841        LDAPMessage *lm ));
01842 
01843 LDAP_F( int )
01844 ldap_msgid   LDAP_P((
01845        LDAPMessage *lm ));
01846 
01847 LDAP_F( int )
01848 ldap_msgfree LDAP_P((
01849        LDAPMessage *lm ));
01850 
01851 LDAP_F( int )
01852 ldap_msgdelete LDAP_P((
01853        LDAP *ld,
01854        int msgid ));
01855 
01856 
01857 /*
01858  * in search.c:
01859  */
01860 LDAP_F( int )
01861 ldap_bv2escaped_filter_value LDAP_P(( 
01862        struct berval *in, 
01863        struct berval *out ));
01864 
01865 LDAP_F( int )
01866 ldap_search_ext LDAP_P((
01867        LDAP                 *ld,
01868        LDAP_CONST char      *base,
01869        int                         scope,
01870        LDAP_CONST char      *filter,
01871        char                 **attrs,
01872        int                         attrsonly,
01873        LDAPControl          **serverctrls,
01874        LDAPControl          **clientctrls,
01875        struct timeval       *timeout,
01876        int                         sizelimit,
01877        int                         *msgidp ));
01878 
01879 LDAP_F( int )
01880 ldap_search_ext_s LDAP_P((
01881        LDAP                 *ld,
01882        LDAP_CONST char      *base,
01883        int                         scope,
01884        LDAP_CONST char      *filter,
01885        char                 **attrs,
01886        int                         attrsonly,
01887        LDAPControl          **serverctrls,
01888        LDAPControl          **clientctrls,
01889        struct timeval       *timeout,
01890        int                         sizelimit,
01891        LDAPMessage          **res ));
01892 
01893 #if LDAP_DEPRECATED
01894 LDAP_F( int )
01895 ldap_search LDAP_P(( /* deprecated, use ldap_search_ext */
01896        LDAP *ld,
01897        LDAP_CONST char *base,
01898        int scope,
01899        LDAP_CONST char *filter,
01900        char **attrs,
01901        int attrsonly ));
01902 
01903 LDAP_F( int )
01904 ldap_search_s LDAP_P((      /* deprecated, use ldap_search_ext_s */
01905        LDAP *ld,
01906        LDAP_CONST char *base,
01907        int scope,
01908        LDAP_CONST char *filter,
01909        char **attrs,
01910        int attrsonly,
01911        LDAPMessage **res ));
01912 
01913 LDAP_F( int )
01914 ldap_search_st LDAP_P((     /* deprecated, use ldap_search_ext_s */
01915        LDAP *ld,
01916        LDAP_CONST char *base,
01917        int scope,
01918        LDAP_CONST char *filter,
01919     char **attrs,
01920        int attrsonly,
01921        struct timeval *timeout,
01922        LDAPMessage **res ));
01923 #endif
01924 
01925 /*
01926  * in unbind.c
01927  */
01928 LDAP_F( int )
01929 ldap_unbind_ext LDAP_P((
01930        LDAP                 *ld,
01931        LDAPControl          **serverctrls,
01932        LDAPControl          **clientctrls));
01933 
01934 LDAP_F( int )
01935 ldap_unbind_ext_s LDAP_P((
01936        LDAP                 *ld,
01937        LDAPControl          **serverctrls,
01938        LDAPControl          **clientctrls));
01939 
01940 LDAP_F( int )
01941 ldap_destroy LDAP_P((
01942        LDAP                 *ld));
01943 
01944 #if LDAP_DEPRECATED
01945 LDAP_F( int )
01946 ldap_unbind LDAP_P(( /* deprecated, use ldap_unbind_ext */
01947        LDAP *ld ));
01948 
01949 LDAP_F( int )
01950 ldap_unbind_s LDAP_P(( /* deprecated, use ldap_unbind_ext_s */
01951        LDAP *ld ));
01952 #endif
01953 
01954 /*
01955  * in filter.c
01956  */
01957 LDAP_F( int )
01958 ldap_put_vrFilter LDAP_P((
01959        BerElement *ber,
01960        const char *vrf ));
01961 
01962 /*
01963  * in free.c
01964  */
01965 
01966 LDAP_F( void * )
01967 ldap_memalloc LDAP_P((
01968        ber_len_t s ));
01969 
01970 LDAP_F( void * )
01971 ldap_memrealloc LDAP_P((
01972        void* p,
01973        ber_len_t s ));
01974 
01975 LDAP_F( void * )
01976 ldap_memcalloc LDAP_P((
01977        ber_len_t n,
01978        ber_len_t s ));
01979 
01980 LDAP_F( void )
01981 ldap_memfree LDAP_P((
01982        void* p ));
01983 
01984 LDAP_F( void )
01985 ldap_memvfree LDAP_P((
01986        void** v ));
01987 
01988 LDAP_F( char * )
01989 ldap_strdup LDAP_P((
01990        LDAP_CONST char * ));
01991 
01992 LDAP_F( void )
01993 ldap_mods_free LDAP_P((
01994        LDAPMod **mods,
01995        int freemods ));
01996 
01997 
01998 #if LDAP_DEPRECATED
01999 /*
02000  * in sort.c (deprecated, use custom code instead)
02001  */
02002 typedef int (LDAP_SORT_AD_CMP_PROC) LDAP_P(( /* deprecated */
02003        LDAP_CONST char *left,
02004        LDAP_CONST char *right ));
02005 
02006 typedef int (LDAP_SORT_AV_CMP_PROC) LDAP_P(( /* deprecated */
02007        LDAP_CONST void *left,
02008        LDAP_CONST void *right ));
02009 
02010 LDAP_F( int ) /* deprecated */
02011 ldap_sort_entries LDAP_P(( LDAP *ld,
02012        LDAPMessage **chain,
02013        LDAP_CONST char *attr,
02014        LDAP_SORT_AD_CMP_PROC *cmp ));
02015 
02016 LDAP_F( int ) /* deprecated */
02017 ldap_sort_values LDAP_P((
02018        LDAP *ld,
02019        char **vals,
02020        LDAP_SORT_AV_CMP_PROC *cmp ));
02021 
02022 LDAP_F( int ) /* deprecated */
02023 ldap_sort_strcasecmp LDAP_P((
02024        LDAP_CONST void *a,
02025        LDAP_CONST void *b ));
02026 #endif
02027 
02028 /*
02029  * in url.c
02030  */
02031 LDAP_F( int )
02032 ldap_is_ldap_url LDAP_P((
02033        LDAP_CONST char *url ));
02034 
02035 LDAP_F( int )
02036 ldap_is_ldaps_url LDAP_P((
02037        LDAP_CONST char *url ));
02038 
02039 LDAP_F( int )
02040 ldap_is_ldapi_url LDAP_P((
02041        LDAP_CONST char *url ));
02042 
02043 LDAP_F( int )
02044 ldap_url_parse LDAP_P((
02045        LDAP_CONST char *url,
02046        LDAPURLDesc **ludpp ));
02047 
02048 LDAP_F( char * )
02049 ldap_url_desc2str LDAP_P((
02050        LDAPURLDesc *ludp ));
02051 
02052 LDAP_F( void )
02053 ldap_free_urldesc LDAP_P((
02054        LDAPURLDesc *ludp ));
02055 
02056 
02057 /*
02058  * LDAP Cancel Extended Operation <draft-zeilenga-ldap-cancel-xx.txt>
02059  *  in cancel.c
02060  */
02061 #define LDAP_API_FEATURE_CANCEL 1000
02062 
02063 LDAP_F( int )
02064 ldap_cancel LDAP_P(( LDAP *ld,
02065        int cancelid,
02066        LDAPControl          **sctrls,
02067        LDAPControl          **cctrls,
02068        int                         *msgidp ));
02069 
02070 LDAP_F( int )
02071 ldap_cancel_s LDAP_P(( LDAP *ld,
02072        int cancelid,
02073        LDAPControl **sctrl,
02074        LDAPControl **cctrl ));
02075 
02076 /*
02077  * LDAP Turn Extended Operation <draft-zeilenga-ldap-turn-xx.txt>
02078  *  in turn.c
02079  */
02080 #define LDAP_API_FEATURE_TURN 1000
02081 
02082 LDAP_F( int )
02083 ldap_turn LDAP_P(( LDAP *ld,
02084        int mutual,
02085        LDAP_CONST char* identifier,
02086        LDAPControl          **sctrls,
02087        LDAPControl          **cctrls,
02088        int                         *msgidp ));
02089 
02090 LDAP_F( int )
02091 ldap_turn_s LDAP_P(( LDAP *ld,
02092        int mutual,
02093        LDAP_CONST char* identifier,
02094        LDAPControl **sctrl,
02095        LDAPControl **cctrl ));
02096 
02097 /*
02098  * LDAP Paged Results
02099  *     in pagectrl.c
02100  */
02101 #define LDAP_API_FEATURE_PAGED_RESULTS 2000
02102 
02103 LDAP_F( int )
02104 ldap_create_page_control_value LDAP_P((
02105        LDAP *ld,
02106        ber_int_t pagesize,
02107        struct berval *cookie,
02108        struct berval *value ));
02109 
02110 LDAP_F( int )
02111 ldap_create_page_control LDAP_P((
02112        LDAP *ld,
02113        ber_int_t pagesize,
02114        struct berval *cookie,
02115        int iscritical,
02116        LDAPControl **ctrlp ));
02117 
02118 #if LDAP_DEPRECATED
02119 LDAP_F( int )
02120 ldap_parse_page_control LDAP_P((
02121        /* deprecated, use ldap_parse_pageresponse_control */
02122        LDAP *ld,
02123        LDAPControl **ctrls,
02124        ber_int_t *count,
02125        struct berval **cookie ));
02126 #endif
02127 
02128 LDAP_F( int )
02129 ldap_parse_pageresponse_control LDAP_P((
02130        LDAP *ld,
02131        LDAPControl *ctrl,
02132        ber_int_t *count,
02133        struct berval *cookie ));
02134 
02135 /*
02136  * LDAP Server Side Sort
02137  *     in sortctrl.c
02138  */
02139 #define LDAP_API_FEATURE_SERVER_SIDE_SORT 2000
02140 
02141 /* structure for a sort-key */
02142 typedef struct ldapsortkey {
02143        char *attributeType;
02144        char *orderingRule;
02145        int reverseOrder;
02146 } LDAPSortKey;
02147 
02148 LDAP_F( int )
02149 ldap_create_sort_keylist LDAP_P((
02150        LDAPSortKey ***sortKeyList,
02151        char *keyString ));
02152 
02153 LDAP_F( void )
02154 ldap_free_sort_keylist LDAP_P((
02155        LDAPSortKey **sortkeylist ));
02156 
02157 LDAP_F( int )
02158 ldap_create_sort_control_value LDAP_P((
02159        LDAP *ld,
02160        LDAPSortKey **keyList,
02161        struct berval *value ));
02162 
02163 LDAP_F( int )
02164 ldap_create_sort_control LDAP_P((
02165        LDAP *ld,
02166        LDAPSortKey **keyList,
02167        int iscritical,
02168        LDAPControl **ctrlp ));
02169 
02170 LDAP_F( int )
02171 ldap_parse_sortresponse_control LDAP_P((
02172        LDAP *ld,
02173        LDAPControl *ctrl,
02174        ber_int_t *result,
02175        char **attribute ));
02176 
02177 /*
02178  * LDAP Virtual List View
02179  *     in vlvctrl.c
02180  */
02181 #define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 2000
02182 
02183 /* structure for virtual list */
02184 typedef struct ldapvlvinfo {
02185        ber_int_t ldvlv_version;
02186     ber_int_t ldvlv_before_count;
02187     ber_int_t ldvlv_after_count;
02188     ber_int_t ldvlv_offset;
02189     ber_int_t ldvlv_count;
02190     struct berval *  ldvlv_attrvalue;
02191     struct berval *  ldvlv_context;
02192     void *                  ldvlv_extradata;
02193 } LDAPVLVInfo;
02194 
02195 LDAP_F( int )
02196 ldap_create_vlv_control_value LDAP_P((
02197        LDAP *ld,
02198        LDAPVLVInfo *ldvlistp,
02199        struct berval *value));
02200 
02201 LDAP_F( int )
02202 ldap_create_vlv_control LDAP_P((
02203        LDAP *ld,
02204        LDAPVLVInfo *ldvlistp,
02205        LDAPControl **ctrlp ));
02206 
02207 LDAP_F( int )
02208 ldap_parse_vlvresponse_control LDAP_P((
02209        LDAP          *ld,
02210        LDAPControl   *ctrls,
02211        ber_int_t *target_posp,
02212        ber_int_t *list_countp,
02213        struct berval **contextp,
02214        int           *errcodep ));
02215 
02216 /*
02217  * LDAP Who Am I?
02218  *     in whoami.c
02219  */
02220 #define LDAP_API_FEATURE_WHOAMI 1000
02221 
02222 LDAP_F( int )
02223 ldap_parse_whoami LDAP_P((
02224        LDAP *ld,
02225        LDAPMessage *res,
02226        struct berval **authzid ));
02227 
02228 LDAP_F( int )
02229 ldap_whoami LDAP_P(( LDAP *ld,
02230        LDAPControl          **sctrls,
02231        LDAPControl          **cctrls,
02232        int                         *msgidp ));
02233 
02234 LDAP_F( int )
02235 ldap_whoami_s LDAP_P((
02236        LDAP *ld,
02237        struct berval **authzid,
02238        LDAPControl **sctrls,
02239        LDAPControl **cctrls ));
02240 
02241 /*
02242  * LDAP Password Modify
02243  *     in passwd.c
02244  */
02245 #define LDAP_API_FEATURE_PASSWD_MODIFY 1000
02246 
02247 LDAP_F( int )
02248 ldap_parse_passwd LDAP_P((
02249        LDAP *ld,
02250        LDAPMessage *res,
02251        struct berval *newpasswd ));
02252 
02253 LDAP_F( int )
02254 ldap_passwd LDAP_P(( LDAP *ld,
02255        struct berval *user,
02256        struct berval *oldpw,
02257        struct berval *newpw,
02258        LDAPControl          **sctrls,
02259        LDAPControl          **cctrls,
02260        int                         *msgidp ));
02261 
02262 LDAP_F( int )
02263 ldap_passwd_s LDAP_P((
02264        LDAP *ld,
02265        struct berval *user,
02266        struct berval *oldpw,
02267        struct berval *newpw,
02268        struct berval *newpasswd,
02269        LDAPControl **sctrls,
02270        LDAPControl **cctrls ));
02271 
02272 #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
02273 /*
02274  * LDAP Password Policy controls
02275  *     in ppolicy.c
02276  */
02277 #define LDAP_API_FEATURE_PASSWORD_POLICY 1000
02278 
02279 typedef enum passpolicyerror_enum {
02280        PP_passwordExpired = 0,
02281        PP_accountLocked = 1,
02282        PP_changeAfterReset = 2,
02283        PP_passwordModNotAllowed = 3,
02284        PP_mustSupplyOldPassword = 4,
02285        PP_insufficientPasswordQuality = 5,
02286        PP_passwordTooShort = 6,
02287        PP_passwordTooYoung = 7,
02288        PP_passwordInHistory = 8,
02289        PP_noError = 65535
02290 } LDAPPasswordPolicyError;
02291 
02292 LDAP_F( int )
02293 ldap_create_passwordpolicy_control LDAP_P((
02294         LDAP *ld,
02295         LDAPControl **ctrlp ));
02296 
02297 LDAP_F( int )
02298 ldap_parse_passwordpolicy_control LDAP_P((
02299         LDAP *ld,
02300         LDAPControl *ctrl,
02301         ber_int_t *expirep,
02302         ber_int_t *gracep,
02303         LDAPPasswordPolicyError *errorp ));
02304 
02305 LDAP_F( const char * )
02306 ldap_passwordpolicy_err2txt LDAP_P(( LDAPPasswordPolicyError ));
02307 #endif /* LDAP_CONTROL_PASSWORDPOLICYREQUEST */
02308 
02309 /*
02310  * LDAP Dynamic Directory Services Refresh -- RFC 2589
02311  *     in dds.c
02312  */
02313 #define LDAP_API_FEATURE_REFRESH 1000
02314 
02315 LDAP_F( int )
02316 ldap_parse_refresh LDAP_P((
02317        LDAP *ld,
02318        LDAPMessage *res,
02319        ber_int_t *newttl ));
02320 
02321 LDAP_F( int )
02322 ldap_refresh LDAP_P(( LDAP *ld,
02323        struct berval *dn,
02324        ber_int_t ttl,
02325        LDAPControl          **sctrls,
02326        LDAPControl          **cctrls,
02327        int                         *msgidp ));
02328 
02329 LDAP_F( int )
02330 ldap_refresh_s LDAP_P((
02331        LDAP *ld,
02332        struct berval *dn,
02333        ber_int_t ttl,
02334        ber_int_t *newttl,
02335        LDAPControl **sctrls,
02336        LDAPControl **cctrls ));
02337 
02338 /*
02339  * LDAP Transactions
02340  */
02341 #ifdef LDAP_X_TXN
02342 LDAP_F( int )
02343 ldap_txn_start LDAP_P(( LDAP *ld,
02344        LDAPControl          **sctrls,
02345        LDAPControl          **cctrls,
02346        int                         *msgidp ));
02347 
02348 LDAP_F( int )
02349 ldap_txn_start_s LDAP_P(( LDAP *ld,
02350        LDAPControl **sctrl,
02351        LDAPControl **cctrl,
02352        struct berval **rettxnid ));
02353 
02354 LDAP_F( int )
02355 ldap_txn_end LDAP_P(( LDAP *ld,
02356        int    commit,
02357        struct berval *txnid,
02358        LDAPControl          **sctrls,
02359        LDAPControl          **cctrls,
02360        int                         *msgidp ));
02361 
02362 LDAP_F( int )
02363 ldap_txn_end_s LDAP_P(( LDAP *ld,
02364        int    commit,
02365        struct berval *txnid,
02366        LDAPControl **sctrl,
02367        LDAPControl **cctrl,
02368        int *retidp ));
02369 #endif
02370 
02371 /*
02372  * in ldap_sync.c
02373  */
02374 
02375 /*
02376  * initialize the persistent search structure
02377  */
02378 LDAP_F( ldap_sync_t * )
02379 ldap_sync_initialize LDAP_P((
02380        ldap_sync_t   *ls ));
02381 
02382 /*
02383  * destroy the persistent search structure
02384  */
02385 LDAP_F( void )
02386 ldap_sync_destroy LDAP_P((
02387        ldap_sync_t   *ls,
02388        int           freeit ));
02389 
02390 /*
02391  * initialize a refreshOnly sync
02392  */
02393 LDAP_F( int )
02394 ldap_sync_init LDAP_P((
02395        ldap_sync_t   *ls,
02396        int           mode ));
02397 
02398 /*
02399  * initialize a refreshOnly sync
02400  */
02401 LDAP_F( int )
02402 ldap_sync_init_refresh_only LDAP_P((
02403        ldap_sync_t   *ls ));
02404 
02405 /*
02406  * initialize a refreshAndPersist sync
02407  */
02408 LDAP_F( int )
02409 ldap_sync_init_refresh_and_persist LDAP_P((
02410        ldap_sync_t   *ls ));
02411 
02412 /*
02413  * poll for new responses
02414  */
02415 LDAP_F( int )
02416 ldap_sync_poll LDAP_P((
02417        ldap_sync_t   *ls ));
02418 
02419 #ifdef LDAP_CONTROL_X_SESSION_TRACKING
02420 
02421 /*
02422  * in stctrl.c
02423  */
02424 LDAP_F( int )
02425 ldap_create_session_tracking_value LDAP_P((
02426        LDAP          *ld,
02427        char          *sessionSourceIp,
02428        char          *sessionSourceName,
02429        char          *formatOID,
02430        struct berval *sessionTrackingIdentifier,
02431        struct berval *value ));
02432 
02433 LDAP_F( int )
02434 ldap_create_session_tracking LDAP_P((
02435        LDAP          *ld,
02436        char          *sessionSourceIp,
02437        char          *sessionSourceName,
02438        char          *formatOID,
02439        struct berval *sessionTrackingIdentifier,
02440        LDAPControl   **ctrlp ));
02441 
02442 LDAP_F( int )
02443 ldap_parse_session_tracking_control LDAP_P((
02444        LDAP *ld,
02445        LDAPControl *ctrl,
02446        struct berval *ip,
02447        struct berval *name,
02448        struct berval *oid,
02449        struct berval *id ));
02450 
02451 #endif /* LDAP_CONTROL_X_SESSION_TRACKING */
02452 
02453 /*
02454  * in assertion.c
02455  */
02456 LDAP_F (int)
02457 ldap_create_assertion_control_value LDAP_P((
02458        LDAP          *ld,
02459        char          *assertion,
02460        struct berval *value ));
02461 
02462 LDAP_F( int )
02463 ldap_create_assertion_control LDAP_P((
02464        LDAP          *ld,
02465        char          *filter,
02466        int           iscritical,
02467        LDAPControl   **ctrlp ));
02468 
02469 /*
02470  * in deref.c
02471  */
02472 
02473 typedef struct LDAPDerefSpec {
02474        char *derefAttr;
02475        char **attributes;
02476 } LDAPDerefSpec;
02477 
02478 typedef struct LDAPDerefVal {
02479        char *type;
02480        BerVarray vals;
02481        struct LDAPDerefVal *next;
02482 } LDAPDerefVal;
02483 
02484 typedef struct LDAPDerefRes {
02485        char *derefAttr;
02486        struct berval derefVal;
02487        LDAPDerefVal *attrVals;
02488        struct LDAPDerefRes *next;
02489 } LDAPDerefRes;
02490 
02491 LDAP_F( int )
02492 ldap_create_deref_control_value LDAP_P((
02493        LDAP *ld,
02494        LDAPDerefSpec *ds,
02495        struct berval *value ));
02496 
02497 LDAP_F( int )
02498 ldap_create_deref_control LDAP_P((
02499        LDAP          *ld,
02500        LDAPDerefSpec *ds,
02501        int           iscritical,
02502        LDAPControl   **ctrlp ));
02503 
02504 LDAP_F( void )
02505 ldap_derefresponse_free LDAP_P((
02506        LDAPDerefRes *dr ));
02507 
02508 LDAP_F( int )
02509 ldap_parse_derefresponse_control LDAP_P((
02510        LDAP *ld,
02511        LDAPControl *ctrl,
02512        LDAPDerefRes **drp ));
02513 
02514 LDAP_F( int )
02515 ldap_parse_deref_control LDAP_P((
02516        LDAP          *ld,
02517        LDAPControl   **ctrls,
02518        LDAPDerefRes  **drp ));
02519 
02520 LDAP_END_DECL
02521 #endif /* _LDAP_H */