jwawinldap.pas 107 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782
  1. {******************************************************************************}
  2. { }
  3. { LDAP Client 32 API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: winldap.h, released August 1999. The original Pascal }
  9. { code is: WinLDAP.pas, released December 1998. The initial developer of the }
  10. { Pascal code is Luk Vermeulen (lvermeulen att seria dott com). }
  11. { }
  12. { Portions created by Luk Vermeulen are Copyright (C) 1998 Luk Vermeulen. }
  13. { Portions created by Rudy Velthuis are Copyright (C) 2000 Rudy Velthuis. }
  14. { Portions created by M. van Brakel are Copyright (C) 2001 Marcel van Brakel. }
  15. { }
  16. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  17. { }
  18. { You may retrieve the latest version of this file at the Project JEDI }
  19. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  20. { }
  21. { The contents of this file are used with permission, subject to the Mozilla }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html }
  25. { }
  26. { Software distributed under the License is distributed on an "AS IS" basis, }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License. }
  29. { }
  30. {******************************************************************************}
  31. // $Id: JwaWinLDAP.pas,v 1.9 2007/09/14 06:48:48 marquardt Exp $
  32. {$IFNDEF JWA_OMIT_SECTIONS}
  33. unit JwaWinLDAP;
  34. {$WEAKPACKAGEUNIT}
  35. {$I jediapilib.inc}
  36. interface
  37. uses
  38. Windows;
  39. {$ENDIF JWA_OMIT_SECTIONS}
  40. {$IFNDEF JWA_IMPLEMENTATIONSECTION}
  41. {$HPPEMIT '#ifndef LDAP_CLIENT_DEFINED'}
  42. {$HPPEMIT '#pragma option push -b -a8 -pc -A- /*P_O_Push_S*/'}
  43. {$HPPEMIT '#define LDAP_CLIENT_DEFINED'}
  44. {$HPPEMIT '#ifndef BASETYPES'}
  45. {$HPPEMIT '#include <windef.h>'}
  46. {$HPPEMIT '#endif'}
  47. (*
  48. Copyright (c) 1996-1999 Microsoft Corporation
  49. Module Name:
  50. winldap.h LDAP client 32 API header file
  51. Abstract:
  52. This module is the header file for the 32 bit LDAP client API for
  53. Windows NT and Windows 95. This API is based on RFC 1823 with some
  54. enhancements for LDAP v3.
  55. Notes about Unicode support :
  56. If you have UNICODE defined at compile time, you'll pull in the unicode
  57. versions of the calls. Note that your executable may then not work with
  58. other implementations of the LDAP API that don't support Unicode. If
  59. UNICODE is not defined, then we define the LDAP calls without the trailing
  60. 'A'(as in ldap_bind rather than ldap_bindA)so that your app may work
  61. with other implementations that don't support Unicode.
  62. The import library has all three forms of the call present... ldap_bindW,
  63. ldap_bindA, and ldap_bind. ldap_bindA simply calls ldap_bind. ldap_bind
  64. simply converts the arguments to unicode and calls ldap_bindW. The
  65. reason this is done is because we have to put UTF-8 on the wire, so if
  66. we converted from Unicode to single byte, we'd loose information. Since
  67. all core processing is done in Unicode, nothing is lost.
  68. Updates :
  69. 11/01/96 Modified for new API RFC draft.
  70. Environments :
  71. Win32 user mode
  72. *)
  73. // Extra defines to keep compiler happy.
  74. type
  75. PPCharA = ^PAnsiChar;
  76. {$NODEFINE PPCharA}
  77. PPCharW = ^PWideChar;
  78. {$NODEFINE PPCharW}
  79. {$IFNDEF JWA_INCLUDEMODE}
  80. PPChar = PPCharA;
  81. {$ENDIF JWA_INCLUDEMODE}
  82. PPPCharA = ^PPCharA;
  83. {$NODEFINE PPPCharA}
  84. PPPCharW = ^PPCharW;
  85. {$NODEFINE PPPCharW}
  86. PPPChar = PPPCharA;
  87. //
  88. // The #define LDAP_UNICODE controls if we map the undecorated calls to
  89. // their unicode counterparts or just leave them defined as the normal
  90. // single byte entry points.
  91. //
  92. // If you want to write a UNICODE enabled application, you'd normally
  93. // just have UNICODE defined and then we'll default to using all LDAP
  94. // Unicode calls.
  95. //
  96. const
  97. //
  98. // Global constants
  99. //
  100. {$EXTERNALSYM LDAP_PORT}
  101. LDAP_PORT = 389;
  102. {$EXTERNALSYM LDAP_SSL_PORT}
  103. LDAP_SSL_PORT = 636;
  104. {$EXTERNALSYM LDAP_GC_PORT}
  105. LDAP_GC_PORT = 3268;
  106. {$EXTERNALSYM LDAP_SSL_GC_PORT}
  107. LDAP_SSL_GC_PORT = 3269;
  108. //
  109. // We currently support going to either v2 or v3 servers, though the API
  110. // is only a V2 API. We'll add support for result sets, server side
  111. // sorting, extended operations, etc as soon as they stabilize.
  112. //
  113. {$EXTERNALSYM LDAP_VERSION1}
  114. LDAP_VERSION1 = 1;
  115. {$EXTERNALSYM LDAP_VERSION2}
  116. LDAP_VERSION2 = 2;
  117. {$EXTERNALSYM LDAP_VERSION3}
  118. LDAP_VERSION3 = 3;
  119. {$EXTERNALSYM LDAP_VERSION}
  120. LDAP_VERSION = LDAP_VERSION2;
  121. //
  122. // All tags are CCFTTTTT.
  123. // CC Tag Class 00 = universal
  124. // 01 = application wide
  125. // 10 = context specific
  126. // 11 = private use
  127. //
  128. // F Form 0 primitive
  129. // 1 constructed
  130. //
  131. // TTTTT Tag Number
  132. //
  133. //
  134. // LDAP v2 & v3 commands.
  135. //
  136. {$EXTERNALSYM LDAP_BIND_CMD}
  137. LDAP_BIND_CMD = $60; // application + constructed
  138. {$EXTERNALSYM LDAP_UNBIND_CMD}
  139. LDAP_UNBIND_CMD = $42; // application + primitive
  140. {$EXTERNALSYM LDAP_SEARCH_CMD}
  141. LDAP_SEARCH_CMD = $63; // application + constructed
  142. {$EXTERNALSYM LDAP_MODIFY_CMD}
  143. LDAP_MODIFY_CMD = $66; // application + constructed
  144. {$EXTERNALSYM LDAP_ADD_CMD}
  145. LDAP_ADD_CMD = $68; // application + constructed
  146. {$EXTERNALSYM LDAP_DELETE_CMD}
  147. LDAP_DELETE_CMD = $4a; // application + primitive
  148. {$EXTERNALSYM LDAP_MODRDN_CMD}
  149. LDAP_MODRDN_CMD = $6c; // application + constructed
  150. {$EXTERNALSYM LDAP_COMPARE_CMD}
  151. LDAP_COMPARE_CMD = $6e; // application + constructed
  152. {$EXTERNALSYM LDAP_ABANDON_CMD}
  153. LDAP_ABANDON_CMD = $50; // application + primitive
  154. {$EXTERNALSYM LDAP_SESSION_CMD}
  155. LDAP_SESSION_CMD = $71; // application + constructed
  156. {$EXTERNALSYM LDAP_EXTENDED_CMD}
  157. LDAP_EXTENDED_CMD = $77; // application + constructed
  158. //
  159. // Responses/Results for LDAP v2 & v3
  160. //
  161. {$EXTERNALSYM LDAP_RES_BIND}
  162. LDAP_RES_BIND = $61; // application + constructed
  163. {$EXTERNALSYM LDAP_RES_SEARCH_ENTRY}
  164. LDAP_RES_SEARCH_ENTRY = $64; // application + constructed
  165. {$EXTERNALSYM LDAP_RES_SEARCH_RESULT}
  166. LDAP_RES_SEARCH_RESULT = $65; // application + constructed
  167. {$EXTERNALSYM LDAP_RES_MODIFY}
  168. LDAP_RES_MODIFY = $67; // application + constructed
  169. {$EXTERNALSYM LDAP_RES_ADD}
  170. LDAP_RES_ADD = $69; // application + constructed
  171. {$EXTERNALSYM LDAP_RES_DELETE}
  172. LDAP_RES_DELETE = $6b; // application + constructed
  173. {$EXTERNALSYM LDAP_RES_MODRDN}
  174. LDAP_RES_MODRDN = $6d; // application + constructed
  175. {$EXTERNALSYM LDAP_RES_COMPARE}
  176. LDAP_RES_COMPARE = $6f; // application + constructed
  177. {$EXTERNALSYM LDAP_RES_SESSION}
  178. LDAP_RES_SESSION = $72; // application + constructed
  179. {$EXTERNALSYM LDAP_RES_REFERRAL}
  180. LDAP_RES_REFERRAL = $73; // application + constructed
  181. {$EXTERNALSYM LDAP_RES_EXTENDED}
  182. LDAP_RES_EXTENDED = $78; // application + constructed
  183. {$EXTERNALSYM LDAP_RES_ANY}
  184. LDAP_RES_ANY = -1;
  185. {$EXTERNALSYM LDAP_INVALID_CMD}
  186. LDAP_INVALID_CMD = $FF;
  187. {$EXTERNALSYM LDAP_INVALID_RES}
  188. LDAP_INVALID_RES = $FF;
  189. //
  190. // We'll make the error codes compatible with reference implementation
  191. //
  192. type
  193. {$EXTERNALSYM LDAP_RETCODE}
  194. LDAP_RETCODE = ULONG;
  195. const
  196. {$EXTERNALSYM LDAP_SUCCESS}
  197. LDAP_SUCCESS = $00;
  198. {$EXTERNALSYM LDAP_OPERATIONS_ERROR}
  199. LDAP_OPERATIONS_ERROR = $01;
  200. {$EXTERNALSYM LDAP_PROTOCOL_ERROR}
  201. LDAP_PROTOCOL_ERROR = $02;
  202. {$EXTERNALSYM LDAP_TIMELIMIT_EXCEEDED}
  203. LDAP_TIMELIMIT_EXCEEDED = $03;
  204. {$EXTERNALSYM LDAP_SIZELIMIT_EXCEEDED}
  205. LDAP_SIZELIMIT_EXCEEDED = $04;
  206. {$EXTERNALSYM LDAP_COMPARE_FALSE}
  207. LDAP_COMPARE_FALSE = $05;
  208. {$EXTERNALSYM LDAP_COMPARE_TRUE}
  209. LDAP_COMPARE_TRUE = $06;
  210. {$EXTERNALSYM LDAP_AUTH_METHOD_NOT_SUPPORTED}
  211. LDAP_AUTH_METHOD_NOT_SUPPORTED = $07;
  212. {$EXTERNALSYM LDAP_STRONG_AUTH_REQUIRED}
  213. LDAP_STRONG_AUTH_REQUIRED = $08;
  214. {$EXTERNALSYM LDAP_REFERRAL_V2}
  215. LDAP_REFERRAL_V2 = $09;
  216. {$EXTERNALSYM LDAP_PARTIAL_RESULTS}
  217. LDAP_PARTIAL_RESULTS = $09;
  218. {$EXTERNALSYM LDAP_REFERRAL}
  219. LDAP_REFERRAL = $0a;
  220. {$EXTERNALSYM LDAP_ADMIN_LIMIT_EXCEEDED}
  221. LDAP_ADMIN_LIMIT_EXCEEDED = $0b;
  222. {$EXTERNALSYM LDAP_UNAVAILABLE_CRIT_EXTENSION}
  223. LDAP_UNAVAILABLE_CRIT_EXTENSION = $0c;
  224. {$EXTERNALSYM LDAP_CONFIDENTIALITY_REQUIRED}
  225. LDAP_CONFIDENTIALITY_REQUIRED = $0d;
  226. {$EXTERNALSYM LDAP_SASL_BIND_IN_PROGRESS}
  227. LDAP_SASL_BIND_IN_PROGRESS = $0e;
  228. {$EXTERNALSYM LDAP_NO_SUCH_ATTRIBUTE}
  229. LDAP_NO_SUCH_ATTRIBUTE = $10;
  230. {$EXTERNALSYM LDAP_UNDEFINED_TYPE}
  231. LDAP_UNDEFINED_TYPE = $11;
  232. {$EXTERNALSYM LDAP_INAPPROPRIATE_MATCHING}
  233. LDAP_INAPPROPRIATE_MATCHING = $12;
  234. {$EXTERNALSYM LDAP_CONSTRAINT_VIOLATION}
  235. LDAP_CONSTRAINT_VIOLATION = $13;
  236. {$EXTERNALSYM LDAP_ATTRIBUTE_OR_VALUE_EXISTS}
  237. LDAP_ATTRIBUTE_OR_VALUE_EXISTS = $14;
  238. {$EXTERNALSYM LDAP_INVALID_SYNTAX}
  239. LDAP_INVALID_SYNTAX = $15;
  240. {$EXTERNALSYM LDAP_NO_SUCH_OBJECT}
  241. LDAP_NO_SUCH_OBJECT = $20;
  242. {$EXTERNALSYM LDAP_ALIAS_PROBLEM}
  243. LDAP_ALIAS_PROBLEM = $21;
  244. {$EXTERNALSYM LDAP_INVALID_DN_SYNTAX}
  245. LDAP_INVALID_DN_SYNTAX = $22;
  246. {$EXTERNALSYM LDAP_IS_LEAF}
  247. LDAP_IS_LEAF = $23;
  248. {$EXTERNALSYM LDAP_ALIAS_DEREF_PROBLEM}
  249. LDAP_ALIAS_DEREF_PROBLEM = $24;
  250. {$EXTERNALSYM LDAP_INAPPROPRIATE_AUTH}
  251. LDAP_INAPPROPRIATE_AUTH = $30;
  252. {$EXTERNALSYM LDAP_INVALID_CREDENTIALS}
  253. LDAP_INVALID_CREDENTIALS = $31;
  254. {$EXTERNALSYM LDAP_INSUFFICIENT_RIGHTS}
  255. LDAP_INSUFFICIENT_RIGHTS = $32;
  256. {$EXTERNALSYM LDAP_BUSY}
  257. LDAP_BUSY = $33;
  258. {$EXTERNALSYM LDAP_UNAVAILABLE}
  259. LDAP_UNAVAILABLE = $34;
  260. {$EXTERNALSYM LDAP_UNWILLING_TO_PERFORM}
  261. LDAP_UNWILLING_TO_PERFORM = $35;
  262. {$EXTERNALSYM LDAP_LOOP_DETECT}
  263. LDAP_LOOP_DETECT = $36;
  264. {$EXTERNALSYM LDAP_NAMING_VIOLATION}
  265. LDAP_NAMING_VIOLATION = $40;
  266. {$EXTERNALSYM LDAP_OBJECT_CLASS_VIOLATION}
  267. LDAP_OBJECT_CLASS_VIOLATION = $41;
  268. {$EXTERNALSYM LDAP_NOT_ALLOWED_ON_NONLEAF}
  269. LDAP_NOT_ALLOWED_ON_NONLEAF = $42;
  270. {$EXTERNALSYM LDAP_NOT_ALLOWED_ON_RDN}
  271. LDAP_NOT_ALLOWED_ON_RDN = $43;
  272. {$EXTERNALSYM LDAP_ALREADY_EXISTS}
  273. LDAP_ALREADY_EXISTS = $44;
  274. {$EXTERNALSYM LDAP_NO_OBJECT_CLASS_MODS}
  275. LDAP_NO_OBJECT_CLASS_MODS = $45;
  276. {$EXTERNALSYM LDAP_RESULTS_TOO_LARGE}
  277. LDAP_RESULTS_TOO_LARGE = $46;
  278. {$EXTERNALSYM LDAP_AFFECTS_MULTIPLE_DSAS}
  279. LDAP_AFFECTS_MULTIPLE_DSAS = $47;
  280. {$EXTERNALSYM LDAP_OTHER}
  281. LDAP_OTHER = $50;
  282. {$EXTERNALSYM LDAP_SERVER_DOWN}
  283. LDAP_SERVER_DOWN = $51;
  284. {$EXTERNALSYM LDAP_LOCAL_ERROR}
  285. LDAP_LOCAL_ERROR = $52;
  286. {$EXTERNALSYM LDAP_ENCODING_ERROR}
  287. LDAP_ENCODING_ERROR = $53;
  288. {$EXTERNALSYM LDAP_DECODING_ERROR}
  289. LDAP_DECODING_ERROR = $54;
  290. {$EXTERNALSYM LDAP_TIMEOUT}
  291. LDAP_TIMEOUT = $55;
  292. {$EXTERNALSYM LDAP_AUTH_UNKNOWN}
  293. LDAP_AUTH_UNKNOWN = $56;
  294. {$EXTERNALSYM LDAP_FILTER_ERROR}
  295. LDAP_FILTER_ERROR = $57;
  296. {$EXTERNALSYM LDAP_USER_CANCELLED}
  297. LDAP_USER_CANCELLED = $58;
  298. {$EXTERNALSYM LDAP_PARAM_ERROR}
  299. LDAP_PARAM_ERROR = $59;
  300. {$EXTERNALSYM LDAP_NO_MEMORY}
  301. LDAP_NO_MEMORY = $5a;
  302. {$EXTERNALSYM LDAP_CONNECT_ERROR}
  303. LDAP_CONNECT_ERROR = $5b;
  304. {$EXTERNALSYM LDAP_NOT_SUPPORTED}
  305. LDAP_NOT_SUPPORTED = $5c;
  306. {$EXTERNALSYM LDAP_NO_RESULTS_RETURNED}
  307. LDAP_NO_RESULTS_RETURNED = $5e;
  308. {$EXTERNALSYM LDAP_CONTROL_NOT_FOUND}
  309. LDAP_CONTROL_NOT_FOUND = $5d;
  310. {$EXTERNALSYM LDAP_MORE_RESULTS_TO_RETURN}
  311. LDAP_MORE_RESULTS_TO_RETURN = $5f;
  312. {$EXTERNALSYM LDAP_CLIENT_LOOP}
  313. LDAP_CLIENT_LOOP = $60;
  314. {$EXTERNALSYM LDAP_REFERRAL_LIMIT_EXCEEDED}
  315. LDAP_REFERRAL_LIMIT_EXCEEDED = $61;
  316. //
  317. // Bind methods. We support the following methods :
  318. //
  319. // Simple Clear text password... try not to use as it's not secure.
  320. //
  321. // MSN MSN(Microsoft Network)authentication. This package
  322. // may bring up UI to prompt the user for MSN credentials.
  323. //
  324. // DPA Normandy authentication... new MSN authentication. Same
  325. // usage as MSN.
  326. //
  327. // NTLM NT domain authentication. Use NULL credentials and
  328. // we'll try to use default logged in user credentials.
  329. //
  330. // Sicily Negotiate with the server for any of: MSN, DPA, NTLM
  331. //
  332. // SSPI Use GSSAPI Negotiate package to negotiate security
  333. // package of either Kerberos v5 or NTLM(or any other
  334. // package the client and server negotiate). Pass in
  335. // NULL credentials to specify default logged in user or
  336. // you may pass in a SEC_WINNT_AUTH_IDENTITY_W(defined
  337. // in rpcdce.h)to specify alternate credentials.
  338. //
  339. // For all bind methods except for Simple, you may pass in a
  340. // SEC_WINNT_AUTH_IDENTITY_W (defined in rpcdce.h) or the newer
  341. // SEC_WINNT_AUTH_IDENTITY_EXW (defined in secext.h) to specify alternate
  342. // credentials.
  343. //
  344. // All bind methods other than simple are synchronous only calls.
  345. // Calling the asynchronous bind call for any of these messages will
  346. // return LDAP_PARAM_ERROR.
  347. //
  348. // Using any other method besides simple will cause WLDAP32 to pull in
  349. // the SSPI security DLLs(SECURITY.DLL etc).
  350. //
  351. // On NTLM and SSPI, if you specify NULL credentials, we'll attempt to use
  352. // the default logged in user.
  353. //
  354. const
  355. {$EXTERNALSYM LDAP_AUTH_SIMPLE}
  356. LDAP_AUTH_SIMPLE = $80;
  357. {$EXTERNALSYM LDAP_AUTH_SASL}
  358. LDAP_AUTH_SASL = $83;
  359. {$EXTERNALSYM LDAP_AUTH_OTHERKIND}
  360. LDAP_AUTH_OTHERKIND = $86;
  361. // The SICILY type covers package negotiation to MSN servers.
  362. // Each of the supported types can also be specified without
  363. // doing the package negotiation, assuming the caller knows
  364. // what the server supports.
  365. {$EXTERNALSYM LDAP_AUTH_SICILY}
  366. LDAP_AUTH_SICILY = LDAP_AUTH_OTHERKIND or $0200;
  367. {$EXTERNALSYM LDAP_AUTH_MSN}
  368. LDAP_AUTH_MSN = LDAP_AUTH_OTHERKIND or $0800;
  369. {$EXTERNALSYM LDAP_AUTH_NTLM}
  370. LDAP_AUTH_NTLM = LDAP_AUTH_OTHERKIND or $1000;
  371. {$EXTERNALSYM LDAP_AUTH_DPA}
  372. LDAP_AUTH_DPA = LDAP_AUTH_OTHERKIND or $2000;
  373. // This will cause the client to use the GSSAPI negotiation
  374. // package to determine the most appropriate authentication type.
  375. // This type should be used when talking to NT5.
  376. {$EXTERNALSYM LDAP_AUTH_NEGOTIATE}
  377. LDAP_AUTH_NEGOTIATE = LDAP_AUTH_OTHERKIND or $0400;
  378. // backward compatible #define for older constant name.
  379. {$EXTERNALSYM LDAP_AUTH_SSPI}
  380. LDAP_AUTH_SSPI = LDAP_AUTH_NEGOTIATE;
  381. //
  382. // Client applications typically don't have to encode/decode LDAP filters,
  383. // but if they do, we define the operators here.
  384. //
  385. // Filter types.
  386. {$EXTERNALSYM LDAP_FILTER_AND}
  387. LDAP_FILTER_AND = $a0; // context specific + constructed - SET OF Filters.
  388. {$EXTERNALSYM LDAP_FILTER_OR}
  389. LDAP_FILTER_OR = $a1; // context specific + constructed - SET OF Filters.
  390. {$EXTERNALSYM LDAP_FILTER_NOT}
  391. LDAP_FILTER_NOT = $a2; // context specific + constructed - Filter
  392. {$EXTERNALSYM LDAP_FILTER_EQUALITY}
  393. LDAP_FILTER_EQUALITY = $a3; // context specific + constructed - AttributeValueAssertion.
  394. {$EXTERNALSYM LDAP_FILTER_SUBSTRINGS}
  395. LDAP_FILTER_SUBSTRINGS = $a4; // context specific + constructed - SubstringFilter
  396. {$EXTERNALSYM LDAP_FILTER_GE}
  397. LDAP_FILTER_GE = $a5; // context specific + constructed - AttributeValueAssertion.
  398. {$EXTERNALSYM LDAP_FILTER_LE}
  399. LDAP_FILTER_LE = $a6; // context specific + constructed - AttributeValueAssertion.
  400. {$EXTERNALSYM LDAP_FILTER_PRESENT}
  401. LDAP_FILTER_PRESENT = $87; // context specific + primitive - AttributeType.
  402. {$EXTERNALSYM LDAP_FILTER_APPROX}
  403. LDAP_FILTER_APPROX = $a8; // context specific + constructed - AttributeValueAssertion.
  404. {$EXTERNALSYM LDAP_FILTER_EXTENSIBLE}
  405. LDAP_FILTER_EXTENSIBLE = $a9; // context specific + constructed - MatchingRuleAssertion.
  406. // Substring filter types
  407. {$EXTERNALSYM LDAP_SUBSTRING_INITIAL}
  408. LDAP_SUBSTRING_INITIAL = $80; // class context specific
  409. {$EXTERNALSYM LDAP_SUBSTRING_ANY}
  410. LDAP_SUBSTRING_ANY = $81; // class context specific
  411. {$EXTERNALSYM LDAP_SUBSTRING_FINAL}
  412. LDAP_SUBSTRING_FINAL = $82; // class context specific
  413. //
  414. // Possible values for ld_deref field.
  415. // "Never" - never deref aliases. return only the alias.
  416. // "Searching" - only deref aliases when searching, not when locating
  417. // the base object of a search.
  418. // "Finding" - dereference the alias when locating the base object but
  419. // not during a search.
  420. // "Always" - always dereference aliases.
  421. //
  422. {$EXTERNALSYM LDAP_DEREF_NEVER}
  423. LDAP_DEREF_NEVER = 0;
  424. {$EXTERNALSYM LDAP_DEREF_SEARCHING}
  425. LDAP_DEREF_SEARCHING = 1;
  426. {$EXTERNALSYM LDAP_DEREF_FINDING}
  427. LDAP_DEREF_FINDING = 2;
  428. {$EXTERNALSYM LDAP_DEREF_ALWAYS}
  429. LDAP_DEREF_ALWAYS = 3;
  430. // Special values for ld_sizelimit :
  431. {$EXTERNALSYM LDAP_NO_LIMIT}
  432. LDAP_NO_LIMIT = 0;
  433. // Flags for ld_options field :
  434. {$EXTERNALSYM LDAP_OPT_DNS}
  435. LDAP_OPT_DNS = $00000001; // utilize DN & DNS
  436. {$EXTERNALSYM LDAP_OPT_CHASE_REFERRALS}
  437. LDAP_OPT_CHASE_REFERRALS = $00000002; // chase referrals
  438. {$EXTERNALSYM LDAP_OPT_RETURN_REFS}
  439. LDAP_OPT_RETURN_REFS = $00000004; // return referrals to calling app
  440. //
  441. // LDAP structure per connection
  442. //
  443. {$HPPEMIT '#pragma pack(push, 4)'}
  444. {$ALIGN ON}
  445. type
  446. {$EXTERNALSYM PLDAP}
  447. PLDAP = ^LDAP;
  448. {$EXTERNALSYM LDAP}
  449. LDAP = record
  450. ld_sb: record
  451. sb_sd: ULONG;
  452. Reserved1: array [0..10*SizeOf(ULONG)] of Byte;
  453. sb_naddr: ULONG; // notzero implies CLDAP available
  454. Reserved2: array [0..6*SizeOf(ULONG)-1] of Byte;
  455. end;
  456. //
  457. // Following parameters MAY match up to reference implementation of LDAP
  458. //
  459. ld_host: PChar;
  460. ld_version: ULONG;
  461. ld_lberoptions: Byte;
  462. //
  463. // Safe to assume that these parameters are in same location as
  464. // reference implementation of LDAP API.
  465. //
  466. ld_deref: ULONG;
  467. ld_timelimit: ULONG;
  468. ld_sizelimit: ULONG;
  469. ld_errno: ULONG;
  470. ld_matched: PChar;
  471. ld_error: PChar;
  472. ld_msgid: ULONG;
  473. Reserved3: array [0..6*SizeOf(ULONG)] of Byte;
  474. //
  475. // Following parameters may match up to reference implementation of LDAP API.
  476. //
  477. ld_cldaptries: ULONG;
  478. ld_cldaptimeout: ULONG;
  479. ld_refhoplimit: ULONG;
  480. ld_options: ULONG;
  481. end;
  482. //
  483. // Our timeval structure is a bit different from the reference implementation
  484. // since Win32 defines a _timeval structure that is different from the LDAP
  485. // one.
  486. //
  487. PLDAPTimeVal = ^TLDAPTimeVal;
  488. {$EXTERNALSYM l_timeval}
  489. l_timeval = packed record
  490. tv_sec: Longint;
  491. tv_usec: Longint;
  492. end;
  493. {$EXTERNALSYM LDAP_TIMEVAL}
  494. LDAP_TIMEVAL = l_timeval;
  495. {$EXTERNALSYM PLDAP_TIMEVAL}
  496. PLDAP_TIMEVAL = ^LDAP_TIMEVAL;
  497. TLDAPTimeVal = l_timeval;
  498. //
  499. // The berval structure is used to pass in any arbitrary octet string. It
  500. // is useful for attributes that cannot be represented using a null
  501. // terminated string.
  502. //
  503. PLDAPBerVal = ^TLDAPBerVal;
  504. PPLDAPBerVal = ^PLDAPBerVal;
  505. {$EXTERNALSYM PLDAP_BERVAL}
  506. PLDAP_BERVAL = ^berval;
  507. {$EXTERNALSYM PBERVAL}
  508. PBERVAL = ^berval;
  509. {$EXTERNALSYM berval}
  510. berval = record
  511. bv_len: ULONG;
  512. bv_val: PChar;
  513. end;
  514. {$EXTERNALSYM LDAP_BERVAL}
  515. LDAP_BERVAL = berval;
  516. TLDAPBerVal = berval;
  517. //
  518. // The following structure has to be compatible with reference implementation.
  519. //
  520. PPLDAPMessage = ^PLDAPMessage;
  521. {$EXTERNALSYM PLDAPMessage}
  522. PLDAPMessage = ^LDAPMessage;
  523. {$EXTERNALSYM ldapmsg}
  524. ldapmsg = record
  525. lm_msgid: ULONG; // message number for given connection
  526. lm_msgtype: ULONG; // message type of the form LDAP_RES_xxx
  527. lm_ber: Pointer; // ber form of message
  528. lm_chain: PLDAPMessage; // pointer to next result value
  529. lm_next: PLDAPMessage; // pointer to next message
  530. lm_time: ULONG;
  531. //
  532. // new fields below not in reference implementation
  533. //
  534. Connection: PLDAP; // connection from which we received response
  535. Request: Pointer; // owning request(opaque structure)
  536. lm_returncode: ULONG; // server's return code
  537. lm_referral: Word; // index of referral within ref table
  538. lm_chased: ByteBool; // has referral been chased already?
  539. lm_eom: ByteBool; // is this the last entry for this message?
  540. ConnectionReferenced: ByteBool; // is the Connection still valid?
  541. end;
  542. {$EXTERNALSYM LDAPMessage}
  543. LDAPMessage = ldapmsg;
  544. //
  545. // Controls... there are three types :
  546. //
  547. // 1) those passed to the server
  548. // 2) those passed to the client and handled by the client API
  549. // 3) those returned by the server
  550. //
  551. // Extra types defined for use as parameter.
  552. PPPLDAPControlA = ^PPLDAPControlA;
  553. {$NODEFINE PPPLDAPControlA}
  554. PPPLDAPControlW = ^PPLDAPControlW;
  555. {$NODEFINE PPPLDAPControlW}
  556. PPPLDAPControl = PPPLDAPControlA;
  557. PPLDAPControlA = ^PLDAPControlA;
  558. {$NODEFINE PPLDAPControlA}
  559. PPLDAPControlW = ^PLDAPControlW;
  560. {$NODEFINE PPLDAPControlW}
  561. PPLDAPControl = PPLDAPControlA;
  562. {$EXTERNALSYM PLDAPControlA}
  563. PLDAPControlA = ^LDAPControlA;
  564. {$EXTERNALSYM PLDAPControlW}
  565. PLDAPControlW = ^LDAPControlW;
  566. {$EXTERNALSYM PLDAPControl}
  567. PLDAPControl = PLDAPControlA;
  568. {$EXTERNALSYM LDAPControlA}
  569. LDAPControlA = record
  570. ldctl_oid: PAnsiChar;
  571. ldctl_value: TLDAPBerVal;
  572. ldctl_iscritical: ByteBool;
  573. end;
  574. {$EXTERNALSYM LDAPControlW}
  575. LDAPControlW = record
  576. ldctl_oid: PWideChar;
  577. ldctl_value: TLDAPBerVal;
  578. ldctl_iscritical: ByteBool;
  579. end;
  580. {$EXTERNALSYM LDAPControl}
  581. LDAPControl = LDAPControlA;
  582. TLDAPControlA = LDAPControlA;
  583. TLDAPControlW = LDAPControlW;
  584. TLDAPControl = TLDAPControlA;
  585. //
  586. // Client controls section : these are the client controls that wldap32.dll
  587. // supports.
  588. //
  589. // If you specify LDAP_CONTROL_REFERRALS in a control, the value field should
  590. // point to a ULONG of the following flags :
  591. //
  592. // LDAP_CHASE_SUBORDINATE_REFERRALS
  593. // LDAP_CHASE_EXTERNAL_REFERRALS
  594. //
  595. const
  596. {$EXTERNALSYM LDAP_CONTROL_REFERRALS_W}
  597. LDAP_CONTROL_REFERRALS_W = '1.2.840.113556.1.4.616';
  598. {$EXTERNALSYM LDAP_CONTROL_REFERRALS}
  599. LDAP_CONTROL_REFERRALS = '1.2.840.113556.1.4.616';
  600. //
  601. // Values required for Modification command These are options for the
  602. // mod_op field of LDAPMod structure
  603. //
  604. const
  605. {$EXTERNALSYM LDAP_MOD_ADD}
  606. LDAP_MOD_ADD = $00;
  607. {$EXTERNALSYM LDAP_MOD_DELETE}
  608. LDAP_MOD_DELETE = $01;
  609. {$EXTERNALSYM LDAP_MOD_REPLACE}
  610. LDAP_MOD_REPLACE = $02;
  611. {$EXTERNALSYM LDAP_MOD_BVALUES}
  612. LDAP_MOD_BVALUES = $80;
  613. type
  614. {$EXTERNALSYM PLDAPModA}
  615. PLDAPModA = ^LDAPModA;
  616. {$EXTERNALSYM PLDAPModW}
  617. PLDAPModW = ^LDAPModW;
  618. {$EXTERNALSYM PLDAPMod}
  619. PLDAPMod = PLDAPModA;
  620. {$EXTERNALSYM LDAPModA}
  621. LDAPModA = record
  622. mod_op: ULONG;
  623. mod_type: PAnsiChar;
  624. case integer of
  625. 0:(modv_strvals: ^PAnsiChar);
  626. 1:(modv_bvals: ^PLDAPBerVal);
  627. end;
  628. {$EXTERNALSYM LDAPModW}
  629. LDAPModW = record
  630. mod_op: ULONG;
  631. mod_type: PWideChar;
  632. case integer of
  633. 0:(modv_strvals: ^PWideChar);
  634. 1:(modv_bvals: ^PLDAPBerVal);
  635. end;
  636. {$EXTERNALSYM LDAPMod}
  637. LDAPMod = LDAPModA;
  638. TLDAPModA = LDAPModA;
  639. TLDAPModW = LDAPModW;
  640. TLDAPMod = TLDAPModA;
  641. {$HPPEMIT '#pragma pack(pop)'}
  642. //
  643. // macros compatible with reference implementation...
  644. //
  645. {$EXTERNALSYM LDAP_IS_CLDAP}
  646. function LDAP_IS_CLDAP(ld: PLDAP): Boolean;
  647. {$EXTERNALSYM NAME_ERROR}
  648. function NAME_ERROR(n: Integer): Boolean;
  649. //
  650. // function definitions for LDAP API
  651. //
  652. //
  653. // Create a connection block to an LDAP server. HostName can be NULL, in
  654. // which case we'll try to go off and find the "default" LDAP server.
  655. //
  656. // Note that if we have to go off and find the default server, we'll pull
  657. // in NETAPI32.DLL and ADVAPI32.DLL.
  658. //
  659. // If it returns NULL, an error occurred. Pick up error code with
  660. // GetLastError().
  661. //
  662. // ldap_open actually opens the connection at the time of the call,
  663. // whereas ldap_init only opens the connection when an operation is performed
  664. // that requires it.
  665. {$EXTERNALSYM ldap_openA}
  666. function ldap_openA(HostName: PAnsiChar; PortNumber: ULONG): PLDAP; cdecl;
  667. {$EXTERNALSYM ldap_openW}
  668. function ldap_openW(HostName: PWideChar; PortNumber: ULONG): PLDAP; cdecl;
  669. {$EXTERNALSYM ldap_open}
  670. function ldap_open(HostName: PChar; PortNumber: ULONG): PLDAP; cdecl;
  671. {$EXTERNALSYM ldap_initA}
  672. function ldap_initA(HostName: PAnsiChar; PortNumber: ULONG): PLDAP; cdecl;
  673. {$EXTERNALSYM ldap_initW}
  674. function ldap_initW(HostName: PWideChar; PortNumber: ULONG): PLDAP; cdecl;
  675. {$EXTERNALSYM ldap_init}
  676. function ldap_init(HostName: PChar; PortNumber: ULONG): PLDAP; cdecl;
  677. {$EXTERNALSYM ldap_sslinitA}
  678. function ldap_sslinitA(HostName: PAnsiChar; PortNumber: ULONG; secure: integer): PLDAP; cdecl;
  679. {$EXTERNALSYM ldap_sslinitW}
  680. function ldap_sslinitW(HostName: PWideChar; PortNumber: ULONG; secure: integer): PLDAP; cdecl;
  681. {$EXTERNALSYM ldap_sslinit}
  682. function ldap_sslinit(HostName: PChar; PortNumber: ULONG; secure: integer): PLDAP; cdecl;
  683. //
  684. // when calling ldap_init, you can call ldap_connect explicitly to have the
  685. // library contact the server. This is useful for checking for server
  686. // availability. This call is not required however, since the other functions
  687. // will call it internally if it hasn't already been called.
  688. //
  689. {$EXTERNALSYM ldap_connect}
  690. function ldap_connect(ld: PLDAP; timeout: PLDAPTimeval): ULONG; cdecl;
  691. //
  692. // This is similar to ldap_open except it creates a connection block for
  693. // UDP based Connectionless LDAP services. No TCP session is maintained.
  694. //
  695. // If it returns NULL, an error occurred. Pick up error code with
  696. // GetLastError().
  697. //
  698. {$EXTERNALSYM cldap_openA}
  699. function cldap_openA(HostName: PAnsiChar; PortNumber: ULONG): PLDAP; cdecl;
  700. {$EXTERNALSYM cldap_openW}
  701. function cldap_openW(HostName: PWideChar; PortNumber: ULONG): PLDAP; cdecl;
  702. {$EXTERNALSYM cldap_open}
  703. function cldap_open(HostName: PChar; PortNumber: ULONG): PLDAP; cdecl;
  704. //
  705. // Call unbind when you're done with the connection, it will free all
  706. // resources associated with the connection.
  707. //
  708. // There is no ldap_close... use ldap_unbind even if you haven't called
  709. // ldap_bind on the connection.
  710. //
  711. {$EXTERNALSYM ldap_unbind}
  712. function ldap_unbind(ld: PLDAP): ULONG; cdecl;
  713. {$EXTERNALSYM ldap_unbind_s}
  714. function ldap_unbind_s(ld: PLDAP): ULONG; cdecl; // calls ldap_unbind
  715. //
  716. // Calls to get and set options on connection blocks... use them rather
  717. // than modifying the LDAP block directly.
  718. //
  719. {$EXTERNALSYM ldap_get_option}
  720. function ldap_get_option(ld: PLDAP; option: integer; outvalue: pointer): ULONG; cdecl;
  721. {$EXTERNALSYM ldap_get_optionW}
  722. function ldap_get_optionW(ld: PLDAP; option: integer; outvalue: pointer): ULONG; cdecl;
  723. {$EXTERNALSYM ldap_set_option}
  724. function ldap_set_option(ld: PLDAP; option: integer; invalue: pointer): ULONG; cdecl;
  725. {$EXTERNALSYM ldap_set_optionW}
  726. function ldap_set_optionW(ld: PLDAP; option: integer; invalue: pointer): ULONG; cdecl;
  727. //
  728. // These are the values to pass to ldap_get/set_option :
  729. //
  730. const
  731. {$EXTERNALSYM LDAP_OPT_DESC}
  732. LDAP_OPT_DESC = $01;
  733. {$EXTERNALSYM LDAP_OPT_DEREF}
  734. LDAP_OPT_DEREF = $02;
  735. {$EXTERNALSYM LDAP_OPT_SIZELIMIT}
  736. LDAP_OPT_SIZELIMIT = $03;
  737. {$EXTERNALSYM LDAP_OPT_TIMELIMIT}
  738. LDAP_OPT_TIMELIMIT = $04;
  739. {$EXTERNALSYM LDAP_OPT_THREAD_FN_PTRS}
  740. LDAP_OPT_THREAD_FN_PTRS = $05;
  741. {$EXTERNALSYM LDAP_OPT_REBIND_FN}
  742. LDAP_OPT_REBIND_FN = $06;
  743. {$EXTERNALSYM LDAP_OPT_REBIND_ARG}
  744. LDAP_OPT_REBIND_ARG = $07;
  745. {$EXTERNALSYM LDAP_OPT_REFERRALS}
  746. LDAP_OPT_REFERRALS = $08;
  747. {$EXTERNALSYM LDAP_OPT_RESTART}
  748. LDAP_OPT_RESTART = $09;
  749. LDAP_OPT_SSL = $0a;
  750. {$EXTERNALSYM LDAP_OPT_IO_FN_PTRS}
  751. LDAP_OPT_IO_FN_PTRS = $0b;
  752. {$EXTERNALSYM LDAP_OPT_CACHE_FN_PTRS}
  753. LDAP_OPT_CACHE_FN_PTRS = $0d;
  754. {$EXTERNALSYM LDAP_OPT_CACHE_STRATEGY}
  755. LDAP_OPT_CACHE_STRATEGY = $0e;
  756. {$EXTERNALSYM LDAP_OPT_CACHE_ENABLE}
  757. LDAP_OPT_CACHE_ENABLE = $0f;
  758. {$EXTERNALSYM LDAP_OPT_REFERRAL_HOP_LIMIT}
  759. LDAP_OPT_REFERRAL_HOP_LIMIT = $10;
  760. {$EXTERNALSYM LDAP_OPT_PROTOCOL_VERSION}
  761. LDAP_OPT_PROTOCOL_VERSION = $11;
  762. {$EXTERNALSYM LDAP_OPT_VERSION}
  763. LDAP_OPT_VERSION = $11;
  764. {$EXTERNALSYM LDAP_OPT_SORTKEYS}
  765. LDAP_OPT_SORTKEYS = $11;
  766. //
  767. // These are new ones that we've defined, not in current RFC draft.
  768. //
  769. {$EXTERNALSYM LDAP_OPT_HOST_NAME}
  770. LDAP_OPT_HOST_NAME = $30;
  771. {$EXTERNALSYM LDAP_OPT_ERROR_NUMBER}
  772. LDAP_OPT_ERROR_NUMBER = $31;
  773. {$EXTERNALSYM LDAP_OPT_ERROR_STRING}
  774. LDAP_OPT_ERROR_STRING = $32;
  775. {$EXTERNALSYM LDAP_OPT_SERVER_ERROR}
  776. LDAP_OPT_SERVER_ERROR = $33;
  777. {$EXTERNALSYM LDAP_OPT_SERVER_EXT_ERROR}
  778. LDAP_OPT_SERVER_EXT_ERROR = $34;
  779. {$EXTERNALSYM LDAP_OPT_HOST_REACHABLE}
  780. LDAP_OPT_HOST_REACHABLE = $3E;
  781. //
  782. // These options control the keep-alive logic. Keep alives are sent as
  783. // ICMP ping messages (which currently don't go through firewalls).
  784. //
  785. // There are three values that control how this works :
  786. // PING_KEEP_ALIVE : min number of seconds since we last received a response
  787. // from the server before we send a keep-alive ping
  788. // PING_WAIT_TIME : number of milliseconds we wait for the response to
  789. // come back when we send a ping
  790. // PING_LIMIT : number of unanswered pings we send before we close the
  791. // connection.
  792. //
  793. // To disable the keep-alive logic, set any of the values (PING_KEEP_ALIVE,
  794. // PING_LIMIT, or PING_WAIT_TIME) to zero.
  795. //
  796. // The current default/min/max for these values are as follows :
  797. //
  798. // PING_KEEP_ALIVE : 120/5/maxInt seconds (may also be zero)
  799. // PING_WAIT_TIME : 2000/10/60000 milliseconds (may also be zero)
  800. // PING_LIMIT : 4/0/maxInt
  801. //
  802. {$EXTERNALSYM LDAP_OPT_PING_KEEP_ALIVE}
  803. LDAP_OPT_PING_KEEP_ALIVE = $36;
  804. {$EXTERNALSYM LDAP_OPT_PING_WAIT_TIME}
  805. LDAP_OPT_PING_WAIT_TIME = $37;
  806. {$EXTERNALSYM LDAP_OPT_PING_LIMIT}
  807. LDAP_OPT_PING_LIMIT = $38;
  808. //
  809. // These won't be in the RFC. Only use these if you're going to be dependent
  810. // on our implementation.
  811. //
  812. {$EXTERNALSYM LDAP_OPT_DNSDOMAIN_NAME}
  813. LDAP_OPT_DNSDOMAIN_NAME = $3B; // return DNS name of domain
  814. {$EXTERNALSYM LDAP_OPT_GETDSNAME_FLAGS}
  815. LDAP_OPT_GETDSNAME_FLAGS = $3D; // flags for DsGetDcName
  816. {$EXTERNALSYM LDAP_OPT_PROMPT_CREDENTIALS}
  817. LDAP_OPT_PROMPT_CREDENTIALS = $3F; // prompt for creds? currently
  818. // only for DPA & NTLM if no creds
  819. // are loaded
  820. {$EXTERNALSYM LDAP_OPT_AUTO_RECONNECT}
  821. LDAP_OPT_AUTO_RECONNECT = $91; // enable/disable autoreconnect
  822. {$EXTERNALSYM LDAP_OPT_SSPI_FLAGS}
  823. LDAP_OPT_SSPI_FLAGS = $92; // flags to pass to InitSecurityContext
  824. //
  825. // To retrieve information on an secure connection, a pointer to a
  826. // SecPkgContext_connectionInfo structure (defined in schnlsp.h) must be
  827. // passed in. On success, it is filled with relevent security information.
  828. //
  829. {$EXTERNALSYM LDAP_OPT_SSL_INFO}
  830. LDAP_OPT_SSL_INFO = $93;
  831. //
  832. // Turing on either the sign or the encrypt option prior to binding using
  833. // LDAP_AUTH_NEGOTIATE will result in the ensuing LDAP session to be signed
  834. // or encrypted using either Kerberos or NTLM (as negotiated by the underlying
  835. // security packages). Note that these options can't be used with SSL.
  836. //
  837. {$EXTERNALSYM LDAP_OPT_SIGN}
  838. LDAP_OPT_SIGN = $95;
  839. {$EXTERNALSYM LDAP_OPT_ENCRYPT}
  840. LDAP_OPT_ENCRYPT = $96;
  841. //
  842. // The user can set a preferred SASL method prior to binding using LDAP_AUTH_NEGOTIATE
  843. // We will try to use this mechanism while binding. One example is "GSSAPI".
  844. //
  845. {$EXTERNALSYM LDAP_OPT_SASL_METHOD}
  846. LDAP_OPT_SASL_METHOD = $97;
  847. //
  848. // Setting this option to LDAP_OPT_ON will instruct the library to only perform an
  849. // A-Record DNS lookup on the supplied host string. This option is OFF by default.
  850. //
  851. {$EXTERNALSYM LDAP_OPT_AREC_EXCLUSIVE}
  852. LDAP_OPT_AREC_EXCLUSIVE = $98;
  853. //
  854. // Retrieve the security context associated with the connection.
  855. //
  856. {$EXTERNALSYM LDAP_OPT_SECURITY_CONTEXT}
  857. LDAP_OPT_SECURITY_CONTEXT = $99;
  858. //
  859. // End of Microsoft only options
  860. //
  861. {$EXTERNALSYM LDAP_OPT_ON}
  862. LDAP_OPT_ON = Pointer(1);
  863. {$EXTERNALSYM LDAP_OPT_OFF}
  864. LDAP_OPT_OFF = Pointer(0);
  865. //
  866. // For chasing referrals, we extend this a bit for LDAP_OPT_REFERRALS. If
  867. // the value is not LDAP_OPT_ON or LDAP_OPT_OFF, we'll treat them as the
  868. // following :
  869. //
  870. // LDAP_CHASE_SUBORDINATE_REFERRALS : chase subordinate referrals (or
  871. // references) returned in a v3 search
  872. // LDAP_CHASE_EXTERNAL_REFERRALS : chase external referrals. These are
  873. // returned possibly on any operation except bind.
  874. //
  875. // If you OR these flags together, it's equivalent to setting referrals to
  876. // LDAP_OPT_ON.
  877. //
  878. {$EXTERNALSYM LDAP_CHASE_SUBORDINATE_REFERRALS}
  879. LDAP_CHASE_SUBORDINATE_REFERRALS = $00000020;
  880. {$EXTERNALSYM LDAP_CHASE_EXTERNAL_REFERRALS}
  881. LDAP_CHASE_EXTERNAL_REFERRALS = $00000040;
  882. //
  883. // Bind is required as the first operation to v2 servers, not so for v3
  884. // servers. See above description of authentication methods.
  885. //
  886. {$EXTERNALSYM ldap_simple_bindA}
  887. function ldap_simple_bindA(ld: PLDAP; dn, passwd: PAnsiChar): ULONG; cdecl;
  888. {$EXTERNALSYM ldap_simple_bindW}
  889. function ldap_simple_bindW(ld: PLDAP; dn, passwd: PWideChar): ULONG; cdecl;
  890. {$EXTERNALSYM ldap_simple_bind}
  891. function ldap_simple_bind(ld: PLDAP; dn, passwd: PChar): ULONG; cdecl;
  892. {$EXTERNALSYM ldap_simple_bind_sA}
  893. function ldap_simple_bind_sA(ld: PLDAP; dn, passwd: PAnsiChar): ULONG; cdecl;
  894. {$EXTERNALSYM ldap_simple_bind_sW}
  895. function ldap_simple_bind_sW(ld: PLDAP; dn, passwd: PWideChar): ULONG; cdecl;
  896. {$EXTERNALSYM ldap_simple_bind_s}
  897. function ldap_simple_bind_s(ld: PLDAP; dn, passwd: PChar): ULONG; cdecl;
  898. {$EXTERNALSYM ldap_bindA}
  899. function ldap_bindA(ld: PLDAP; dn, cred: PAnsiChar; method: ULONG): ULONG; cdecl;
  900. {$EXTERNALSYM ldap_bindW}
  901. function ldap_bindW(ld: PLDAP; dn, cred: PWideChar; method: ULONG): ULONG; cdecl;
  902. {$EXTERNALSYM ldap_bind}
  903. function ldap_bind(ld: PLDAP; dn, cred: PChar; method: ULONG): ULONG; cdecl;
  904. {$EXTERNALSYM ldap_bind_sA}
  905. function ldap_bind_sA(ld: PLDAP; dn, cred: PAnsiChar; method: ULONG): ULONG; cdecl;
  906. {$EXTERNALSYM ldap_bind_sW}
  907. function ldap_bind_sW(ld: PLDAP; dn, cred: PWideChar; method: ULONG): ULONG; cdecl;
  908. {$EXTERNALSYM ldap_bind_s}
  909. function ldap_bind_s(ld: PLDAP; dn, cred: PChar; method: ULONG): ULONG; cdecl;
  910. // The following functions can be used to pass in any arbitrary credentials
  911. // to the server. The application must be ready to interpret the response
  912. // sent back from the server.
  913. //
  914. {$EXTERNALSYM ldap_sasl_bindA}
  915. function ldap_sasl_bindA(ExternalHandle: PLDAP; DistName: PAnsiChar;
  916. AuthMechanism: PAnsiChar; cred: PBERVAL;
  917. var ServerCtrls, ClientCtrls: PLDAPControlA;
  918. var MessageNumber: Integer): Integer; cdecl;
  919. {$EXTERNALSYM ldap_sasl_bindW}
  920. function ldap_sasl_bindW(ExternalHandle: PLDAP; DistName: PWideChar;
  921. AuthMechanism: PWideChar; cred: PBERVAL;
  922. var ServerCtrls, ClientCtrls: PLDAPControlW;
  923. var MessageNumber: Integer): Integer; cdecl;
  924. {$EXTERNALSYM ldap_sasl_bind}
  925. function ldap_sasl_bind(ExternalHandle: PLDAP; DistName: PChar;
  926. AuthMechanism: PChar; cred: PBERVAL;
  927. var ServerCtrls, ClientCtrls: PLDAPControl;
  928. var MessageNumber: Integer): Integer; cdecl;
  929. function ldap_sasl_bind_sA(ExternalHandle: PLDAP; DistName: PAnsiChar;
  930. AuthMechanism: PAnsiChar; cred: PBERVAL;
  931. var ServerCtrls, ClientCtrls: PLDAPControlA;
  932. var ServerData: PBERVAL): Integer; cdecl;
  933. function ldap_sasl_bind_sW(ExternalHandle: PLDAP; DistName: PWideChar;
  934. AuthMechanism: PWideChar; cred: PBERVAL;
  935. var ServerCtrls, ClientCtrls: PLDAPControlW;
  936. var ServerData: PBERVAL): Integer; cdecl;
  937. function ldap_sasl_bind_s(ExternalHandle: PLDAP; DistName: PChar;
  938. AuthMechanism: PChar; cred: PBERVAL;
  939. var ServerCtrls, ClientCtrls: PLDAPControl;
  940. var ServerData: PBERVAL): Integer; cdecl;
  941. //
  942. // Synchronous and asynch search routines.
  943. //
  944. // filter follows RFC 1960 with the addition that '(' ')' '*' ' ' '\' and
  945. // '\0' are all escaped with '\'
  946. //
  947. // Scope of search. This corresponds to the "scope" parameter on search
  948. const
  949. {$EXTERNALSYM LDAP_SCOPE_BASE}
  950. LDAP_SCOPE_BASE = $00;
  951. {$EXTERNALSYM LDAP_SCOPE_ONELEVEL}
  952. LDAP_SCOPE_ONELEVEL = $01;
  953. {$EXTERNALSYM LDAP_SCOPE_SUBTREE}
  954. LDAP_SCOPE_SUBTREE = $02;
  955. {$EXTERNALSYM ldap_searchA}
  956. function ldap_searchA(
  957. ld: PLDAP;
  958. base: PAnsiChar; // distinguished name or ''
  959. scope: ULONG; // LDAP_SCOPE_xxxx
  960. filter: PAnsiChar;
  961. attrs: PAnsiChar; // pointer to an array of PAnsiChar attribute names
  962. attrsonly: ULONG // boolean on whether to only return attr names
  963. ): ULONG; cdecl;
  964. {$EXTERNALSYM ldap_searchW}
  965. function ldap_searchW(
  966. ld: PLDAP;
  967. base: PWideChar; // distinguished name or ''
  968. scope: ULONG; // LDAP_SCOPE_xxxx
  969. filter: PWideChar;
  970. attrs: PWideChar; // pointer to an array of PAnsiChar attribute names
  971. attrsonly: ULONG // boolean on whether to only return attr names
  972. ): ULONG; cdecl;
  973. {$EXTERNALSYM ldap_search}
  974. function ldap_search(
  975. ld: PLDAP;
  976. base: PChar; // distinguished name or ''
  977. scope: ULONG; // LDAP_SCOPE_xxxx
  978. filter: PChar;
  979. attrs: PChar; // pointer to an array of PAnsiChar attribute names
  980. attrsonly: ULONG // boolean on whether to only return attr names
  981. ): ULONG; cdecl;
  982. {$EXTERNALSYM ldap_search_sA}
  983. function ldap_search_sA(ld: PLDAP; base: PAnsiChar; scope: ULONG;
  984. filter, attrs: PAnsiChar; attrsonly: ULONG;
  985. var res: PLDAPMessage): ULONG; cdecl;
  986. {$EXTERNALSYM ldap_search_sW}
  987. function ldap_search_sW(ld: PLDAP; base: PWideChar; scope: ULONG;
  988. filter, attrs: PWideChar; attrsonly: ULONG;
  989. var res: PLDAPMessage): ULONG; cdecl;
  990. {$EXTERNALSYM ldap_search_s}
  991. function ldap_search_s(ld: PLDAP; base: PChar; scope: ULONG;
  992. filter, attrs: PChar; attrsonly: ULONG;
  993. var res: PLDAPMessage): ULONG; cdecl;
  994. {$EXTERNALSYM ldap_search_stA}
  995. function ldap_search_stA(ld: PLDAP; base: PAnsiChar; scope: ULONG;
  996. filter, attrs: PAnsiChar; attrsonly: ULONG; var timeout: TLDAPTimeVal;
  997. var res: PLDAPMessage): ULONG; cdecl;
  998. {$EXTERNALSYM ldap_search_stW}
  999. function ldap_search_stW(ld: PLDAP; base: PWideChar; scope: ULONG;
  1000. filter, attrs: PWideChar; attrsonly: ULONG; var timeout: TLDAPTimeVal;
  1001. var res: PLDAPMessage): ULONG; cdecl;
  1002. {$EXTERNALSYM ldap_search_st}
  1003. function ldap_search_st(ld: PLDAP; base: PChar; scope: ULONG;
  1004. filter, attrs: PChar; attrsonly: ULONG; var timeout: TLDAPTimeVal;
  1005. var res: PLDAPMessage): ULONG; cdecl;
  1006. {$EXTERNALSYM ldap_search_extA}
  1007. function ldap_search_extA(ld: PLDAP; base: PAnsiChar; scope: ULONG;
  1008. filter, attrs: PAnsiChar; attrsonly: ULONG;
  1009. var ServerControls, ClientControls: PLDAPControlA;
  1010. TimeLimit, SizeLimit: ULONG; var MessageNumber: ULONG): ULONG; cdecl;
  1011. {$EXTERNALSYM ldap_search_extW}
  1012. function ldap_search_extW(ld: PLDAP; base: PWideChar; scope: ULONG;
  1013. filter, attrs: PWideChar; attrsonly: ULONG;
  1014. var ServerControls, ClientControls: PLDAPControlW;
  1015. TimeLimit, SizeLimit: ULONG; var MessageNumber: ULONG): ULONG; cdecl;
  1016. {$EXTERNALSYM ldap_search_ext}
  1017. function ldap_search_ext(ld: PLDAP; base: PChar; scope: ULONG;
  1018. filter, attrs: PChar; attrsonly: ULONG;
  1019. ServerControls, ClientControls: PPLDAPControl;
  1020. TimeLimit, SizeLimit: ULONG; var MessageNumber: ULONG): ULONG; cdecl;
  1021. {$EXTERNALSYM ldap_search_ext_sA}
  1022. function ldap_search_ext_sA(ld: PLDAP; base: PAnsiChar; scope: ULONG;
  1023. filter, attrs: PAnsiChar; attrsonly: ULONG;
  1024. var ServerControls, ClientControls: PLDAPControlA;
  1025. var timeout: TLDAPTimeVal; SizeLimit: ULONG;
  1026. var res: PLDAPMessage): ULONG; cdecl;
  1027. {$EXTERNALSYM ldap_search_ext_sW}
  1028. function ldap_search_ext_sW(ld: PLDAP; base: PWideChar; scope: ULONG;
  1029. filter, attrs: PWideChar; attrsonly: ULONG;
  1030. var ServerControls, ClientControls: PLDAPControlW;
  1031. var timeout: TLDAPTimeVal; SizeLimit: ULONG;
  1032. var res: PLDAPMessage): ULONG; cdecl;
  1033. {$EXTERNALSYM ldap_search_ext_s}
  1034. function ldap_search_ext_s(ld: PLDAP; base: PChar; scope: ULONG;
  1035. filter, attrs: PChar; attrsonly: ULONG;
  1036. ServerControls, ClientControls: PPLDAPControl;
  1037. timeout: PLDAPTimeVal; SizeLimit: ULONG;
  1038. var res: PLDAPMessage): ULONG; cdecl;
  1039. //
  1040. // Extended API to check filter syntax. Returns LDAP error code if syntax
  1041. // is invalid or LDAP_SUCCESS if it's ok.
  1042. //
  1043. {$EXTERNALSYM ldap_check_filterA}
  1044. function ldap_check_filterA(ld: PLDAP; SearchFilter: PAnsiChar): ULONG; cdecl;
  1045. {$EXTERNALSYM ldap_check_filterW}
  1046. function ldap_check_filterW(ld: PLDAP; SearchFilter: PWideChar): ULONG; cdecl;
  1047. {$EXTERNALSYM ldap_check_filter}
  1048. function ldap_check_filter(ld: PLDAP; SearchFilter: PChar): ULONG; cdecl;
  1049. //
  1050. // modify an existing entry
  1051. //
  1052. //
  1053. // multi-thread: ldap_modify calls are not safe in that the message number
  1054. // is returned rather than the return code. You have to look
  1055. // at the connection block in an error case and the return code
  1056. // may be overwritten by another thread inbetween.
  1057. //
  1058. // Use ldap_modify_ext instead, as these are thread safe.
  1059. //
  1060. // ldap_modify_s and ldap_modify_ext* calls are thread safe.
  1061. //
  1062. {$EXTERNALSYM ldap_modifyA}
  1063. function ldap_modifyA(ld: PLDAP; dn: PAnsiChar; var mods: PLDAPModA): ULONG; cdecl;
  1064. {$EXTERNALSYM ldap_modifyW}
  1065. function ldap_modifyW(ld: PLDAP; dn: PWideChar; var mods: PLDAPModW): ULONG; cdecl;
  1066. {$EXTERNALSYM ldap_modify}
  1067. function ldap_modify(ld: PLDAP; dn: PChar; var mods: PLDAPMod): ULONG; cdecl;
  1068. {$EXTERNALSYM ldap_modify_sA}
  1069. function ldap_modify_sA(ld: PLDAP; dn: PAnsiChar; var mods: PLDAPModA): ULONG; cdecl;
  1070. {$EXTERNALSYM ldap_modify_sW}
  1071. function ldap_modify_sW(ld: PLDAP; dn: PWideChar; var mods: PLDAPModW): ULONG; cdecl;
  1072. {$EXTERNALSYM ldap_modify_s}
  1073. function ldap_modify_s(ld: PLDAP; dn: PChar; var mods: PLDAPMod): ULONG; cdecl;
  1074. {$EXTERNALSYM ldap_modify_extA}
  1075. function ldap_modify_extA(ld: PLDAP; dn: PAnsiChar; var mods: PLDAPModA;
  1076. var ServerControls, ClientControls: PLDAPControlA;
  1077. var MessageNumber: ULONG): ULONG; cdecl;
  1078. {$EXTERNALSYM ldap_modify_extW}
  1079. function ldap_modify_extW(ld: PLDAP; dn: PWideChar; var mods: PLDAPModW;
  1080. var ServerControls, ClientControls: PLDAPControlW;
  1081. var MessageNumber: ULONG): ULONG; cdecl;
  1082. {$EXTERNALSYM ldap_modify_ext}
  1083. function ldap_modify_ext(ld: PLDAP; dn: PChar; var mods: PLDAPMod;
  1084. var ServerControls, ClientControls: PLDAPControl;
  1085. var MessageNumber: ULONG): ULONG; cdecl;
  1086. {$EXTERNALSYM ldap_modify_ext_sA}
  1087. function ldap_modify_ext_sA(ld: PLDAP; dn: PAnsiChar; var mods: PLDAPModA;
  1088. var ServerControls, ClientControls: PLDAPControlA): ULONG; cdecl;
  1089. {$EXTERNALSYM ldap_modify_ext_sW}
  1090. function ldap_modify_ext_sW(ld: PLDAP; dn: PWideChar; var mods: PLDAPModW;
  1091. var ServerControls, ClientControls: PLDAPControlW): ULONG; cdecl;
  1092. {$EXTERNALSYM ldap_modify_ext_s}
  1093. function ldap_modify_ext_s(ld: PLDAP; dn: PChar; var mods: PLDAPMod;
  1094. var ServerControls, ClientControls: PLDAPControl): ULONG; cdecl;
  1095. //
  1096. // modrdn and modrdn2 function both as RenameObject and MoveObject.
  1097. //
  1098. // Note that to LDAP v2 servers, only rename within a given container
  1099. // is supported... therefore NewDistinguishedName is actually NewRDN.
  1100. // Here are some examples :
  1101. //
  1102. // This works to both v2 and v3 servers :
  1103. //
  1104. // DN = CN=Bob,OU=FOO,O=BAR
  1105. // NewDN = CN=Joe
  1106. //
  1107. // result is: CN=Joe,OU=FOO,O=BAR
  1108. //
  1109. // This works to only v3 and above servers :
  1110. //
  1111. // DN = CN=Bob,OU=FOO,O=BAR
  1112. // NewDN = CN=Joe,OU=FOOBAR,O=BAR
  1113. //
  1114. // result is: CN=Joe,OU=FOOBAR,O=BAR
  1115. //
  1116. // If you try the second example to a v2 server, we'll send the whole
  1117. // NewDN over as the new RDN(rather than break up the parent OU and
  1118. // child). The server will then give you back some unknown error.
  1119. //
  1120. //
  1121. // multi-thread: ldap_modrdn and ldap_modrdn2 calls are not safe in that
  1122. // the message number is returned rather than the return code.
  1123. // You have to look at the connection block in an error case
  1124. // and the return code may be overwritten by another thread
  1125. // inbetween.
  1126. //
  1127. // Use ldap_rename_ext instead, as these are thread safe.
  1128. //
  1129. {$EXTERNALSYM ldap_modrdn2A}
  1130. function ldap_modrdn2A(var ExternalHandle: LDAP;
  1131. DistinguishedName, NewDistinguishedName: PAnsiChar;
  1132. DeleteOldRdn: Integer): ULONG; cdecl;
  1133. {$EXTERNALSYM ldap_modrdn2W}
  1134. function ldap_modrdn2W(var ExternalHandle: LDAP;
  1135. DistinguishedName, NewDistinguishedName: PWideChar;
  1136. DeleteOldRdn: Integer): ULONG; cdecl;
  1137. {$EXTERNALSYM ldap_modrdn2}
  1138. function ldap_modrdn2(var ExternalHandle: LDAP;
  1139. DistinguishedName, NewDistinguishedName: PChar;
  1140. DeleteOldRdn: Integer): ULONG; cdecl;
  1141. //
  1142. // ldap_modrdn simply calls ldap_modrdn2 with a value of 1 for DeleteOldRdn.
  1143. //
  1144. {$EXTERNALSYM ldap_modrdnA}
  1145. function ldap_modrdnA(var ExternalHandle: LDAP;
  1146. DistinguishedName, NewDistinguishedName: PAnsiChar): ULONG; cdecl;
  1147. {$EXTERNALSYM ldap_modrdnW}
  1148. function ldap_modrdnW(var ExternalHandle: LDAP;
  1149. DistinguishedName, NewDistinguishedName: PWideChar): ULONG; cdecl;
  1150. {$EXTERNALSYM ldap_modrdn}
  1151. function ldap_modrdn(var ExternalHandle: LDAP;
  1152. DistinguishedName, NewDistinguishedName: PChar): ULONG; cdecl;
  1153. {$EXTERNALSYM ldap_modrdn2_sA}
  1154. function ldap_modrdn2_sA(var ExternalHandle: LDAP;
  1155. DistinguishedName, NewDistinguishedName: PAnsiChar;
  1156. DeleteOldRdn: Integer): ULONG; cdecl;
  1157. {$EXTERNALSYM ldap_modrdn2_sW}
  1158. function ldap_modrdn2_sW(var ExternalHandle: LDAP;
  1159. DistinguishedName, NewDistinguishedName: PWideChar;
  1160. DeleteOldRdn: Integer): ULONG; cdecl;
  1161. {$EXTERNALSYM ldap_modrdn2_s}
  1162. function ldap_modrdn2_s(var ExternalHandle: LDAP;
  1163. DistinguishedName, NewDistinguishedName: PChar;
  1164. DeleteOldRdn: Integer): ULONG; cdecl;
  1165. {$EXTERNALSYM ldap_modrdn_sA}
  1166. function ldap_modrdn_sA(var ExternalHandle: LDAP;
  1167. DistinguishedName, NewDistinguishedName: PAnsiChar): ULONG; cdecl;
  1168. {$EXTERNALSYM ldap_modrdn_sW}
  1169. function ldap_modrdn_sW(var ExternalHandle: LDAP;
  1170. DistinguishedName, NewDistinguishedName: PWideChar): ULONG; cdecl;
  1171. {$EXTERNALSYM ldap_modrdn_s}
  1172. function ldap_modrdn_s(var ExternalHandle: LDAP;
  1173. DistinguishedName, NewDistinguishedName: PChar): ULONG; cdecl;
  1174. //
  1175. // Extended Rename operations. These take controls and separate out the
  1176. // parent from the RDN, for clarity.
  1177. //
  1178. {$EXTERNALSYM ldap_rename_extA}
  1179. function ldap_rename_extA(ld: PLDAP; dn, NewRDN, NewParent: PAnsiChar;
  1180. DeleteOldRdn: Integer; var ServerControls, ClientControls: PLDAPControlA;
  1181. var MessageNumber: ULONG): ULONG; cdecl;
  1182. {$EXTERNALSYM ldap_rename_extW}
  1183. function ldap_rename_extW(ld: PLDAP; dn, NewRDN, NewParent: PWideChar;
  1184. DeleteOldRdn: Integer; var ServerControls, ClientControls: PLDAPControlW;
  1185. var MessageNumber: ULONG): ULONG; cdecl;
  1186. {$EXTERNALSYM ldap_rename_ext}
  1187. function ldap_rename_ext(ld: PLDAP; dn, NewRDN, NewParent: PChar;
  1188. DeleteOldRdn: Integer; var ServerControls, ClientControls: PLDAPControl;
  1189. var MessageNumber: ULONG): ULONG; cdecl;
  1190. {$EXTERNALSYM ldap_rename_ext_sA}
  1191. function ldap_rename_ext_sA(ld: PLDAP;
  1192. dn, NewRDN, NewParent: PAnsiChar; DeleteOldRdn: Integer;
  1193. var ServerControls, ClientControls: PLDAPControlA): ULONG; cdecl;
  1194. {$EXTERNALSYM ldap_rename_ext_sW}
  1195. function ldap_rename_ext_sW(ld: PLDAP;
  1196. dn, NewRDN, NewParent: PWideChar; DeleteOldRdn: Integer;
  1197. var ServerControls, ClientControls: PLDAPControlW): ULONG; cdecl;
  1198. {$EXTERNALSYM ldap_rename_ext_s}
  1199. function ldap_rename_ext_s(ld: PLDAP;
  1200. dn, NewRDN, NewParent: PChar; DeleteOldRdn: Integer;
  1201. var ServerControls, ClientControls: PLDAPControl): ULONG; cdecl;
  1202. //
  1203. // Add an entry to the tree
  1204. //
  1205. //
  1206. // multi-thread: ldap_add calls are not safe in that the message number
  1207. // is returned rather than the return code. You have to look
  1208. // at the connection block in an error case and the return code
  1209. // may be overwritten by another thread inbetween.
  1210. //
  1211. // Use ldap_add_ext instead, as these are thread safe.
  1212. //
  1213. // ldap_add_s and ldap_add_ext* calls are thread safe.
  1214. //
  1215. {$EXTERNALSYM ldap_addA}
  1216. function ldap_addA(ld: PLDAP; dn: PAnsiChar; var attrs: PLDAPModA): ULONG; cdecl;
  1217. {$EXTERNALSYM ldap_addW}
  1218. function ldap_addW(ld: PLDAP; dn: PWideChar; var attrs: PLDAPModW): ULONG; cdecl;
  1219. {$EXTERNALSYM ldap_add}
  1220. function ldap_add(ld: PLDAP; dn: PChar; var attrs: PLDAPMod): ULONG; cdecl;
  1221. {$EXTERNALSYM ldap_add_sA}
  1222. function ldap_add_sA(ld: PLDAP; dn: PAnsiChar; var attrs: PLDAPModA): ULONG; cdecl;
  1223. {$EXTERNALSYM ldap_add_sW}
  1224. function ldap_add_sW(ld: PLDAP; dn: PWideChar; var attrs: PLDAPModW): ULONG; cdecl;
  1225. {$EXTERNALSYM ldap_add_s}
  1226. function ldap_add_s(ld: PLDAP; dn: PChar; var attrs: PLDAPMod): ULONG; cdecl;
  1227. {$EXTERNALSYM ldap_add_extA}
  1228. function ldap_add_extA(ld: PLDAP; dn: PAnsiChar; var attrs: PLDAPModA;
  1229. var ServerControls, ClientControls: PLDAPControlA;
  1230. var MessageNumber: ULONG): ULONG; cdecl;
  1231. {$EXTERNALSYM ldap_add_extW}
  1232. function ldap_add_extW(ld: PLDAP; dn: PWideChar; var attrs: PLDAPModW;
  1233. var ServerControls, ClientControls: PLDAPControlW;
  1234. var MessageNumber: ULONG): ULONG; cdecl;
  1235. {$EXTERNALSYM ldap_add_ext}
  1236. function ldap_add_ext(ld: PLDAP; dn: PChar; var attrs: PLDAPMod;
  1237. var ServerControls, ClientControls: PLDAPControl;
  1238. var MessageNumber: ULONG): ULONG; cdecl;
  1239. {$EXTERNALSYM ldap_add_ext_sA}
  1240. function ldap_add_ext_sA(ld: PLDAP; dn: PAnsiChar; var attrs: PLDAPModA;
  1241. var ServerControls, ClientControls: PLDAPControlA): ULONG; cdecl;
  1242. {$EXTERNALSYM ldap_add_ext_sW}
  1243. function ldap_add_ext_sW(ld: PLDAP; dn: PWideChar; var attrs: PLDAPModW;
  1244. var ServerControls, ClientControls: PLDAPControlW): ULONG; cdecl;
  1245. {$EXTERNALSYM ldap_add_ext_s}
  1246. function ldap_add_ext_s(ld: PLDAP; dn: PChar; var attrs: PLDAPMod;
  1247. var ServerControls, ClientControls: PLDAPControl): ULONG; cdecl;
  1248. //
  1249. // Compare the attribute for a given entry to a known value.
  1250. //
  1251. {$EXTERNALSYM ldap_compareA}
  1252. function ldap_compareA(ld: PLDAP; dn, attr, value: PAnsiChar): ULONG; cdecl;
  1253. {$EXTERNALSYM ldap_compareW}
  1254. function ldap_compareW(ld: PLDAP; dn, attr, value: PWideChar): ULONG; cdecl;
  1255. {$EXTERNALSYM ldap_compare}
  1256. function ldap_compare(ld: PLDAP; dn, attr, value: PChar): ULONG; cdecl;
  1257. {$EXTERNALSYM ldap_compare_sA}
  1258. function ldap_compare_sA(ld: PLDAP; dn, attr, value: PAnsiChar): ULONG; cdecl;
  1259. {$EXTERNALSYM ldap_compare_sW}
  1260. function ldap_compare_sW(ld: PLDAP; dn, attr, value: PWideChar): ULONG; cdecl;
  1261. {$EXTERNALSYM ldap_compare_s}
  1262. function ldap_compare_s(ld: PLDAP; dn, attr, value: PChar): ULONG; cdecl;
  1263. //
  1264. // Extended Compare operations. These take controls and are thread safe.
  1265. // They also allow you to specify a bval structure for the data, so that it
  1266. // isn't translated from Unicode or ANSI to UTF8. Allows for comparison of
  1267. // raw binary data.
  1268. //
  1269. // Specify either Data or Value as not NULL. If both are not NULL, the
  1270. // berval Data will be used.
  1271. //
  1272. // either value or Data is not null, not both
  1273. {$EXTERNALSYM ldap_compare_extA}
  1274. function ldap_compare_extA(ld: PLDAP; dn, Attr, Value: PAnsiChar;
  1275. Data: PLDAPBerVal; var ServerControls, ClientControls: PLDAPControlA;
  1276. var MessageNumber: ULONG): ULONG; cdecl;
  1277. {$EXTERNALSYM ldap_compare_extW}
  1278. function ldap_compare_extW(ld: PLDAP; dn, Attr, Value: PWideChar;
  1279. Data: PLDAPBerVal; var ServerControls, ClientControls: PLDAPControlW;
  1280. var MessageNumber: ULONG): ULONG; cdecl;
  1281. {$EXTERNALSYM ldap_compare_ext}
  1282. function ldap_compare_ext(ld: PLDAP; dn, Attr, Value: PChar;
  1283. Data: PLDAPBerVal; var ServerControls, ClientControls: PLDAPControl;
  1284. var MessageNumber: ULONG): ULONG; cdecl;
  1285. {$EXTERNALSYM ldap_compare_ext_sA}
  1286. function ldap_compare_ext_sA(ld: PLDAP;
  1287. dn, Attr, Value: PAnsiChar; Data: PLDAPBerVal;
  1288. var ServerControls, ClientControls: PLDAPControlA): ULONG; cdecl;
  1289. {$EXTERNALSYM ldap_compare_ext_sW}
  1290. function ldap_compare_ext_sW(ld: PLDAP;
  1291. dn, Attr, Value: PWideChar; Data: PLDAPBerVal;
  1292. var ServerControls, ClientControls: PLDAPControlW): ULONG; cdecl;
  1293. {$EXTERNALSYM ldap_compare_ext_s}
  1294. function ldap_compare_ext_s(ld: PLDAP;
  1295. dn, Attr, Value: PChar; Data: PLDAPBerVal;
  1296. var ServerControls, ClientControls: PLDAPControl): ULONG; cdecl;
  1297. //
  1298. // Delete an object out of the tree
  1299. //
  1300. //
  1301. // multi-thread: ldap_delete calls are not safe in that the message number
  1302. // is returned rather than the return code. You have to look
  1303. // at the connection block in an error case and the return code
  1304. // may be overwritten by another thread inbetween.
  1305. //
  1306. // Use ldap_delete_ext instead, as these are thread safe.
  1307. //
  1308. // ldap_delete_s and ldap_delete_ext* calls are thread safe.
  1309. //
  1310. {$EXTERNALSYM ldap_deleteA}
  1311. function ldap_deleteA(ld: PLDAP; dn: PAnsiChar): ULONG; cdecl;
  1312. {$EXTERNALSYM ldap_deleteW}
  1313. function ldap_deleteW(ld: PLDAP; dn: PWideChar): ULONG; cdecl;
  1314. {$EXTERNALSYM ldap_delete}
  1315. function ldap_delete(ld: PLDAP; dn: PChar): ULONG; cdecl;
  1316. {$EXTERNALSYM ldap_delete_sA}
  1317. function ldap_delete_sA(ld: PLDAP; dn: PAnsiChar): ULONG; cdecl;
  1318. {$EXTERNALSYM ldap_delete_sW}
  1319. function ldap_delete_sW(ld: PLDAP; dn: PWideChar): ULONG; cdecl;
  1320. {$EXTERNALSYM ldap_delete_s}
  1321. function ldap_delete_s(ld: PLDAP; dn: PChar): ULONG; cdecl;
  1322. {$EXTERNALSYM ldap_delete_extA}
  1323. function ldap_delete_extA(ld: PLDAP; dn: PAnsiChar;
  1324. var ServerControls, ClientControls: PLDAPControlA;
  1325. var MessageNumber: ULONG): ULONG; cdecl;
  1326. {$EXTERNALSYM ldap_delete_extW}
  1327. function ldap_delete_extW(ld: PLDAP; dn: PWideChar;
  1328. var ServerControls, ClientControls: PLDAPControlW;
  1329. var MessageNumber: ULONG): ULONG; cdecl;
  1330. {$EXTERNALSYM ldap_delete_ext}
  1331. function ldap_delete_ext(ld: PLDAP; dn: PChar;
  1332. var ServerControls, ClientControls: PLDAPControl;
  1333. var MessageNumber: ULONG): ULONG; cdecl;
  1334. {$EXTERNALSYM ldap_delete_ext_sA}
  1335. function ldap_delete_ext_sA(ld: PLDAP; dn: PAnsiChar;
  1336. var ServerControls, ClientControls: PLDAPControlA): ULONG; cdecl;
  1337. {$EXTERNALSYM ldap_delete_ext_sW}
  1338. function ldap_delete_ext_sW(ld: PLDAP; dn: PWideChar;
  1339. var ServerControls, ClientControls: PLDAPControlW): ULONG; cdecl;
  1340. {$EXTERNALSYM ldap_delete_ext_s}
  1341. function ldap_delete_ext_s(ld: PLDAP; dn: PChar;
  1342. var ServerControls, ClientControls: PLDAPControl): ULONG; cdecl;
  1343. //
  1344. // Give up on a request. No guarentee that it got there as there is no
  1345. // response from the server.
  1346. //
  1347. {$EXTERNALSYM ldap_abandon}
  1348. function ldap_abandon(ld: PLDAP; msgid: ULONG): ULONG; cdecl;
  1349. //
  1350. // Possible values for "all" field in ldap_result. We've enhanced it such
  1351. // that if someone passes in LDAP_MSG_RECEIVED, we'll pass all values we've
  1352. // received up to that point.
  1353. //
  1354. const
  1355. {$EXTERNALSYM LDAP_MSG_ONE}
  1356. LDAP_MSG_ONE = 0;
  1357. {$EXTERNALSYM LDAP_MSG_ALL}
  1358. LDAP_MSG_ALL = 1;
  1359. {$EXTERNALSYM LDAP_MSG_RECEIVED}
  1360. LDAP_MSG_RECEIVED = 2;
  1361. //
  1362. // Get a response from a connection. One enhancement here is that ld can
  1363. // be null, in which case we'll return responses from any server. Free
  1364. // responses here with ldap_msgfree.
  1365. //
  1366. // For connection-less LDAP, you should pass in both a LDAP connection
  1367. // handle and a msgid. This will ensure we know which request the app
  1368. // is waiting on a reply to. (we actively resend request until we get
  1369. // a response.)
  1370. //
  1371. {$EXTERNALSYM ldap_result}
  1372. function ldap_result(ld: PLDAP; msgid, all: ULONG;
  1373. timeout: PLDAP_TIMEVAL; var res: PLDAPMessage): ULONG; cdecl;
  1374. {$EXTERNALSYM ldap_msgfree}
  1375. function ldap_msgfree(res: PLDAPMessage): ULONG; cdecl;
  1376. //
  1377. // This parses a message and returns the error code. It optionally frees
  1378. // the message by calling ldap_msgfree.
  1379. //
  1380. // multi-thread: ldap_result2error call is thread safe
  1381. // freeit is boolean.. free the message?
  1382. {$EXTERNALSYM ldap_result2error}
  1383. function ldap_result2error(ld: PLDAP; res: PLDAPMessage;
  1384. freeit: ULONG): ULONG; cdecl;
  1385. //
  1386. // Similar to ldap_result2error, this parses responses from the server and
  1387. // returns the appropriate fields. Use this one if you want to get at the
  1388. // referrals, matchingDNs, or server controls returned.
  1389. //
  1390. // multi-thread: ldap_parse_result call is thread safe
  1391. {$EXTERNALSYM ldap_parse_resultA}
  1392. function ldap_parse_resultA (
  1393. var Connection: LDAP;
  1394. ResultMessage: PLDAPMessage;
  1395. ReturnCode: PULONG; // returned by server
  1396. MatchedDNs: PPCharA; // free with ldap_memfree
  1397. ErrorMessage: PPCharA; // free with ldap_memfree
  1398. Referrals: PPPCharA; // free with ldap_value_freeW
  1399. var ServerControls: PPLDAPControlA; // free with ldap_free_controlsW
  1400. Freeit: BOOL): ULONG; cdecl;
  1401. {$EXTERNALSYM ldap_parse_resultW}
  1402. function ldap_parse_resultW (
  1403. var Connection: LDAP;
  1404. ResultMessage: PLDAPMessage;
  1405. ReturnCode: PULONG; // returned by server
  1406. MatchedDNs: PPCharW; // free with ldap_memfree
  1407. ErrorMessage: PPCharW; // free with ldap_memfree
  1408. Referrals: PPPCharW; // free with ldap_value_freeW
  1409. var ServerControls: PPLDAPControlW; // free with ldap_free_controlsW
  1410. Freeit: BOOL): ULONG; cdecl;
  1411. {$EXTERNALSYM ldap_parse_result}
  1412. function ldap_parse_result (
  1413. var Connection: LDAP;
  1414. ResultMessage: PLDAPMessage;
  1415. ReturnCode: PULONG; // returned by server
  1416. MatchedDNs: PPChar; // free with ldap_memfree
  1417. ErrorMessage: PPChar; // free with ldap_memfree
  1418. Referrals: PPPChar; // free with ldap_value_freeW
  1419. var ServerControls: PPLDAPControl; // free with ldap_free_controlsW
  1420. Freeit: BOOL): ULONG; cdecl;
  1421. {$EXTERNALSYM ldap_controls_freeA}
  1422. function ldap_controls_freeA(var Controls: PLDAPControlA): ULONG; cdecl;
  1423. {$EXTERNALSYM ldap_controls_freeW}
  1424. function ldap_controls_freeW(var Controls: PLDAPControlW): ULONG; cdecl;
  1425. {$EXTERNALSYM ldap_controls_free}
  1426. function ldap_controls_free(var Controls: PLDAPControl): ULONG; cdecl;
  1427. {$EXTERNALSYM ldap_parse_extended_resultA}
  1428. function ldap_parse_extended_resultA(
  1429. Connection: PLDAP;
  1430. ResultMessage: PLDAPMessage; // returned by server
  1431. var ResultOID: PAnsiChar; // free with ldap_memfree
  1432. var ResultData: PBERVAL; // free with ldap_memfree
  1433. Freeit: ByteBool // Don't need the message anymore
  1434. ): ULONG; cdecl;
  1435. {$EXTERNALSYM ldap_parse_extended_resultW}
  1436. function ldap_parse_extended_resultW(
  1437. Connection: PLDAP;
  1438. ResultMessage: PLDAPMessage; // returned by server
  1439. var ResultOID: PWideChar; // free with ldap_memfree
  1440. var ResultData: PBERVAL; // free with ldap_memfree
  1441. Freeit: ByteBool // Don't need the message anymore
  1442. ): ULONG; cdecl;
  1443. {$EXTERNALSYM ldap_parse_extended_result}
  1444. function ldap_parse_extended_result(
  1445. Connection: PLDAP;
  1446. ResultMessage: PLDAPMessage; // returned by server
  1447. var ResultOID: PChar; // free with ldap_memfree
  1448. var ResultData: PBERVAL; // free with ldap_memfree
  1449. Freeit: ByteBool // Don't need the message anymore
  1450. ): ULONG; cdecl;
  1451. {$EXTERNALSYM ldap_control_freeA}
  1452. function ldap_control_freeA(var Control: LDAPControlA): ULONG; cdecl;
  1453. {$EXTERNALSYM ldap_control_freeW}
  1454. function ldap_control_freeW(var Control: LDAPControlW): ULONG; cdecl;
  1455. {$EXTERNALSYM ldap_control_free}
  1456. function ldap_control_free(var Control: LDAPControl): ULONG; cdecl;
  1457. //
  1458. // ldap_free_controls are old, use ldap_controls_free
  1459. //
  1460. {$EXTERNALSYM ldap_free_controlsA}
  1461. function ldap_free_controlsA(var Controls: PLDAPControlA): ULONG; cdecl;
  1462. {$EXTERNALSYM ldap_free_controlsW}
  1463. function ldap_free_controlsW(var Controls: PLDAPControlW): ULONG; cdecl;
  1464. {$EXTERNALSYM ldap_free_controls}
  1465. function ldap_free_controls(var Controls: PLDAPControl): ULONG; cdecl;
  1466. //
  1467. // ldap_err2string returns a pointer to a string describing the error. This
  1468. // string should not be freed.
  1469. //
  1470. {$EXTERNALSYM ldap_err2stringA}
  1471. function ldap_err2stringA(err: ULONG): PAnsiChar; cdecl;
  1472. {$EXTERNALSYM ldap_err2stringW}
  1473. function ldap_err2stringW(err: ULONG): PWideChar; cdecl;
  1474. {$EXTERNALSYM ldap_err2string}
  1475. function ldap_err2string(err: ULONG): PChar; cdecl;
  1476. //
  1477. // ldap_perror does nothing and is here just for compatibility.
  1478. //
  1479. {$EXTERNALSYM ldap_perror}
  1480. procedure ldap_perror(ld: PLDAP; msg: PChar); cdecl;
  1481. //
  1482. // Return the first entry of a message. It is freed when the message is
  1483. // freed so should not be freed explicitly.
  1484. //
  1485. {$EXTERNALSYM ldap_first_entry}
  1486. function ldap_first_entry(ld: PLDAP; res: PLDAPMessage): PLDAPMessage; cdecl;
  1487. //
  1488. // Return the next entry of a message. It is freed when the message is
  1489. // freed so should not be freed explicitly.
  1490. //
  1491. {$EXTERNALSYM ldap_next_entry}
  1492. function ldap_next_entry(ld: PLDAP; entry: PLDAPMessage): PLDAPMessage; cdecl;
  1493. //
  1494. // Count the number of search entries returned by the server in a response
  1495. // to a server request.
  1496. //
  1497. {$EXTERNALSYM ldap_count_entries}
  1498. function ldap_count_entries(ld: PLDAP; res: PLDAPMessage): ULONG; cdecl;
  1499. //
  1500. // A BerElement really maps out to a C++ class object that does BER encoding.
  1501. // Don't mess with it as it's opaque.
  1502. //
  1503. type
  1504. PBerElement = ^BerElement;
  1505. {$EXTERNALSYM BerElement}
  1506. BerElement = record
  1507. opaque: PChar; // this is an opaque structure used just for
  1508. // compatibility with reference implementation
  1509. end;
  1510. const
  1511. {$EXTERNALSYM NULLBER}
  1512. NULLBER = PBerElement(nil);
  1513. //
  1514. // For a given entry, return the first attribute. The pointer returned is
  1515. // actually a buffer in the connection block(with allowances for
  1516. // multi-threaded apps)so it should not be freed.
  1517. //
  1518. {$EXTERNALSYM ldap_first_attributeA}
  1519. function ldap_first_attributeA(ld: PLDAP; entry: PLDAPMessage;
  1520. var ptr: PBerElement): PAnsiChar; cdecl;
  1521. {$EXTERNALSYM ldap_first_attributeW}
  1522. function ldap_first_attributeW(ld: PLDAP; entry: PLDAPMessage;
  1523. var ptr: PBerElement): PWideChar; cdecl;
  1524. {$EXTERNALSYM ldap_first_attribute}
  1525. function ldap_first_attribute(ld: PLDAP; entry: PLDAPMessage;
  1526. var ptr: PBerElement): PChar; cdecl;
  1527. //
  1528. // Return the next attribute... again, the attribute pointer should not be
  1529. // freed.
  1530. //
  1531. {$EXTERNALSYM ldap_next_attributeA}
  1532. function ldap_next_attributeA(ld: PLDAP; entry: PLDAPMessage;
  1533. ptr: PBerElement): PAnsiChar; cdecl;
  1534. {$EXTERNALSYM ldap_next_attributeW}
  1535. function ldap_next_attributeW(ld: PLDAP; entry: PLDAPMessage;
  1536. ptr: PBerElement): PWideChar; cdecl;
  1537. {$EXTERNALSYM ldap_next_attribute}
  1538. function ldap_next_attribute(ld: PLDAP; entry: PLDAPMessage;
  1539. ptr: PBerElement): PChar; cdecl;
  1540. //
  1541. // Get a given attribute's list of values. This is used during parsing of
  1542. // a search response. It returns a list of pointers to values, the list is
  1543. // null terminated.
  1544. //
  1545. // If the values are generic octet strings and not null terminated strings,
  1546. // use ldap_get_values_len instead.
  1547. //
  1548. // The returned value should be freed when your done with it by calling
  1549. // ldap_value_free.
  1550. //
  1551. {$EXTERNALSYM ldap_get_valuesA}
  1552. function ldap_get_valuesA(ld: PLDAP; entry: PLDAPMessage;
  1553. attr: PAnsiChar): PPCharA; cdecl;
  1554. {$EXTERNALSYM ldap_get_valuesW}
  1555. function ldap_get_valuesW(ld: PLDAP; entry: PLDAPMessage;
  1556. attr: PWideChar): PPCharW; cdecl;
  1557. {$EXTERNALSYM ldap_get_values}
  1558. function ldap_get_values(ld: PLDAP; entry: PLDAPMessage;
  1559. attr: PChar): PPChar; cdecl;
  1560. //
  1561. // Get a given attribute's list of values. This is used during parsing of
  1562. // a search response. It returns a list of berval structures to values,
  1563. // the list is null terminated.
  1564. //
  1565. // If the values are null terminated strings, it may be easier to process them
  1566. // by calling ldap_get_values instead.
  1567. //
  1568. // The returned value should be freed when your done with it by calling
  1569. // ldap_value_free_len.
  1570. //
  1571. {$EXTERNALSYM ldap_get_values_lenA}
  1572. function ldap_get_values_lenA(ExternalHandle: PLDAP; Message: PLDAPMessage;
  1573. attr: PAnsiChar): PPLDAPBerVal; cdecl;
  1574. {$EXTERNALSYM ldap_get_values_lenW}
  1575. function ldap_get_values_lenW(ExternalHandle: PLDAP; Message: PLDAPMessage;
  1576. attr: PWideChar): PPLDAPBerVal; cdecl;
  1577. {$EXTERNALSYM ldap_get_values_len}
  1578. function ldap_get_values_len(ExternalHandle: PLDAP; Message: PLDAPMessage;
  1579. attr: PChar): PPLDAPBerVal; cdecl;
  1580. //
  1581. // Return the number of values in a list returned by ldap_get_values.
  1582. //
  1583. {$EXTERNALSYM ldap_count_valuesA}
  1584. function ldap_count_valuesA(vals: PPCharA): ULONG; cdecl;
  1585. {$EXTERNALSYM ldap_count_valuesW}
  1586. function ldap_count_valuesW(vals: PPCharW): ULONG; cdecl;
  1587. {$EXTERNALSYM ldap_count_values}
  1588. function ldap_count_values(vals: PPChar): ULONG; cdecl;
  1589. //
  1590. // Return the number of values in a list returned by ldap_get_values_len.
  1591. //
  1592. {$EXTERNALSYM ldap_count_values_len}
  1593. function ldap_count_values_len(vals: PPLDAPBerVal): ULONG; cdecl;
  1594. //
  1595. // Free structures returned by ldap_get_values.
  1596. //
  1597. {$EXTERNALSYM ldap_value_freeA}
  1598. function ldap_value_freeA(vals: PPCharA): ULONG; cdecl;
  1599. {$EXTERNALSYM ldap_value_freeW}
  1600. function ldap_value_freeW(vals: PPCharW): ULONG; cdecl;
  1601. {$EXTERNALSYM ldap_value_free}
  1602. function ldap_value_free(vals: PPChar): ULONG; cdecl;
  1603. //
  1604. // Free structures returned by ldap_get_values_len.
  1605. //
  1606. {$EXTERNALSYM ldap_value_free_len}
  1607. function ldap_value_free_len(vals: PPLDAPBerVal): ULONG; cdecl;
  1608. //
  1609. // Get the distinguished name for a given search entry. It should be freed
  1610. // by calling ldap_memfree.
  1611. //
  1612. {$EXTERNALSYM ldap_get_dnA}
  1613. function ldap_get_dnA(ld: PLDAP; entry: PLDAPMessage): PAnsiChar; cdecl;
  1614. {$EXTERNALSYM ldap_get_dnW}
  1615. function ldap_get_dnW(ld: PLDAP; entry: PLDAPMessage): PWideChar; cdecl;
  1616. {$EXTERNALSYM ldap_get_dn}
  1617. function ldap_get_dn(ld: PLDAP; entry: PLDAPMessage): PChar; cdecl;
  1618. //
  1619. // When using ldap_explode_dn, you should free the returned string by
  1620. // calling ldap_value_free.
  1621. //
  1622. {$EXTERNALSYM ldap_explode_dnA}
  1623. function ldap_explode_dnA(dn: PAnsiChar; notypes: ULONG): PPCharA; cdecl;
  1624. {$EXTERNALSYM ldap_explode_dnW}
  1625. function ldap_explode_dnW(dn: PWideChar; notypes: ULONG): PPCharW; cdecl;
  1626. {$EXTERNALSYM ldap_explode_dn}
  1627. function ldap_explode_dn(dn: PChar; notypes: ULONG): PPChar; cdecl;
  1628. //
  1629. // When calling ldap_dn2ufn, you should free the returned string by calling
  1630. // ldap_memfree.
  1631. //
  1632. {$EXTERNALSYM ldap_dn2ufnA}
  1633. function ldap_dn2ufnA(dn: PAnsiChar): PAnsiChar; cdecl;
  1634. {$EXTERNALSYM ldap_dn2ufnW}
  1635. function ldap_dn2ufnW(dn: PWideChar): PWideChar; cdecl;
  1636. {$EXTERNALSYM ldap_dn2ufn}
  1637. function ldap_dn2ufn(dn: PChar): PChar; cdecl;
  1638. //
  1639. // This is used to free strings back to the LDAP API heap. Don't pass in
  1640. // values that you've gotten from ldap_open, ldap_get_values, etc.
  1641. //
  1642. {$EXTERNALSYM ldap_memfreeA}
  1643. procedure ldap_memfreeA(Block: PAnsiChar); cdecl;
  1644. {$EXTERNALSYM ldap_memfreeW}
  1645. procedure ldap_memfreeW(Block: PWideChar); cdecl;
  1646. {$EXTERNALSYM ldap_memfree}
  1647. procedure ldap_memfree(Block: PChar); cdecl;
  1648. {$EXTERNALSYM ber_bvfree}
  1649. procedure ber_bvfree(bv: PLDAPBerVal); cdecl;
  1650. //
  1651. // The function ldap_ufn2dn attempts to "normalize" a user specified DN
  1652. // to make it "proper". It follows RFC 1781(add CN= if not present,
  1653. // add OU= if none present, etc). If it runs into any problems at all
  1654. // while normalizing, it simply returns a copy of what was passed in.
  1655. //
  1656. // It allocates the output string from the LDAP memory pool. If the pDn
  1657. // comes back as non-NULL, you should free it when you're done with a call
  1658. // to ldap_memfree.
  1659. //
  1660. {$EXTERNALSYM ldap_ufn2dnA}
  1661. function ldap_ufn2dnA(ufn: PAnsiChar; var pDn: PAnsiChar): ULONG; cdecl;
  1662. {$EXTERNALSYM ldap_ufn2dnW}
  1663. function ldap_ufn2dnW(ufn: PWideChar; var pDn: PWideChar): ULONG; cdecl;
  1664. {$EXTERNALSYM ldap_ufn2dn}
  1665. function ldap_ufn2dn(ufn: PChar; var pDn: PChar): ULONG; cdecl;
  1666. const
  1667. {$EXTERNALSYM LBER_USE_DER}
  1668. LBER_USE_DER = $01;
  1669. {$EXTERNALSYM LBER_USE_INDEFINITE_LEN}
  1670. LBER_USE_INDEFINITE_LEN = $02;
  1671. {$EXTERNALSYM LBER_TRANSLATE_STRINGS}
  1672. LBER_TRANSLATE_STRINGS = $04;
  1673. //
  1674. // Call to initialize the LDAP library. Pass in a version structure with
  1675. // lv_size set to sizeof(LDAP_VERSION), lv_major set to LAPI_MAJOR_VER1,
  1676. // and lv_minor set to LAPI_MINOR_VER1. Return value will be either
  1677. // LDAP_SUCCESS if OK or LDAP_OPERATIONS_ERROR if can't be supported.
  1678. //
  1679. {$EXTERNALSYM LAPI_MAJOR_VER1}
  1680. LAPI_MAJOR_VER1 = 1;
  1681. {$EXTERNALSYM LAPI_MINOR_VER1}
  1682. LAPI_MINOR_VER1 = 1;
  1683. type
  1684. PLDAPVersionInfo = ^TLDAPVersionInfo;
  1685. {$EXTERNALSYM PLDAP_VERSION_INFO}
  1686. PLDAP_VERSION_INFO = ^LDAP_VERSION_INFO;
  1687. {$EXTERNALSYM LDAP_VERSION_INFO}
  1688. LDAP_VERSION_INFO = record
  1689. lv_size: ULONG;
  1690. lv_major: ULONG;
  1691. lv_minor: ULONG;
  1692. end;
  1693. TLDAPVersionInfo = LDAP_VERSION_INFO;
  1694. {$EXTERNALSYM ldap_startup}
  1695. function ldap_startup(var version: TLDAPVersionInfo): ULONG; cdecl;
  1696. //
  1697. // ldap_cleanup unloads the library when the refcount of opens goes to zero.
  1698. // (i.e. if a DLL calls it within a program that is also using it, it won't
  1699. // free all resources)
  1700. //
  1701. {$EXTERNALSYM ldap_cleanup}
  1702. function ldap_cleanup(hInstance: THandle): ULONG; cdecl;
  1703. //
  1704. // Extended API to support allowing opaque blobs of data in search filters.
  1705. // This API takes any filter element and converts it to a safe text string that
  1706. // can safely be passed in a search filter.
  1707. // An example of using this is :
  1708. //
  1709. // filter is something like guid=4826BF6CF0123444
  1710. // this will put out on the wire guid of binary 0x4826BF6CF0123444
  1711. //
  1712. // call ldap_escape_filter_element with sourceFilterElement pointing to
  1713. // raw data, sourceCount set appropriately to length of data.
  1714. //
  1715. // if destFilterElement is NULL, then return value is length required for
  1716. // output buffer.
  1717. //
  1718. // if destFilterElement is not NULL, then the function will copy the source
  1719. // into the dest buffer and ensure that it is of a safe format.
  1720. //
  1721. // then simply insert the dest buffer into your search filter after the
  1722. // "attributetype=".
  1723. //
  1724. // this will put out on the wire guid of binary 0x004826BF6CF000123444
  1725. //
  1726. // Note : don't call this for attribute values that are really strings, as
  1727. // we won't do any conversion from what you passed in to UTF-8. Should only
  1728. // be used for attributes that really are raw binary.
  1729. //
  1730. {$EXTERNALSYM ldap_escape_filter_elementA}
  1731. function ldap_escape_filter_elementA(
  1732. sourceFilterElement: PChar; sourceLength: ULONG;
  1733. destFilterElement: PAnsiChar; destLength: ULONG): ULONG; cdecl;
  1734. {$EXTERNALSYM ldap_escape_filter_elementW}
  1735. function ldap_escape_filter_elementW(
  1736. sourceFilterElement: PChar; sourceLength: ULONG;
  1737. destFilterElement: PWideChar; destLength: ULONG): ULONG; cdecl;
  1738. {$EXTERNALSYM ldap_escape_filter_element}
  1739. function ldap_escape_filter_element(
  1740. sourceFilterElement: PChar; sourceLength: ULONG;
  1741. destFilterElement: PChar; destLength: ULONG): ULONG; cdecl;
  1742. //
  1743. // Misc extensions for additional debugging.
  1744. //
  1745. // Note that these do nothing on free builds.
  1746. //
  1747. {$EXTERNALSYM ldap_set_dbg_flags}
  1748. function ldap_set_dbg_flags(NewFlags: ULONG): ULONG; cdecl;
  1749. // NOTE by translator: Original function type has ellipsis, which means
  1750. // there can be var_args. Object Pascal doesn't support this, so you'll
  1751. // have to define a function that does what you want (probably using BASM
  1752. // to get the extra parameters, or linking a C function), and then cast
  1753. // that to TDbgPrint.
  1754. type
  1755. {$EXTERNALSYM DBGPRINT}
  1756. DBGPRINT = function(Format: PChar {; ...} ): ULONG cdecl;
  1757. TDbgPrint = DBGPRINT;
  1758. {$EXTERNALSYM ldap_set_dbg_routine}
  1759. procedure ldap_set_dbg_routine(DebugPrintRoutine: TDbgPrint); cdecl;
  1760. //
  1761. // These routines are possibly useful by other modules. Note that Win95
  1762. // doesn't by default have the UTF-8 codepage loaded. So a good way to
  1763. // convert from UTF-8 to Unicode.
  1764. //
  1765. {$EXTERNALSYM LdapUTF8ToUnicode}
  1766. function LdapUTF8ToUnicode(lpSrcStr: LPCSTR; cchSrc: Integer;
  1767. lpDestStr: LPWSTR; cchDest: Integer): Integer; cdecl;
  1768. {$EXTERNALSYM LdapUnicodeToUTF8}
  1769. function LdapUnicodeToUTF8(lpSrcStr: LPCWSTR; cchSrc: Integer;
  1770. lpDestStr: LPSTR; cchDest: Integer): Integer; cdecl;
  1771. //
  1772. // LDAPv3 features :
  1773. //
  1774. // Sort Keys... these are used to ask the server to sort the results
  1775. // before sending the results back. LDAPv3 only and optional to implement
  1776. // on the server side. Check supportedControl for an OID of
  1777. // "1.2.840.113556.1.4.473" to see if the server supports it.
  1778. //
  1779. const
  1780. {$EXTERNALSYM LDAP_SERVER_SORT_OID}
  1781. LDAP_SERVER_SORT_OID = '1.2.840.113556.1.4.473';
  1782. {$EXTERNALSYM LDAP_SERVER_SORT_OID_W}
  1783. LDAP_SERVER_SORT_OID_W = '1.2.840.113556.1.4.473';
  1784. {$EXTERNALSYM LDAP_SERVER_RESP_SORT_OID}
  1785. LDAP_SERVER_RESP_SORT_OID = '1.2.840.113556.1.4.474';
  1786. {$EXTERNALSYM LDAP_SERVER_RESP_SORT_OID_W}
  1787. LDAP_SERVER_RESP_SORT_OID_W = '1.2.840.113556.1.4.474';
  1788. {
  1789. NOTE from translator: I'm not quite sure about the following
  1790. declaration:
  1791. typedef struct ldapsearch LDAPSearch, *PLDAPSearch;
  1792. }
  1793. type
  1794. // Note from translator:
  1795. // The following two types don't have a TLDAPxxx type declared, since they are
  1796. // meant as opaque pointer types only, so a TLDAPxxx is not needed.
  1797. {$EXTERNALSYM PLDAPSearch}
  1798. PLDAPSearch = ^LDAPSearch;
  1799. {$EXTERNALSYM LDAPSearch}
  1800. LDAPSearch = record end;
  1801. {$EXTERNALSYM PLDAPSortKeyA}
  1802. PLDAPSortKeyA = ^LDAPSortKeyA;
  1803. {$EXTERNALSYM PLDAPSortKeyW}
  1804. PLDAPSortKeyW = ^LDAPSortKeyW;
  1805. {$EXTERNALSYM PLDAPSortKey}
  1806. PLDAPSortKey = PLDAPSortKeyA;
  1807. {$EXTERNALSYM LDAPSortKeyA}
  1808. LDAPSortKeyA = packed record
  1809. sk_attrtype: PAnsiChar;
  1810. sk_matchruleoid: PAnsiChar;
  1811. sk_reverseorder: ByteBool;
  1812. end;
  1813. {$EXTERNALSYM LDAPSortKeyW}
  1814. LDAPSortKeyW = packed record
  1815. sk_attrtype: PWideChar;
  1816. sk_matchruleoid: PWideChar;
  1817. sk_reverseorder: ByteBool;
  1818. end;
  1819. {$EXTERNALSYM LDAPSortKey}
  1820. LDAPSortKey = LDAPSortKeyA;
  1821. //
  1822. // This API formats a list of sort keys into a search control. Call
  1823. // ldap_control_free when you're finished with the control.
  1824. //
  1825. // Use this one rather than ldap_encode_sort_control as this is per RFC.
  1826. //
  1827. {$EXTERNALSYM ldap_create_sort_controlA}
  1828. function ldap_create_sort_controlA(ExternalHandle: PLDAP;
  1829. var SortKeys: PLDAPSortKeyA; IsCritical: UCHAR;
  1830. var Control: PLDAPControlA): ULONG; cdecl;
  1831. {$EXTERNALSYM ldap_create_sort_controlW}
  1832. function ldap_create_sort_controlW(ExternalHandle: PLDAP;
  1833. var SortKeys: PLDAPSortKeyW; IsCritical: UCHAR;
  1834. var Control: PLDAPControlW): ULONG; cdecl;
  1835. {$EXTERNALSYM ldap_create_sort_control}
  1836. function ldap_create_sort_control(ExternalHandle: PLDAP;
  1837. var SortKeys: PLDAPSortKey; IsCritical: UCHAR;
  1838. var Control: PLDAPControl): ULONG; cdecl;
  1839. //
  1840. // This API parses the sort control returned by the server. Use ldap_memfree
  1841. // to free the attribute value, if it's returned.
  1842. //
  1843. {$EXTERNALSYM ldap_parse_sort_controlA}
  1844. function ldap_parse_sort_controlA(ExternalHandle: PLDAP;
  1845. var Control: PLDAPControlA; var Result: ULONG;
  1846. var Attribute: PAnsiChar): ULONG; cdecl;
  1847. {$EXTERNALSYM ldap_parse_sort_controlW}
  1848. function ldap_parse_sort_controlW(ExternalHandle: PLDAP;
  1849. var Control: PLDAPControlW; var Result: ULONG;
  1850. var Attribute: PWideChar): ULONG; cdecl;
  1851. {$EXTERNALSYM ldap_parse_sort_control}
  1852. function ldap_parse_sort_control(ExternalHandle: PLDAP;
  1853. var Control: PLDAPControl; var Result: ULONG;
  1854. var Attribute: PChar): ULONG; cdecl;
  1855. //
  1856. // This API formats a list of sort keys into a search control. Call
  1857. // ldap_memfree for both Control->ldctl_value.bv_val and
  1858. // Control->currentControl->ldctl_oid when you're finished with the control.
  1859. //
  1860. // This is the old sort API that will be shortly pulled. Please use
  1861. // ldap_create_sort_control defined above.
  1862. //
  1863. {$EXTERNALSYM ldap_encode_sort_controlA}
  1864. function ldap_encode_sort_controlA(ExternalHandle: PLDAP;
  1865. var SortKeys: PLDAPSortKeyA; Control: PLDAPControlA;
  1866. Criticality: ByteBool): ULONG; cdecl;
  1867. {$EXTERNALSYM ldap_encode_sort_controlW}
  1868. function ldap_encode_sort_controlW(ExternalHandle: PLDAP;
  1869. var SortKeys: PLDAPSortKeyW; Control: PLDAPControlW;
  1870. Criticality: ByteBool): ULONG; cdecl;
  1871. {$EXTERNALSYM ldap_encode_sort_control}
  1872. function ldap_encode_sort_control(ExternalHandle: PLDAP;
  1873. var SortKeys: PLDAPSortKey; Control: PLDAPControl;
  1874. Criticality: ByteBool): ULONG; cdecl;
  1875. //
  1876. // LDAPv3: This is the RFC defined API for the simple paging of results
  1877. // control. Use ldap_control_free to free the control allocated by
  1878. // ldap_create_page_control.
  1879. //
  1880. {$EXTERNALSYM ldap_create_page_controlA}
  1881. function ldap_create_page_controlA(ExternalHandle: PLDAP;
  1882. PageSize: ULONG; var Cookie: TLDAPBerVal; IsCritical: UCHAR;
  1883. var Control: PLDAPControlA): ULONG; cdecl;
  1884. {$EXTERNALSYM ldap_create_page_controlW}
  1885. function ldap_create_page_controlW(ExternalHandle: PLDAP;
  1886. PageSize: ULONG; var Cookie: TLDAPBerVal; IsCritical: UCHAR;
  1887. var Control: PLDAPControlW): ULONG; cdecl;
  1888. {$EXTERNALSYM ldap_create_page_control}
  1889. function ldap_create_page_control(ExternalHandle: PLDAP;
  1890. PageSize: ULONG; var Cookie: TLDAPBerVal; IsCritical: UCHAR;
  1891. var Control: PLDAPControl): ULONG; cdecl;
  1892. {$EXTERNALSYM ldap_parse_page_controlA}
  1893. function ldap_parse_page_controlA(ExternalHandle: PLDAP;
  1894. ServerControls: PPLDAPControlA; var TotalCount: ULONG;
  1895. var Cookie: PLDAPBerVal): ULONG; cdecl; // Use ber_bvfree to free Cookie
  1896. {$EXTERNALSYM ldap_parse_page_controlW}
  1897. function ldap_parse_page_controlW(ExternalHandle: PLDAP;
  1898. ServerControls: PPLDAPControlW; var TotalCount: ULONG;
  1899. var Cookie: PLDAPBerVal): ULONG; cdecl; // Use ber_bvfree to free Cookie
  1900. {$EXTERNALSYM ldap_parse_page_control}
  1901. function ldap_parse_page_control(ExternalHandle: PLDAP;
  1902. ServerControls: PPLDAPControl; var TotalCount: ULONG;
  1903. var Cookie: PLDAPBerVal): ULONG; cdecl; // Use ber_bvfree to free Cookie
  1904. //
  1905. // LDAPv3: This is the interface for simple paging of results. To ensure
  1906. // that the server supports it, check the supportedControl property off of
  1907. // the root for an OID of 1.2.840.113556.1.4.319. If it is there, then it
  1908. // supports this feature.
  1909. //
  1910. // If you're going to specify sort keys, see section above on sort keys on
  1911. // now to tell if they're supported by the server.
  1912. //
  1913. // You first call ldap_search_init_page. If it returns a non-NULL LDAPSearch
  1914. // block, then it worked ok. Otherwise call LdapGetLastError to find error.
  1915. //
  1916. // With a valid LDAPSearch block (there are opaque), call ldap_get_next_page
  1917. // or ldap_get_next_page_s. If you call ldap_get_next_page, you MUST call
  1918. // ldap_get_paged_count for each set of results that you get for that message.
  1919. // This allows the library to save off the cookie that the server sent to
  1920. // resume the search.
  1921. //
  1922. // Other than calling ldap_get_paged_count, the results you get back from
  1923. // ldap_get_next_page can be treated as any other search result, and should
  1924. // be freed when you're done by calling ldap_msgfree.
  1925. //
  1926. // When the end of the search is hit, you'll get a return code of
  1927. // LDAP_NO_RESULTS_RETURNED. At this point, (or any point after LDAPSearch
  1928. // structure has been allocated), you call ldap_search_abandon_page. You
  1929. // need to call this even after you get a return code of
  1930. // LDAP_NO_RESULTS_RETURNED.
  1931. //
  1932. // If you call ldap_get_next_page_s, you don't need to call
  1933. // ldap_get_paged_count.
  1934. //
  1935. const
  1936. {$EXTERNALSYM LDAP_PAGED_RESULT_OID_STRING}
  1937. LDAP_PAGED_RESULT_OID_STRING = '1.2.840.113556.1.4.319';
  1938. {$EXTERNALSYM LDAP_PAGED_RESULT_OID_STRING_W}
  1939. LDAP_PAGED_RESULT_OID_STRING_W = '1.2.840.113556.1.4.319';
  1940. {$EXTERNALSYM ldap_search_init_pageA}
  1941. function ldap_search_init_pageA(ExternalHandle: PLDAP;
  1942. DistinguishedName: PAnsiChar; ScopeOfSearch: ULONG; SearchFilter: PAnsiChar;
  1943. AttributeList: PPCharA; AttributesOnly: ULONG;
  1944. var ServerControls, ClientControls: PLDAPControlA;
  1945. PageTimeLimit, TotalSizeLimit: ULONG;
  1946. var SortKeys: PLDAPSortKeyA): PLDAPSearch; cdecl;
  1947. {$EXTERNALSYM ldap_search_init_pageW}
  1948. function ldap_search_init_pageW(ExternalHandle: PLDAP;
  1949. DistinguishedName: PWideChar; ScopeOfSearch: ULONG; SearchFilter: PWideChar;
  1950. AttributeList: PPCharW; AttributesOnly: ULONG;
  1951. var ServerControls, ClientControls: PLDAPControlW;
  1952. PageTimeLimit, TotalSizeLimit: ULONG;
  1953. var SortKeys: PLDAPSortKeyW): PLDAPSearch; cdecl;
  1954. {$EXTERNALSYM ldap_search_init_page}
  1955. function ldap_search_init_page(ExternalHandle: PLDAP;
  1956. DistinguishedName: PChar; ScopeOfSearch: ULONG; SearchFilter: PChar;
  1957. AttributeList: PPChar; AttributesOnly: ULONG;
  1958. var ServerControls, ClientControls: PLDAPControl;
  1959. PageTimeLimit, TotalSizeLimit: ULONG;
  1960. var SortKeys: PLDAPSortKey): PLDAPSearch; cdecl;
  1961. {$EXTERNALSYM ldap_get_next_page}
  1962. function ldap_get_next_page(ExternalHandle: PLDAP; SearchHandle: PLDAPSearch;
  1963. PageSize: ULONG; var MessageNumber: ULONG): ULONG; cdecl;
  1964. {$EXTERNALSYM ldap_get_next_page_s}
  1965. function ldap_get_next_page_s(ExternalHandle: PLDAP; SearchHandle: PLDAPSearch;
  1966. var timeout: TLDAPTimeVal; PageSize: ULONG; var TotalCount: ULONG;
  1967. var Results: PLDAPMessage): ULONG; cdecl;
  1968. {$EXTERNALSYM ldap_get_paged_count}
  1969. function ldap_get_paged_count(ExternalHandle: PLDAP; SearchBlock: PLDAPSearch;
  1970. var TotalCount: ULONG; Results: PLDAPMessage): ULONG; cdecl;
  1971. {$EXTERNALSYM ldap_search_abandon_page}
  1972. function ldap_search_abandon_page(ExternalHandle: PLDAP;
  1973. SearchBlock: PLDAPSearch): ULONG; cdecl;
  1974. //
  1975. // These functions return subordinate referrals (references) that are returned
  1976. // in search responses. There are two types of referrals. External referrals
  1977. // where the naming context doesn't reside on the server (e.g. server says 'I
  1978. // don't have the data, look over there') and Subordinate referrals (or
  1979. // references) where some data has been returned and the referrals are passed
  1980. // to other naming contexts below the current one (e.g. servers says 'Here's
  1981. // some data from the tree I hold, go look here, there, and over there for
  1982. // more data that is further down in the tree.').
  1983. //
  1984. // These routines handle the latter. For external references, use
  1985. // ldap_parse_result.
  1986. //
  1987. // Return the first reference from a message. It is freed when the message is
  1988. // freed so should not be freed explicitly.
  1989. //
  1990. {$EXTERNALSYM ldap_first_reference}
  1991. function ldap_first_reference(ld: PLDAP; res: PLDAPMessage): PLDAPMessage;
  1992. //
  1993. // Return the next entry of a message. It is freed when the message is
  1994. // freed so should not be freed explicitly.
  1995. //
  1996. {$EXTERNALSYM ldap_next_reference}
  1997. function ldap_next_reference(ld: PLDAP; entry: PLDAPMessage): PLDAPMessage;
  1998. //
  1999. // Count the number of subordinate references returned by the server in a
  2000. // response to a search request.
  2001. //
  2002. {$EXTERNALSYM ldap_count_references}
  2003. function ldap_count_references(ld: PLDAP; res: PLDAPMessage): ULONG; cdecl;
  2004. //
  2005. // We return the list of subordinate referrals in a search response message.
  2006. //
  2007. // free Referrals with ldap_value_freeW
  2008. {$EXTERNALSYM ldap_parse_referenceA}
  2009. function ldap_parse_referenceA(Connection: PLDAP; ResultMessage: PLDAPMessage;
  2010. var Referrals: PPCharA): ULONG; cdecl;
  2011. {$EXTERNALSYM ldap_parse_referenceW}
  2012. function ldap_parse_referenceW(Connection: PLDAP; ResultMessage: PLDAPMessage;
  2013. var Referrals: PPCharW): ULONG; cdecl;
  2014. {$EXTERNALSYM ldap_parse_reference}
  2015. function ldap_parse_reference(Connection: PLDAP; ResultMessage: PLDAPMessage;
  2016. var Referrals: PPChar): ULONG; cdecl;
  2017. //
  2018. // These APIs allow a client to send an extended request (free for all) to
  2019. // an LDAPv3 (or above) server. The functionality is fairly open... you can
  2020. // send any request you'd like. Note that since we don't know if you'll
  2021. // be receiving a single or multiple responses, you'll have to explicitly tell
  2022. // us when you're done with the request by calling ldap_close_extended_op.
  2023. //
  2024. // These are thread safe.
  2025. //
  2026. {$EXTERNALSYM ldap_extended_operationA}
  2027. function ldap_extended_operationA(ld: PLDAP; Oid: PAnsiChar;
  2028. var Data: TLDAPBerVal; var ServerControls, ClientControls: PLDAPControlA;
  2029. var MessageNumber: ULONG): ULONG; cdecl;
  2030. {$EXTERNALSYM ldap_extended_operationW}
  2031. function ldap_extended_operationW(ld: PLDAP; Oid: PWideChar;
  2032. var Data: TLDAPBerVal; var ServerControls, ClientControls: PLDAPControlW;
  2033. var MessageNumber: ULONG): ULONG; cdecl;
  2034. {$EXTERNALSYM ldap_extended_operation}
  2035. function ldap_extended_operation(ld: PLDAP; Oid: PChar;
  2036. var Data: TLDAPBerVal; var ServerControls, ClientControls: PLDAPControl;
  2037. var MessageNumber: ULONG): ULONG; cdecl;
  2038. {$EXTERNALSYM ldap_close_extended_op}
  2039. function ldap_close_extended_op(ld: PLDAP; MessageNumber: ULONG): ULONG; cdecl;
  2040. //
  2041. // Some enhancements that will probably never make it into the RFC related
  2042. // to callouts to allow external caching of connections.
  2043. //
  2044. // Call ldap_set_option( conn, LDAP_OPT_REFERRAL_CALLBACK, &referralRoutines )
  2045. // where referralRoutines is the address of an LDAP_REFERRAL_CALLBACK
  2046. // structure with your routines. They may be NULL, in which case we'll
  2047. // obviously not make the calls.
  2048. //
  2049. // Any connections that are created will inherit the current callbacks from
  2050. // the primary connection that the request was initiated on.
  2051. //
  2052. const
  2053. {$EXTERNALSYM LDAP_OPT_REFERRAL_CALLBACK}
  2054. LDAP_OPT_REFERRAL_CALLBACK = $70;
  2055. //
  2056. // This first routine is called when we're about to chase a referral. We
  2057. // callout to it to see if there is already a connection cached that we
  2058. // can use. If so, the callback routine returns the pointer to the
  2059. // connection to use in ConnectionToUse. If not, it sets
  2060. // *ConnectionToUse to NULL.
  2061. //
  2062. // For a return code, it should return 0 if we should continue to chase the
  2063. // referral. If it returns a non-zero return code, we'll treat that as the
  2064. // error code for chasing the referral. This allows caching of host names
  2065. // that are not reachable, if we decide to add that in the future.
  2066. //
  2067. type
  2068. {$EXTERNALSYM QUERYFORCONNECTION}
  2069. QUERYFORCONNECTION = function(
  2070. PrimaryConnection: PLDAP;
  2071. ReferralFromConnection: PLDAP;
  2072. NewDN: PWideChar;
  2073. HostName: PChar;
  2074. PortNumber: ULONG;
  2075. SecAuthIdentity: Pointer; // if null, use CurrentUser below
  2076. CurrentUserToken: Pointer; // pointer to current user's LUID
  2077. var ConnectionToUse: PLDAP):ULONG cdecl;
  2078. TQueryForConnection = QUERYFORCONNECTION;
  2079. //
  2080. // This next function is called when we've created a new connection while
  2081. // chasing a referral. Note that it gets assigned the same callback functions
  2082. // as the PrimaryConnection. If the return code is FALSE, then the call
  2083. // back function doesn't want to cache the connection and it will be
  2084. // destroyed after the operation is complete. If TRUE is returned, we'll
  2085. // assume that the callee has taken ownership of the connection and it will
  2086. // not be destroyed after the operation is complete.
  2087. //
  2088. // If the ErrorCodeFromBind field is not 0, then the bind operation to
  2089. // that server failed.
  2090. //
  2091. {$EXTERNALSYM NOTIFYOFNEWCONNECTION}
  2092. NOTIFYOFNEWCONNECTION = function(
  2093. PrimaryConnection: PLDAP;
  2094. ReferralFromConnection: PLDAP;
  2095. NewDN: PWideChar;
  2096. HostName: PChar;
  2097. NewConnection: PLDAP;
  2098. PortNumber: ULONG;
  2099. SecAuthIdentity: Pointer; // if null, use CurrentUser below
  2100. CurrentUser: Pointer; // pointer to current user's LUID
  2101. ErrorCodeFromBind: ULONG): ByteBool cdecl;
  2102. TNotifyOfNewConnection = NOTIFYOFNEWCONNECTION;
  2103. //
  2104. // This next function is called when we've successfully called off to the
  2105. // QueryForConnection call and received a connection OR when we called off
  2106. // to the NotifyOfNewConnection call and it returned TRUE. We call this
  2107. // function when we're dereferencing the connection after we're done with it.
  2108. //
  2109. // Return code is currently ignored, but the function should return
  2110. // LDAP_SUCCESS if all went well.
  2111. //
  2112. {$EXTERNALSYM DEREFERENCECONNECTION}
  2113. DEREFERENCECONNECTION = function(PrimaryConnection: PLDAP;
  2114. ConnectionToDereference: PLDAP): ULONG cdecl;
  2115. TDereferenceConnection = DEREFERENCECONNECTION;
  2116. PLDAPReferralCallback = ^TLDAPReferralCallback;
  2117. {$EXTERNALSYM LdapReferralCallback}
  2118. LdapReferralCallback = packed record
  2119. SizeOfCallbacks: ULONG; // set to sizeof( LDAP_REFERRAL_CALLBACK )
  2120. QueryForConnection: QUERYFORCONNECTION;
  2121. NotifyRoutine: NOTIFYOFNEWCONNECTION;
  2122. DereferenceRoutine: DEREFERENCECONNECTION;
  2123. end;
  2124. {$EXTERNALSYM LDAP_REFERRAL_CALLBACK}
  2125. LDAP_REFERRAL_CALLBACK = LdapReferralCallback;
  2126. {$EXTERNALSYM PLDAP_REFERRAL_CALLBACK}
  2127. PLDAP_REFERRAL_CALLBACK = ^LdapReferralCallback;
  2128. TLDAPReferralCallback = LdapReferralCallback;
  2129. //
  2130. // Thread Safe way to get last error code returned by LDAP API is to call
  2131. // LdapGetLastError();
  2132. //
  2133. {$EXTERNALSYM LdapGetLastError}
  2134. function LdapGetLastError: ULONG; cdecl;
  2135. //
  2136. // Translate from LdapError to closest Win32 error code.
  2137. //
  2138. {$EXTERNALSYM LdapMapErrorToWin32}
  2139. function LdapMapErrorToWin32(LdapError: ULONG): ULONG; cdecl;
  2140. //
  2141. // This is an arrangement for specifying client certificates while establishing
  2142. // an SSL connection.
  2143. // Simply Call ldap_set_option( conn, LDAP_OPT_CLIENT_CERTIFICATE, &CertRoutine )
  2144. // where CertRoutine is the address of your callback routine. If it is NULL,
  2145. // we will obviously not make the call.
  2146. //
  2147. const
  2148. {$EXTERNALSYM LDAP_OPT_CLIENT_CERTIFICATE}
  2149. LDAP_OPT_CLIENT_CERTIFICATE = $80;
  2150. //
  2151. // This callback is invoked when the server demands a client certificate for
  2152. // authorization. We pass a structure containing a list of server-trusted
  2153. // Certificate Authorities. If the client has certificates to provide, it
  2154. // converts them to CERT_CONTEXTs and adds them to the given certificate
  2155. // store. LDAP subsequently passes these credentials to the SSL server as part
  2156. // of the handshake.
  2157. //
  2158. type
  2159. {$EXTERNALSYM QUERYCLIENTCERT}
  2160. QUERYCLIENTCERT = function(
  2161. Connection: PLDAP;
  2162. trusted_CAs: Pointer {PSecPkgContext_IssuerListInfoEx};
  2163. hCertStore: LongWord {HCERTSTORE};
  2164. var pcCreds: DWORD
  2165. ): ByteBool cdecl;
  2166. //
  2167. // We are also giving an opportunity for the client to verify the certificate
  2168. // of the server. The client registers a callback which is invoked after the
  2169. // secure connection is setup. The server certificate is presented to the
  2170. // client who invokes it and decides it it is acceptable. To register this
  2171. // callback, simply call ldap_set_option( conn, LDAP_OPT_SERVER_CERTIFICATE, &CertRoutine )
  2172. //
  2173. const
  2174. {$EXTERNALSYM LDAP_OPT_SERVER_CERTIFICATE}
  2175. LDAP_OPT_SERVER_CERTIFICATE = $81;
  2176. //
  2177. // This function is called after the secure connection has been established. The
  2178. // certificate of the server is supplied for examination by the client. If the
  2179. // client approves it, it returns TRUE else, it returns false and the secure
  2180. // connection is torn down.
  2181. //
  2182. type
  2183. VERIFYSERVERCERT = function(
  2184. Connection: PLDAP;
  2185. pServerCert: Pointer {PCCERT_CONTEXT}
  2186. ): ByteBool cdecl;
  2187. //
  2188. // Given an LDAP message, return the connection pointer where the message
  2189. // came from. It can return NULL if the connection has already been freed.
  2190. //
  2191. {$EXTERNALSYM ldap_conn_from_msg}
  2192. function ldap_conn_from_msg(PrimaryConn: PLDAP; res: PLDAPMessage): PLDAP; cdecl;
  2193. //
  2194. // Do we reference the connection for each message so that we can safely get
  2195. // the connection pointer back by calling ldap_conn_from_msg?
  2196. //
  2197. const
  2198. {$EXTERNALSYM LDAP_OPT_REF_DEREF_CONN_PER_MSG}
  2199. LDAP_OPT_REF_DEREF_CONN_PER_MSG = $94;
  2200. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  2201. {$IFNDEF JWA_OMIT_SECTIONS}
  2202. implementation
  2203. //uses ...
  2204. {$ENDIF JWA_OMIT_SECTIONS}
  2205. {$IFNDEF JWA_INTERFACESECTION}
  2206. {$IFNDEF JWA_INCLUDEMODE}
  2207. const
  2208. LDAPLib = 'wldap32.dll';
  2209. {$ENDIF JWA_INCLUDEMODE}
  2210. function ldap_openA; external LDAPLib name 'ldap_openA';
  2211. function ldap_openW; external LDAPLib name 'ldap_openW';
  2212. function ldap_open; external LDAPLib name 'ldap_openA';
  2213. function ldap_initA; external LDAPLib name 'ldap_initA';
  2214. function ldap_initW; external LDAPLib name 'ldap_initW';
  2215. function ldap_init; external LDAPLib name 'ldap_initA';
  2216. function ldap_sslinitA; external LDAPLib name 'ldap_sslinitA';
  2217. function ldap_sslinitW; external LDAPLib name 'ldap_sslinitW';
  2218. function ldap_sslinit; external LDAPLib name 'ldap_sslinitA';
  2219. function cldap_openA; external LDAPLib name 'cldap_openA';
  2220. function cldap_openW; external LDAPLib name 'cldap_openW';
  2221. function cldap_open; external LDAPLib name 'cldap_openA';
  2222. function ldap_simple_bindA; external LDAPLib name 'ldap_simple_bindA';
  2223. function ldap_simple_bindW; external LDAPLib name 'ldap_simple_bindW';
  2224. function ldap_simple_bind; external LDAPLib name 'ldap_simple_bindA';
  2225. function ldap_simple_bind_sA; external LDAPLib name 'ldap_simple_bind_sA';
  2226. function ldap_simple_bind_sW; external LDAPLib name 'ldap_simple_bind_sW';
  2227. function ldap_simple_bind_s; external LDAPLib name 'ldap_simple_bind_sA';
  2228. function ldap_bindA; external LDAPLib name 'ldap_bindA';
  2229. function ldap_bindW; external LDAPLib name 'ldap_bindW';
  2230. function ldap_bind; external LDAPLib name 'ldap_bindA';
  2231. function ldap_bind_sA; external LDAPLib name 'ldap_bind_sA';
  2232. function ldap_bind_sW; external LDAPLib name 'ldap_bind_sW';
  2233. function ldap_bind_s; external LDAPLib name 'ldap_bind_sA';
  2234. function ldap_sasl_bindA; external LDAPLib name 'ldap_sasl_bindA';
  2235. function ldap_sasl_bindW; external LDAPLib name 'ldap_sasl_bindW';
  2236. function ldap_sasl_bind; external LDAPLib name 'ldap_sasl_bindA';
  2237. function ldap_sasl_bind_sA; external LDAPLib name 'ldap_sasl_bind_sA';
  2238. function ldap_sasl_bind_sW; external LDAPLib name 'ldap_sasl_bind_sW';
  2239. function ldap_sasl_bind_s; external LDAPLib name 'ldap_sasl_bind_sA';
  2240. function ldap_searchA; external LDAPLib name 'ldap_searchA';
  2241. function ldap_searchW; external LDAPLib name 'ldap_searchW';
  2242. function ldap_search; external LDAPLib name 'ldap_searchA';
  2243. function ldap_search_sA; external LDAPLib name 'ldap_search_sA';
  2244. function ldap_search_sW; external LDAPLib name 'ldap_search_sW';
  2245. function ldap_search_s; external LDAPLib name 'ldap_search_sA';
  2246. function ldap_search_stA; external LDAPLib name 'ldap_search_stA';
  2247. function ldap_search_stW; external LDAPLib name 'ldap_search_stW';
  2248. function ldap_search_st; external LDAPLib name 'ldap_search_stA';
  2249. function ldap_modifyA; external LDAPLib name 'ldap_modifyA';
  2250. function ldap_modifyW; external LDAPLib name 'ldap_modifyW';
  2251. function ldap_modify; external LDAPLib name 'ldap_modifyA';
  2252. function ldap_modify_sA; external LDAPLib name 'ldap_modify_sA';
  2253. function ldap_modify_sW; external LDAPLib name 'ldap_modify_sW';
  2254. function ldap_modify_s; external LDAPLib name 'ldap_modify_sA';
  2255. function ldap_modrdn2A; external LDAPLib name 'ldap_modrdn2A';
  2256. function ldap_modrdn2W; external LDAPLib name 'ldap_modrdn2W';
  2257. function ldap_modrdn2; external LDAPLib name 'ldap_modrdn2A';
  2258. function ldap_modrdnA; external LDAPLib name 'ldap_modrdnA';
  2259. function ldap_modrdnW; external LDAPLib name 'ldap_modrdnW';
  2260. function ldap_modrdn; external LDAPLib name 'ldap_modrdnA';
  2261. function ldap_modrdn2_sA; external LDAPLib name 'ldap_modrdn2_sA';
  2262. function ldap_modrdn2_sW; external LDAPLib name 'ldap_modrdn2_sW';
  2263. function ldap_modrdn2_s; external LDAPLib name 'ldap_modrdn2_sA';
  2264. function ldap_modrdn_sA; external LDAPLib name 'ldap_modrdn_sA';
  2265. function ldap_modrdn_sW; external LDAPLib name 'ldap_modrdn_sW';
  2266. function ldap_modrdn_s; external LDAPLib name 'ldap_modrdn_sA';
  2267. function ldap_addA; external LDAPLib name 'ldap_addA';
  2268. function ldap_addW; external LDAPLib name 'ldap_addW';
  2269. function ldap_add; external LDAPLib name 'ldap_addA';
  2270. function ldap_add_sA; external LDAPLib name 'ldap_add_sA';
  2271. function ldap_add_sW; external LDAPLib name 'ldap_add_sW';
  2272. function ldap_add_s; external LDAPLib name 'ldap_add_sA';
  2273. function ldap_compareA; external LDAPLib name 'ldap_compareA';
  2274. function ldap_compareW; external LDAPLib name 'ldap_compareW';
  2275. function ldap_compare; external LDAPLib name 'ldap_compareA';
  2276. function ldap_compare_sA; external LDAPLib name 'ldap_compare_sA';
  2277. function ldap_compare_sW; external LDAPLib name 'ldap_compare_sW';
  2278. function ldap_compare_s; external LDAPLib name 'ldap_compare_sA';
  2279. function ldap_deleteA; external LDAPLib name 'ldap_deleteA';
  2280. function ldap_deleteW; external LDAPLib name 'ldap_deleteW';
  2281. function ldap_delete; external LDAPLib name 'ldap_deleteA';
  2282. function ldap_delete_sA; external LDAPLib name 'ldap_delete_sA';
  2283. function ldap_delete_sW; external LDAPLib name 'ldap_delete_sW';
  2284. function ldap_delete_s; external LDAPLib name 'ldap_delete_sA';
  2285. function ldap_err2stringA; external LDAPLib name 'ldap_err2stringA';
  2286. function ldap_err2stringW; external LDAPLib name 'ldap_err2stringW';
  2287. function ldap_err2string; external LDAPLib name 'ldap_err2stringA';
  2288. function ldap_first_attributeA; external LDAPLib name 'ldap_first_attributeA';
  2289. function ldap_first_attributeW; external LDAPLib name 'ldap_first_attributeW';
  2290. function ldap_first_attribute; external LDAPLib name 'ldap_first_attributeA';
  2291. function ldap_next_attributeA; external LDAPLib name 'ldap_next_attributeA';
  2292. function ldap_next_attributeW; external LDAPLib name 'ldap_next_attributeW';
  2293. function ldap_next_attribute; external LDAPLib name 'ldap_next_attributeA';
  2294. function ldap_get_valuesA; external LDAPLib name 'ldap_get_valuesA';
  2295. function ldap_get_valuesW; external LDAPLib name 'ldap_get_valuesW';
  2296. function ldap_get_values; external LDAPLib name 'ldap_get_valuesA';
  2297. function ldap_get_values_lenA; external LDAPLib name 'ldap_get_values_lenA';
  2298. function ldap_get_values_lenW; external LDAPLib name 'ldap_get_values_lenW';
  2299. function ldap_get_values_len; external LDAPLib name 'ldap_get_values_lenA';
  2300. function ldap_count_valuesA; external LDAPLib name 'ldap_count_valuesA';
  2301. function ldap_count_valuesW; external LDAPLib name 'ldap_count_valuesW';
  2302. function ldap_count_values; external LDAPLib name 'ldap_count_valuesA';
  2303. function ldap_value_freeA; external LDAPLib name 'ldap_value_freeA';
  2304. function ldap_value_freeW; external LDAPLib name 'ldap_value_freeW';
  2305. function ldap_value_free; external LDAPLib name 'ldap_value_freeA';
  2306. function ldap_get_dnA; external LDAPLib name 'ldap_get_dnA';
  2307. function ldap_get_dnW; external LDAPLib name 'ldap_get_dnW';
  2308. function ldap_get_dn; external LDAPLib name 'ldap_get_dnA';
  2309. function ldap_explode_dnA; external LDAPLib name 'ldap_explode_dnA';
  2310. function ldap_explode_dnW; external LDAPLib name 'ldap_explode_dnW';
  2311. function ldap_explode_dn; external LDAPLib name 'ldap_explode_dnA';
  2312. function ldap_dn2ufnA; external LDAPLib name 'ldap_dn2ufnA';
  2313. function ldap_dn2ufnW; external LDAPLib name 'ldap_dn2ufnW';
  2314. function ldap_dn2ufn; external LDAPLib name 'ldap_dn2ufnA';
  2315. procedure ldap_memfreeA; external LDAPLib name 'ldap_memfreeA';
  2316. procedure ldap_memfreeW; external LDAPLib name 'ldap_memfreeW';
  2317. procedure ldap_memfree; external LDAPLib name 'ldap_memfreeA';
  2318. function ldap_ufn2dnA; external LDAPLib name 'ldap_ufn2dnA';
  2319. function ldap_ufn2dnW; external LDAPLib name 'ldap_ufn2dnW';
  2320. function ldap_ufn2dn; external LDAPLib name 'ldap_ufn2dnA';
  2321. function ldap_escape_filter_elementA; external LDAPLib name 'ldap_escape_filter_elementA';
  2322. function ldap_escape_filter_elementW; external LDAPLib name 'ldap_escape_filter_elementW';
  2323. function ldap_escape_filter_element; external LDAPLib name 'ldap_escape_filter_elementA';
  2324. function ldap_search_extA; external LDAPLib name 'ldap_search_extA';
  2325. function ldap_search_extW; external LDAPLib name 'ldap_search_extW';
  2326. function ldap_search_ext; external LDAPLib name 'ldap_search_extA';
  2327. function ldap_search_ext_sA; external LDAPLib name 'ldap_search_ext_sA';
  2328. function ldap_search_ext_sW; external LDAPLib name 'ldap_search_ext_sW';
  2329. function ldap_search_ext_s; external LDAPLib name 'ldap_search_ext_sA';
  2330. function ldap_check_filterA; EXTERNAL LDAPLib name 'ldap_check_filterA';
  2331. function ldap_check_filterW; EXTERNAL LDAPLib name 'ldap_check_filterW';
  2332. function ldap_check_filter; EXTERNAL LDAPLib name 'ldap_check_filterA';
  2333. function ldap_modify_extA; external LDAPLib name 'ldap_modify_extA';
  2334. function ldap_modify_extW; external LDAPLib name 'ldap_modify_extW';
  2335. function ldap_modify_ext; external LDAPLib name 'ldap_modify_extA';
  2336. function ldap_modify_ext_sA; external LDAPLib name 'ldap_modify_ext_sA';
  2337. function ldap_modify_ext_sW; external LDAPLib name 'ldap_modify_ext_sW';
  2338. function ldap_modify_ext_s; external LDAPLib name 'ldap_modify_ext_sA';
  2339. function ldap_rename_extA; external LDAPLib name 'ldap_rename_extA';
  2340. function ldap_rename_extW; external LDAPLib name 'ldap_rename_extW';
  2341. function ldap_rename_ext; external LDAPLib name 'ldap_rename_extA';
  2342. function ldap_rename_ext_sA; external LDAPLib name 'ldap_rename_ext_sA';
  2343. function ldap_rename_ext_sW; external LDAPLib name 'ldap_rename_ext_sW';
  2344. function ldap_rename_ext_s; external LDAPLib name 'ldap_rename_ext_sA';
  2345. function ldap_add_extA; external LDAPLib name 'ldap_add_extA';
  2346. function ldap_add_extW; external LDAPLib name 'ldap_add_extW';
  2347. function ldap_add_ext; external LDAPLib name 'ldap_add_extA';
  2348. function ldap_add_ext_sA; external LDAPLib name 'ldap_add_ext_sA';
  2349. function ldap_add_ext_sW; external LDAPLib name 'ldap_add_ext_sW';
  2350. function ldap_add_ext_s; external LDAPLib name 'ldap_add_ext_sA';
  2351. function ldap_compare_extA; external LDAPLib name 'ldap_compare_extA';
  2352. function ldap_compare_extW; external LDAPLib name 'ldap_compare_extW';
  2353. function ldap_compare_ext; external LDAPLib name 'ldap_compare_extA';
  2354. function ldap_compare_ext_sA; external LDAPLib name 'ldap_compare_ext_sA';
  2355. function ldap_compare_ext_sW; external LDAPLib name 'ldap_compare_ext_sW';
  2356. function ldap_compare_ext_s; external LDAPLib name 'ldap_compare_ext_sA';
  2357. function ldap_delete_extA; external LDAPLib name 'ldap_delete_extA';
  2358. function ldap_delete_extW; external LDAPLib name 'ldap_delete_extW';
  2359. function ldap_delete_ext; external LDAPLib name 'ldap_delete_extA';
  2360. function ldap_delete_ext_sA; external LDAPLib name 'ldap_delete_ext_sA';
  2361. function ldap_delete_ext_sW; external LDAPLib name 'ldap_delete_ext_sW';
  2362. function ldap_delete_ext_s; external LDAPLib name 'ldap_delete_ext_sA';
  2363. function ldap_parse_resultA; external LDAPLib name 'ldap_parse_resultA';
  2364. function ldap_parse_resultW; external LDAPLib name 'ldap_parse_resultW';
  2365. function ldap_parse_result; external LDAPLib name 'ldap_parse_resultA';
  2366. function ldap_controls_freeA; external LDAPLib name 'ldap_controls_freeA';
  2367. function ldap_controls_freeW; external LDAPLib name 'ldap_controls_freeW';
  2368. function ldap_controls_free; external LDAPLib name 'ldap_controls_freeA';
  2369. function ldap_parse_extended_resultA; external LDAPLib name 'ldap_parse_extended_resultA';
  2370. function ldap_parse_extended_resultW; external LDAPLib name 'ldap_parse_extended_resultW';
  2371. function ldap_parse_extended_result; external LDAPLib name 'ldap_parse_extended_resultA';
  2372. function ldap_control_freeA; external LDAPLib name 'ldap_control_freeA';
  2373. function ldap_control_freeW; external LDAPLib name 'ldap_control_freeW';
  2374. function ldap_control_free; external LDAPLib name 'ldap_control_freeA';
  2375. function ldap_free_controlsA; external LDAPLib name 'ldap_free_controlsA';
  2376. function ldap_free_controlsW; external LDAPLib name 'ldap_free_controlsW';
  2377. function ldap_free_controls; external LDAPLib name 'ldap_free_controlsA';
  2378. function ldap_create_sort_controlA; external LDAPLib name 'ldap_create_sort_controlA';
  2379. function ldap_create_sort_controlW; external LDAPLib name 'ldap_create_sort_controlW';
  2380. function ldap_create_sort_control; external LDAPLib name 'ldap_create_sort_controlA';
  2381. function ldap_parse_sort_controlA; external LDAPLib name 'ldap_parse_sort_controlA';
  2382. function ldap_parse_sort_controlW; external LDAPLib name 'ldap_parse_sort_controlW';
  2383. function ldap_parse_sort_control; external LDAPLib name 'ldap_parse_sort_controlA';
  2384. function ldap_encode_sort_controlA; external LDAPLib name 'ldap_encode_sort_controlA';
  2385. function ldap_encode_sort_controlW; external LDAPLib name 'ldap_encode_sort_controlW';
  2386. function ldap_encode_sort_control; external LDAPLib name 'ldap_encode_sort_controlA';
  2387. function ldap_create_page_controlA; external LDAPLib name 'ldap_create_page_controlA';
  2388. function ldap_create_page_controlW; external LDAPLib name 'ldap_create_page_controlW';
  2389. function ldap_create_page_control; external LDAPLib name 'ldap_create_page_controlA';
  2390. function ldap_parse_page_controlA; external LDAPLib name 'ldap_parse_page_controlA';
  2391. function ldap_parse_page_controlW; external LDAPLib name 'ldap_parse_page_controlW';
  2392. function ldap_parse_page_control; external LDAPLib name 'ldap_parse_page_controlA';
  2393. function ldap_search_init_pageA; external LDAPLib name 'ldap_search_init_pageA';
  2394. function ldap_search_init_pageW; external LDAPLib name 'ldap_search_init_pageW';
  2395. function ldap_search_init_page; external LDAPLib name 'ldap_search_init_pageA';
  2396. function ldap_parse_referenceA; external LDAPLib name 'ldap_parse_referenceA';
  2397. function ldap_parse_referenceW; external LDAPLib name 'ldap_parse_referenceW';
  2398. function ldap_parse_reference; external LDAPLib name 'ldap_parse_referenceA';
  2399. function ldap_extended_operationA; external LDAPLib name 'ldap_extended_operationA';
  2400. function ldap_extended_operationW; external LDAPLib name 'ldap_extended_operationW';
  2401. function ldap_extended_operation; external LDAPLib name 'ldap_extended_operationA';
  2402. function ldap_unbind; external LDAPLib name 'ldap_unbind';
  2403. function ldap_unbind_s; external LDAPLib name 'ldap_unbind_s';
  2404. function ldap_get_option; external LDAPLib name 'ldap_get_option';
  2405. function ldap_set_option; external LDAPLib name 'ldap_set_option';
  2406. function ldap_get_optionW; external LDAPLib name 'ldap_get_optionW';
  2407. function ldap_set_optionW; external LDAPLib name 'ldap_set_optionW';
  2408. function ldap_abandon; external LDAPLib name 'ldap_abandon';
  2409. function ldap_result; external LDAPLib name 'ldap_result';
  2410. function ldap_msgfree; external LDAPLib name 'ldap_msgfree';
  2411. function ldap_result2error; external LDAPLib name 'ldap_result2error';
  2412. procedure ldap_perror; external LDAPLib name 'ldap_perror';
  2413. function ldap_first_entry; external LDAPLib name 'ldap_first_entry';
  2414. function ldap_next_entry; external LDAPLib name 'ldap_next_entry';
  2415. function ldap_count_entries; external LDAPLib name 'ldap_count_entries';
  2416. function ldap_count_values_len; external LDAPLib name 'ldap_count_values_len';
  2417. function ldap_value_free_len; external LDAPLib name 'ldap_value_free_len';
  2418. function ldap_startup; external LDAPLib name 'ldap_startup';
  2419. function ldap_cleanup; external LDAPLib name 'ldap_cleanup';
  2420. function ldap_set_dbg_flags; external LDAPLib name 'ldap_set_dbg_flags';
  2421. function ldap_connect; external LDAPLib name 'ldap_connect';
  2422. procedure ber_bvfree; external LDAPLib name 'ber_bvfree';
  2423. procedure ldap_set_dbg_routine; external LDAPLib name 'ldap_set_dbg_routine';
  2424. function LdapUTF8ToUnicode; external LDAPLib name 'LdapUTF8ToUnicode';
  2425. function LdapUnicodeToUTF8; external LDAPLib name 'LdapUnicodeToUTF8';
  2426. function ldap_get_next_page; external LDAPLib name 'ldap_get_next_page';
  2427. function ldap_get_next_page_s; external LDAPLib name 'ldap_get_next_page_s';
  2428. function ldap_get_paged_count; external LDAPLib name 'ldap_get_paged_count';
  2429. function ldap_search_abandon_page; external LDAPLib name 'ldap_search_abandon_page';
  2430. function ldap_first_reference; external LDAPLib name 'ldap_first_reference';
  2431. function ldap_next_reference; external LDAPLib name 'ldap_next_reference';
  2432. function ldap_count_references; external LDAPLib name 'ldap_count_references';
  2433. function ldap_close_extended_op; external LDAPLib name 'ldap_close_extended_op';
  2434. function LdapGetLastError; external LDAPLib name 'LdapGetLastError';
  2435. function LdapMapErrorToWin32; external LDAPLib name 'LdapMapErrorToWin32';
  2436. function ldap_conn_from_msg; external LDAPLib name 'ldap_conn_from_msg';
  2437. // Macros.
  2438. function LDAP_IS_CLDAP(ld: PLDAP): boolean;
  2439. begin
  2440. Result :=(ld^.ld_sb.sb_naddr > 0);
  2441. end;
  2442. function NAME_ERROR(n: integer): boolean;
  2443. begin
  2444. Result := (n and $F0) = $20;
  2445. end;
  2446. {$ENDIF JWA_INTERFACESECTION}
  2447. {$IFNDEF JWA_OMIT_SECTIONS}
  2448. end.
  2449. {$ENDIF JWA_OMIT_SECTIONS}