ldap.h 72 KB

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