PageRenderTime 47ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/packages/ldap/src/ldaph.inc

https://github.com/slibre/freepascal
Pascal | 1805 lines | 1053 code | 310 blank | 442 comment | 0 complexity | 17d3df7e54a015039a1f051ec88f0110 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1. (* $OpenLDAP: pkg/ldap/include/ldap.h,v 1.168.2.16 2003/03/05 23:48:31 kurt Exp $ *)
  2. (*
  3. * Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted only as authorized by the OpenLDAP
  8. * Public License. A copy of this license is available at
  9. * http://www.OpenLDAP.org/license.html or in file LICENSE in the
  10. * top-level directory of the distribution.
  11. *)
  12. (* Portions
  13. * Copyright (c) 1990 Regents of the University of Michigan.
  14. * All rights reserved.
  15. *
  16. * Redistribution and use in source and binary forms are permitted
  17. * provided that this notice is preserved and that due credit is given
  18. * to the University of Michigan at Ann Arbor. The name of the University
  19. * may not be used to endorse or promote products derived from this
  20. * software without specific prior written permission. This software
  21. * is provided ``as is'' without express or implied warranty.
  22. *)
  23. const
  24. LDAP_VERSION1 = 1;
  25. LDAP_VERSION2 = 2;
  26. LDAP_VERSION3 = 3;
  27. LDAP_VERSION_MIN = LDAP_VERSION2;
  28. LDAP_VERSION = LDAP_VERSION2;
  29. LDAP_VERSION_MAX = LDAP_VERSION3;
  30. (*
  31. * We'll use 2000+draft revision for our API version number
  32. * As such, the number will be above the old RFC but below
  33. * whatever number does finally get assigned
  34. *)
  35. const
  36. LDAP_API_VERSION = 3001;
  37. LDAP_VENDOR_NAME = 'OpenLDAP';
  38. (* OpenLDAP API Features *)
  39. LDAP_API_FEATURE_X_OPENLDAP = LDAP_VENDOR_VERSION;
  40. {$IF defined(LDAP_API_FEATURE_X_OPENLDAP_REENTRANT) or (defined(LDAP_THREAD_SAFE) and defined(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE))}
  41. (* -lldap may or may not be thread safe *)
  42. (* -lldap_r, if available, is always thread safe *)
  43. {$DEFINE LDAP_API_FEATURE_THREAD_SAFE}
  44. {$IFEND}
  45. {$IF defined(LDAP_THREAD_SAFE) and defined(LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE)}
  46. //{$DEFINE LDAP_API_FEATURE_SESSION_SAFE}
  47. //{$DEFINE LDAP_API_OPERATION_SESSION_SAFE}
  48. {$IFEND}
  49. LDAP_PORT = 389; (* ldap:/// default LDAP port *)
  50. LDAPS_PORT = 636; (* ldaps:/// default LDAP over TLS port *)
  51. LDAP_ROOT_DSE = '';
  52. LDAP_NO_ATTRS = '1.1';
  53. LDAP_ALL_USER_ATTRIBUTES = '*';
  54. LDAP_ALL_OPERATIONAL_ATTRIBUTES = '+'; (* OpenLDAP extension *)
  55. LDAP_MAXINT = 2147483647;
  56. (*
  57. * LDAP_OPTions defined by draft-ldapext-ldap-c-api-02
  58. * 0x0000 - 0x0fff reserved for api options
  59. * 0x1000 - 0x3fff reserved for api extended options
  60. * 0x4000 - 0x7fff reserved for private and experimental options
  61. *)
  62. LDAP_OPT_API_INFO = $0000;
  63. LDAP_OPT_DESC = $0001; (* deprecated *)
  64. LDAP_OPT_DEREF = $0002;
  65. LDAP_OPT_SIZELIMIT = $0003;
  66. LDAP_OPT_TIMELIMIT = $0004;
  67. (* $05 - $07 not defined by current draft *)
  68. LDAP_OPT_REFERRALS = $0008;
  69. LDAP_OPT_RESTART = $0009;
  70. (* $0a - $10 not defined by current draft *)
  71. LDAP_OPT_PROTOCOL_VERSION = $0011;
  72. LDAP_OPT_SERVER_CONTROLS = $0012;
  73. LDAP_OPT_CLIENT_CONTROLS = $0013;
  74. (* $14 not defined by current draft *)
  75. LDAP_OPT_API_FEATURE_INFO = $0015;
  76. (* $16 - $2f not defined by current draft *)
  77. LDAP_OPT_HOST_NAME = $0030;
  78. LDAP_OPT_RESULT_CODE = $0031;
  79. LDAP_OPT_ERROR_NUMBER = LDAP_OPT_RESULT_CODE;
  80. LDAP_OPT_ERROR_STRING = $0032;
  81. LDAP_OPT_MATCHED_DN = $0033;
  82. (* $34 - $0fff not defined by current draft *)
  83. (* private and experimental options *)
  84. (* OpenLDAP specific options *)
  85. LDAP_OPT_DEBUG_LEVEL = $5001; (* debug level *)
  86. LDAP_OPT_TIMEOUT = $5002; (* default timeout *)
  87. LDAP_OPT_REFHOPLIMIT = $5003; (* ref hop limit *)
  88. LDAP_OPT_NETWORK_TIMEOUT = $5005; (* socket level timeout *)
  89. LDAP_OPT_URI = $5006;
  90. LDAP_OPT_REFERRAL_URLS = $5007; (* Referral URLs *)
  91. (* OpenLDAP TLS options *)
  92. LDAP_OPT_X_TLS = $6000;
  93. LDAP_OPT_X_TLS_CTX = $6001; (* SSL CTX *)
  94. LDAP_OPT_X_TLS_CACERTFILE = $6002;
  95. LDAP_OPT_X_TLS_CACERTDIR = $6003;
  96. LDAP_OPT_X_TLS_CERTFILE = $6004;
  97. LDAP_OPT_X_TLS_KEYFILE = $6005;
  98. LDAP_OPT_X_TLS_REQUIRE_CERT = $6006;
  99. (* LDAP_OPT_X_TLS_PROTOCOL = $6007; *)
  100. LDAP_OPT_X_TLS_CIPHER_SUITE = $6008;
  101. LDAP_OPT_X_TLS_RANDOM_FILE = $6009;
  102. LDAP_OPT_X_TLS_SSL_CTX = $600a;
  103. LDAP_OPT_X_TLS_CRLCHECK = $600b;
  104. LDAP_OPT_X_TLS_CONNECT_CB = $6600c;
  105. LDAP_OPT_X_TLS_CONNECT_ARG = $6600d;
  106. LDAP_OPT_X_TLS_DHFILE = $6600e;
  107. LDAP_OPT_X_TLS_NEVER = 0;
  108. LDAP_OPT_X_TLS_HARD = 1;
  109. LDAP_OPT_X_TLS_DEMAND = 2;
  110. LDAP_OPT_X_TLS_ALLOW = 3;
  111. LDAP_OPT_X_TLS_TRY = 4;
  112. (* OpenLDAP SASL options *)
  113. LDAP_OPT_X_SASL_MECH = $6100;
  114. LDAP_OPT_X_SASL_REALM = $6101;
  115. LDAP_OPT_X_SASL_AUTHCID = $6102;
  116. LDAP_OPT_X_SASL_AUTHZID = $6103;
  117. LDAP_OPT_X_SASL_SSF = $6104; (* read-only *)
  118. LDAP_OPT_X_SASL_SSF_EXTERNAL = $6105; (* write-only *)
  119. LDAP_OPT_X_SASL_SECPROPS = $6106; (* write-only *)
  120. LDAP_OPT_X_SASL_SSF_MIN = $6107;
  121. LDAP_OPT_X_SASL_SSF_MAX = $6108;
  122. LDAP_OPT_X_SASL_MAXBUFSIZE = $6109;
  123. (* Private API Extensions -- reserved for application use *)
  124. LDAP_OPT_PRIVATE_EXTENSION_BASE = $7000; (* Private API inclusive *)
  125. (*
  126. * ldap_get_option() and ldap_set_option() return values.
  127. * As later versions may return other values indicating
  128. * failure, current applications should only compare returned
  129. * value against LDAP_OPT_SUCCESS.
  130. *)
  131. LDAP_OPT_SUCCESS = 0;
  132. LDAP_OPT_ERROR = -1;
  133. (* on/off values *)
  134. LDAP_OPT_OFF = Pointer(0);
  135. function LDAP_OPT_ON: Pointer;
  136. const
  137. LDAP_API_INFO_VERSION = 1;
  138. type
  139. PLDAPAPIInfo = ^LDAPAPIInfo;
  140. LDAPAPIInfo = record
  141. ldapai_info_version : cint; (* version of LDAPAPIInfo (1) *)
  142. ldapai_api_version : cint; (* revision of API supported *)
  143. ldapai_protocol_version : cint; (* highest LDAP version supported *)
  144. ldapai_extensions : ppcchar; (* names of API extensions *)
  145. ldapai_vendor_name : pcchar; (* name of supplier *)
  146. ldapai_vendor_version : cint; (* supplier-specific version * 100 *)
  147. end;
  148. const
  149. LDAP_FEATURE_INFO_VERSION = 1; (* version of api feature structure *)
  150. type
  151. pldap_apifeature_info = ^ldap_apifeature_info;
  152. ldap_apifeature_info = record
  153. ldapaif_info_version : cint; (* version of this struct (1) *)
  154. ldapaif_name : pcchar; (* matches LDAP_API_FEATURE_... less the prefix *)
  155. ldapaif_version : cint; (* matches the value LDAP_API_FEATURE_... *)
  156. end;
  157. PLDAPAPIFeatureInfo = ^LDAPAPIFeatureInfo;
  158. LDAPAPIFeatureInfo = ldap_apifeature_info;
  159. PPPLDAPControl = ^PPLDAPControl;
  160. PPLDAPControl = ^PLDAPControl;
  161. PLDAPControl = ^LDAPControl;
  162. LDAPControl = record
  163. ldctl_oid : pcchar;
  164. ldctl_value : berval;
  165. ldctl_iscritical : cchar;
  166. end;
  167. const
  168. (* LDAP Controls *)
  169. (* standard track controls *)
  170. LDAP_CONTROL_MANAGEDSAIT = '2.16.840.1.113730.3.4.2'; (* RFC 3296 *)
  171. LDAP_CONTROL_SUBENTRIES = '1.3.6.1.4.1.4203.1.10.1'; (* RFC 3672 *)
  172. LDAP_CONTROL_PAGEDRESULTS = '1.2.840.113556.1.4.319'; (* RFC 2696 *)
  173. LDAP_CONTROL_VALUESRETURNFILTER = '1.2.826.0.1.3344810.2.3'; (* RFC 3876 *)
  174. LDAP_CONTROL_X_VALUESRETURNFILTER = '1.2.826.0.1.334810.2.3'; (* bad OID *)
  175. LDAP_CONTROL_ASSERT = '1.3.6.1.1.12';
  176. LDAP_CONTROL_PRE_READ = '1.3.6.1.1.13.1';
  177. LDAP_CONTROL_POST_READ = '1.3.6.1.1.13.2';
  178. (* standard track - not implemented in slapd(8) *)
  179. LDAP_CONTROL_SORTREQUEST = '1.2.840.113556.1.4.473'; (* RFC 2891 *)
  180. LDAP_CONTROL_SORTRESPONSE = '1.2.840.113556.1.4.474'; (* RFC 2891 *)
  181. (* but not yet formalized controls *)
  182. LDAP_CONTROL_PROXY_AUTHZ = '2.16.840.1.113730.3.4.18';
  183. (* various works in progress *)
  184. LDAP_CONTROL_NOOP = '1.3.6.1.4.1.4203.666.5.2';
  185. (* LDAP VLV *)(* not implemented in slapd(8) *)
  186. LDAP_CONTROL_VLVREQUEST = '2.16.840.1.113730.3.4.9';
  187. LDAP_CONTROL_VLVRESPONSE = '2.16.840.1.113730.3.4.10';
  188. (* LDAP Sync -- draft-zeilenga-ldup-sync *)(* submitted for publication *)
  189. LDAP_SYNC_OID = '1.3.6.1.4.1.4203.1.9.1';
  190. LDAP_CONTROL_SYNC = LDAP_SYNC_OID + '.1';
  191. LDAP_CONTROL_SYNC_STATE = LDAP_SYNC_OID + '.2';
  192. LDAP_CONTROL_SYNC_DONE = LDAP_SYNC_OID + '.3';
  193. LDAP_SYNC_INFO = LDAP_SYNC_OID + '.4';
  194. LDAP_SYNC_NONE = $00;
  195. LDAP_SYNC_REFRESH_ONLY = $01;
  196. LDAP_SYNC_RESERVED = $02;
  197. LDAP_SYNC_REFRESH_AND_PERSIST = $03;
  198. LDAP_SYNC_REFRESH_PRESENTS = 0;
  199. LDAP_SYNC_REFRESH_DELETES = 1;
  200. LDAP_TAG_SYNC_NEW_COOKIE = ber_tag_t($80);
  201. LDAP_TAG_SYNC_REFRESH_DELETE = ber_tag_t($a1);
  202. LDAP_TAG_SYNC_REFRESH_PRESENT = ber_tag_t($a2);
  203. LDAP_TAG_SYNC_ID_SET = ber_tag_t($a3);
  204. LDAP_TAG_SYNC_COOKIE = ber_tag_t($04);
  205. LDAP_TAG_REFRESHDELETES = ber_tag_t($01);
  206. LDAP_TAG_REFRESHDONE = ber_tag_t($01);
  207. LDAP_TAG_RELOAD_HINT = ber_tag_t($01);
  208. LDAP_SYNC_PRESENT = 0;
  209. LDAP_SYNC_ADD = 1;
  210. LDAP_SYNC_MODIFY = 2;
  211. LDAP_SYNC_DELETE = 3;
  212. (* MS ActiveDirectory controls (for compatibility) *)
  213. LDAP_CONTROL_X_DOMAIN_SCOPE = '1.2.840.113556.1.4.1339';
  214. LDAP_CONTROL_X_PERMISSIVE_MODIFY = '1.2.840.113556.1.4.1413';
  215. (* LDAP Unsolicited Notifications *)
  216. LDAP_NOTICE_OF_DISCONNECTION = '1.3.6.1.4.1.1466.20036'; (* RFC 2251 *)
  217. LDAP_NOTICE_DISCONNECT = LDAP_NOTICE_OF_DISCONNECTION;
  218. (* LDAP Extended Operations *)
  219. LDAP_EXOP_START_TLS = '1.3.6.1.4.1.1466.20037'; (* RFC 2830 *)
  220. LDAP_EXOP_MODIFY_PASSWD = '1.3.6.1.4.1.4203.1.11.1'; (* RFC 3062 *)
  221. LDAP_TAG_EXOP_MODIFY_PASSWD_ID = ber_tag_t($80);
  222. LDAP_TAG_EXOP_MODIFY_PASSWD_OLD = ber_tag_t($81);
  223. LDAP_TAG_EXOP_MODIFY_PASSWD_NEW = ber_tag_t($82);
  224. LDAP_TAG_EXOP_MODIFY_PASSWD_GEN = ber_tag_t($80);
  225. LDAP_EXOP_X_WHO_AM_I = '1.3.6.1.4.1.4203.1.11.3';
  226. LDAP_EXOP_X_CANCEL = '1.3.6.1.4.1.4203.666.6.3';
  227. (* LDAP Features *)
  228. LDAP_FEATURE_ALL_OP_ATTRS = '1.3.6.1.4.1.4203.1.5.1'; (* RFC 3673 *)
  229. LDAP_FEATURE_OBJECTCLASS_ATTRS = '1.3.6.1.4.1.4203.1.5.2'; (* @objectClass - new number to be assigned *)
  230. LDAP_FEATURE_ABSOLUTE_FILTERS = '1.3.6.1.4.1.4203.1.5.3'; (* (&) (|) *)
  231. LDAP_FEATURE_LANGUAGE_TAG_OPTIONS = '1.3.6.1.4.1.4203.1.5.4';
  232. LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS = '1.3.6.1.4.1.4203.1.5.5';
  233. LDAP_FEATURE_MODIFY_INCREMENT = '1.3.6.1.1.14';
  234. (*
  235. * specific LDAP instantiations of BER types we know about
  236. *)
  237. (* Overview of LBER tag construction
  238. *
  239. * Bits
  240. * ______
  241. * 8 7 | CLASS
  242. * 0 0 = UNIVERSAL
  243. * 0 1 = APPLICATION
  244. * 1 0 = CONTEXT-SPECIFIC
  245. * 1 1 = PRIVATE
  246. * _____
  247. * | 6 | DATA-TYPE
  248. * 0 = PRIMITIVE
  249. * 1 = CONSTRUCTED
  250. * ___________
  251. * | 5 ... 1 | TAG-NUMBER
  252. *)
  253. (* general stuff *)
  254. LDAP_TAG_MESSAGE = ber_tag_t($30); (* constructed + 16 *)
  255. LDAP_TAG_MSGID = ber_tag_t($02); (* integer *)
  256. LDAP_TAG_LDAPDN = ber_tag_t($04); (* octet string *)
  257. LDAP_TAG_LDAPCRED = ber_tag_t($04); (* octet string *)
  258. LDAP_TAG_CONTROLS = ber_tag_t($a0); (* context specific + constructed + 0 *)
  259. LDAP_TAG_REFERRAL = ber_tag_t($a3); (* context specific + constructed + 3 *)
  260. LDAP_TAG_NEWSUPERIOR = ber_tag_t($80); (* context-specific + primitive + 0 *)
  261. LDAP_TAG_EXOP_REQ_OID = ber_tag_t($80); (* context specific + primitive *)
  262. LDAP_TAG_EXOP_REQ_VALUE = ber_tag_t($81); (* context specific + primitive *)
  263. LDAP_TAG_EXOP_RES_OID = ber_tag_t($8a); (* context specific + primitive *)
  264. LDAP_TAG_EXOP_RES_VALUE = ber_tag_t($8b); (* context specific + primitive *)
  265. LDAP_TAG_IM_RES_OID = ber_tag_t($80); (* context specific + primitive *)
  266. LDAP_TAG_IM_RES_VALUE = ber_tag_t($81); (* context specific + primitive *)
  267. LDAP_TAG_SASL_RES_CREDS = ber_tag_t($87); (* context specific + primitive *)
  268. (* possible operations a client can invoke *)
  269. LDAP_REQ_BIND = ber_tag_t($60); (* application + constructed *)
  270. LDAP_REQ_UNBIND = ber_tag_t($42); (* application + primitive *)
  271. LDAP_REQ_SEARCH = ber_tag_t($63); (* application + constructed *)
  272. LDAP_REQ_MODIFY = ber_tag_t($66); (* application + constructed *)
  273. LDAP_REQ_ADD = ber_tag_t($68); (* application + constructed *)
  274. LDAP_REQ_DELETE = ber_tag_t($4a); (* application + primitive *)
  275. LDAP_REQ_MODDN = ber_tag_t($6c); (* application + constructed *)
  276. LDAP_REQ_MODRDN = LDAP_REQ_MODDN;
  277. LDAP_REQ_RENAME = LDAP_REQ_MODDN;
  278. LDAP_REQ_COMPARE = ber_tag_t($6e); (* application + constructed *)
  279. LDAP_REQ_ABANDON = ber_tag_t($50); (* application + primitive *)
  280. LDAP_REQ_EXTENDED = ber_tag_t($77); (* application + constructed *)
  281. (* possible result types a server can return *)
  282. LDAP_RES_BIND = ber_tag_t($61); (* application + constructed *)
  283. LDAP_RES_SEARCH_ENTRY = ber_tag_t($64); (* application + constructed *)
  284. LDAP_RES_SEARCH_REFERENCE = ber_tag_t($73); (* V3: application + constructed *)
  285. LDAP_RES_SEARCH_RESULT = ber_tag_t($65); (* application + constructed *)
  286. LDAP_RES_MODIFY = ber_tag_t($67); (* application + constructed *)
  287. LDAP_RES_ADD = ber_tag_t($69); (* application + constructed *)
  288. LDAP_RES_DELETE = ber_tag_t($6b); (* application + constructed *)
  289. LDAP_RES_MODDN = ber_tag_t($6d); (* application + constructed *)
  290. LDAP_RES_MODRDN = LDAP_RES_MODDN; (* application + constructed *)
  291. LDAP_RES_RENAME = LDAP_RES_MODDN; (* application + constructed *)
  292. LDAP_RES_COMPARE = ber_tag_t($6f); (* application + constructed *)
  293. LDAP_RES_EXTENDED = ber_tag_t($78); (* V3: application + constructed *)
  294. LDAP_RES_INTERMEDIATE = ber_tag_t($79); (* V3+: application + constructed *)
  295. LDAP_RES_ANY = -1;
  296. LDAP_RES_UNSOLICITED = 0;
  297. (* sasl methods *)
  298. LDAP_SASL_SIMPLE = pcchar(0);
  299. LDAP_SASL_NULL = '';
  300. (* authentication methods available *)
  301. LDAP_AUTH_NONE = ber_tag_t($00); (* no authentication *)
  302. LDAP_AUTH_SIMPLE = ber_tag_t($80); (* context specific + primitive *)
  303. LDAP_AUTH_SASL = ber_tag_t($a3); (* context specific + constructed *)
  304. LDAP_AUTH_KRBV4 = ber_tag_t($ff); (* means do both of the following *)
  305. LDAP_AUTH_KRBV41 = ber_tag_t($81); (* context specific + primitive *)
  306. LDAP_AUTH_KRBV42 = ber_tag_t($82); (* context specific + primitive *)
  307. (* filter types *)
  308. LDAP_FILTER_AND = ber_tag_t($a0); (* context specific + constructed *)
  309. LDAP_FILTER_OR = ber_tag_t($a1); (* context specific + constructed *)
  310. LDAP_FILTER_NOT = ber_tag_t($a2); (* context specific + constructed *)
  311. LDAP_FILTER_EQUALITY = ber_tag_t($a3); (* context specific + constructed *)
  312. LDAP_FILTER_SUBSTRINGS = ber_tag_t($a4); (* context specific + constructed *)
  313. LDAP_FILTER_GE = ber_tag_t($a5); (* context specific + constructed *)
  314. LDAP_FILTER_LE = ber_tag_t($a6); (* context specific + constructed *)
  315. LDAP_FILTER_PRESENT = ber_tag_t($87); (* context specific + primitive *)
  316. LDAP_FILTER_APPROX = ber_tag_t($a8); (* context specific + constructed *)
  317. LDAP_FILTER_EXT = ber_tag_t($a9); (* context specific + constructed *)
  318. (* extended filter component types *)
  319. LDAP_FILTER_EXT_OID = ber_tag_t($81); (* context specific *)
  320. LDAP_FILTER_EXT_TYPE = ber_tag_t($82); (* context specific *)
  321. LDAP_FILTER_EXT_VALUE = ber_tag_t($83); (* context specific *)
  322. LDAP_FILTER_EXT_DNATTRS = ber_tag_t($84); (* context specific *)
  323. (* substring filter component types *)
  324. LDAP_SUBSTRING_INITIAL = ber_tag_t($80); (* context specific *)
  325. LDAP_SUBSTRING_ANY = ber_tag_t($81); (* context specific *)
  326. LDAP_SUBSTRING_FINAL = ber_tag_t($82); (* context specific *)
  327. (* search scopes *)
  328. LDAP_SCOPE_DEFAULT = ber_int_t(-1); (* OpenLDAP extension *)
  329. LDAP_SCOPE_BASE = ber_int_t($0000);
  330. LDAP_SCOPE_BASEOBJECT = LDAP_SCOPE_BASE;
  331. LDAP_SCOPE_ONELEVEL = ber_int_t($0001);
  332. LDAP_SCOPE_ONE = LDAP_SCOPE_ONELEVEL;
  333. LDAP_SCOPE_SUBTREE = ber_int_t($0002);
  334. LDAP_SCOPE_SUB = LDAP_SCOPE_SUBTREE;
  335. (*
  336. * possible error codes we can return
  337. *)
  338. function LDAP_RANGE(n, x, y: ber_int_t): Boolean;
  339. const
  340. LDAP_SUCCESS = $00;
  341. LDAP_OPERATIONS_ERROR = $01;
  342. LDAP_PROTOCOL_ERROR = $02;
  343. LDAP_TIMELIMIT_EXCEEDED = $03;
  344. LDAP_SIZELIMIT_EXCEEDED = $04;
  345. LDAP_COMPARE_FALSE = $05;
  346. LDAP_COMPARE_TRUE = $06;
  347. LDAP_AUTH_METHOD_NOT_SUPPORTED = $07;
  348. LDAP_STRONG_AUTH_NOT_SUPPORTED = LDAP_AUTH_METHOD_NOT_SUPPORTED;
  349. LDAP_STRONG_AUTH_REQUIRED = $08;
  350. LDAP_PARTIAL_RESULTS = $09; (* LDAPv2+ (not LDAPv3) *)
  351. LDAP_REFERRAL = $0a; (* LDAPv3 *)
  352. LDAP_ADMINLIMIT_EXCEEDED = $0b; (* LDAPv3 *)
  353. LDAP_UNAVAILABLE_CRITICAL_EXTENSION = $0c; (* LDAPv3 *)
  354. LDAP_CONFIDENTIALITY_REQUIRED = $0d; (* LDAPv3 *)
  355. LDAP_SASL_BIND_IN_PROGRESS = $0e; (* LDAPv3 *)
  356. function LDAP_ATTR_ERROR(n: ber_int_t): Boolean;
  357. const
  358. LDAP_NO_SUCH_ATTRIBUTE = $10;
  359. LDAP_UNDEFINED_TYPE = $11;
  360. LDAP_INAPPROPRIATE_MATCHING = $12;
  361. LDAP_CONSTRAINT_VIOLATION = $13;
  362. LDAP_TYPE_OR_VALUE_EXISTS = $14;
  363. LDAP_INVALID_SYNTAX = $15;
  364. function LDAP_NAME_ERROR(n: ber_int_t): Boolean;
  365. const
  366. LDAP_NO_SUCH_OBJECT = $20;
  367. LDAP_ALIAS_PROBLEM = $21;
  368. LDAP_INVALID_DN_SYNTAX = $22;
  369. LDAP_IS_LEAF = $23; (* not LDAPv3 *)
  370. LDAP_ALIAS_DEREF_PROBLEM = $24;
  371. function LDAP_SECURITY_ERROR(n: ber_int_t): Boolean;
  372. const
  373. LDAP_PROXY_AUTHZ_FAILURE = $2F; (* LDAPv3 proxy authorization *)
  374. LDAP_INAPPROPRIATE_AUTH = $30;
  375. LDAP_INVALID_CREDENTIALS = $31;
  376. LDAP_INSUFFICIENT_ACCESS = $32;
  377. function LDAP_SERVICE_ERROR(n: ber_int_t): Boolean;
  378. const
  379. LDAP_BUSY = $33;
  380. LDAP_UNAVAILABLE = $34;
  381. LDAP_UNWILLING_TO_PERFORM = $35;
  382. LDAP_LOOP_DETECT = $36;
  383. function LDAP_UPDATE_ERROR(n: ber_int_t): Boolean;
  384. const
  385. LDAP_NAMING_VIOLATION = $40;
  386. LDAP_OBJECT_CLASS_VIOLATION = $41;
  387. LDAP_NOT_ALLOWED_ON_NONLEAF = $42;
  388. LDAP_NOT_ALLOWED_ON_RDN = $43;
  389. LDAP_ALREADY_EXISTS = $44;
  390. LDAP_NO_OBJECT_CLASS_MODS = $45;
  391. LDAP_RESULTS_TOO_LARGE = $46; (* CLDAP *)
  392. LDAP_AFFECTS_MULTIPLE_DSAS = $47; (* LDAPv3 *)
  393. LDAP_OTHER = $50;
  394. (* for the LDAP Sync operation *)
  395. LDAP_SYNC_REFRESH_REQUIRED = $4100;
  396. (* for the LDAP No-Op control *)
  397. LDAP_NO_OPERATION = $410e;
  398. (* for the Assertion control *)
  399. LDAP_ASSERTION_FAILED = $410f;
  400. (* for the Cancel operation *)
  401. LDAP_CANCELLED = $4110;
  402. LDAP_NO_SUCH_OPERATION = $4111;
  403. LDAP_TOO_LATE = $4112;
  404. LDAP_CANNOT_CANCEL = $4113;
  405. (* API Error Codes
  406. *
  407. * Based on draft-ietf-ldap-c-api-xx
  408. * but with new negative code values
  409. *)
  410. function LDAP_API_ERROR(n: ber_int_t): Boolean;
  411. function LDAP_API_RESULT(n: ber_int_t): Boolean;
  412. const
  413. LDAP_SERVER_DOWN = -1;
  414. LDAP_LOCAL_ERROR = -2;
  415. LDAP_ENCODING_ERROR = -3;
  416. LDAP_DECODING_ERROR = -4;
  417. LDAP_TIMEOUT = -5;
  418. LDAP_AUTH_UNKNOWN = -6;
  419. LDAP_FILTER_ERROR = -7;
  420. LDAP_USER_CANCELLED = -8;
  421. LDAP_PARAM_ERROR = -9;
  422. LDAP_NO_MEMORY = -10;
  423. LDAP_CONNECT_ERROR = -11;
  424. LDAP_NOT_SUPPORTED = -12;
  425. LDAP_CONTROL_NOT_FOUND = -13;
  426. LDAP_NO_RESULTS_RETURNED = -14;
  427. LDAP_MORE_RESULTS_TO_RETURN = -15;
  428. LDAP_CLIENT_LOOP = -16;
  429. LDAP_REFERRAL_LIMIT_EXCEEDED = -17;
  430. (*
  431. * This structure represents both ldap messages and ldap responses.
  432. * These are really the same, except in the case of search responses,
  433. * where a response has multiple messages.
  434. *)
  435. type
  436. //typedef struct ldapmsg LDAPMessage;
  437. pldapmsg = Pointer;
  438. PPLDAPMessage = ^PLDAPMessage;
  439. PLDAPMessage = pldapmsg;
  440. (* for modifications *)
  441. const
  442. LDAP_MOD_OP = $0007;
  443. LDAP_MOD_ADD = $0000;
  444. LDAP_MOD_DELETE = $0001;
  445. LDAP_MOD_REPLACE = $0002;
  446. LDAP_MOD_INCREMENT = $0003; (* OpenLDAP extension *)
  447. LDAP_MOD_BVALUES = $0080;
  448. type
  449. PPPLDAPMod = ^PPLDAPMod;
  450. PPLDAPMod = ^PLDAPMod;
  451. PLDAPMod = ^LDAPMod;
  452. LDAPMod = record
  453. mod_op : cint;
  454. (* IMPORTANT: do not use code 0x1000 (or above),
  455. * it is used internally by the backends!
  456. * (see ldap/servers/slapd/slap.h)
  457. *)
  458. mod_type : pcchar;
  459. case cint of
  460. 0: (mod_vals : record
  461. case cint of
  462. 0: (modv_strvals : ppcchar);
  463. 1: (modv_bvals : PPBerval);
  464. end);
  465. 1: (case cint of
  466. 0: (mod_values : ppcchar);
  467. 1: (mod_bvalues : PPBerval));
  468. end;
  469. (*
  470. * structure representing an ldap session which can
  471. * encompass connections to multiple servers (in the
  472. * face of referrals).
  473. *)
  474. PLDAP = Pointer;
  475. const
  476. LDAP_DEREF_NEVER = $00;
  477. LDAP_DEREF_SEARCHING = $01;
  478. LDAP_DEREF_FINDING = $02;
  479. LDAP_DEREF_ALWAYS = $03;
  480. LDAP_NO_LIMIT = 0;
  481. (* how many messages to retrieve results for *)
  482. LDAP_MSG_ONE = $00;
  483. LDAP_MSG_ALL = $01;
  484. LDAP_MSG_RECEIVED = $02;
  485. (*
  486. * types for ldap URL handling
  487. *)
  488. type
  489. pldap_url_desc = ^ldap_url_desc;
  490. ldap_url_desc = record
  491. lud_next : pldap_url_desc;
  492. lud_scheme : pcchar;
  493. lud_host : pcchar;
  494. lud_port : cint;
  495. lud_dn : pcchar;
  496. lud_attrs : ppcchar;
  497. lud_scope : cint;
  498. lud_filter : pcchar;
  499. lud_exts : pcchar;
  500. lud_crit_exts : cint;
  501. end;
  502. PLDAPURLDesc = ^LDAPURLDesc;
  503. LDAPURLDesc = ldap_url_desc;
  504. const
  505. LDAP_URL_SUCCESS = $00; (* Success *)
  506. LDAP_URL_ERR_MEM = $01; (* can't allocate memory space *)
  507. LDAP_URL_ERR_PARAM = $02; (* parameter is bad *)
  508. LDAP_URL_ERR_BADSCHEME = $03; (* URL doesn't begin with "ldap[si]://" *)
  509. LDAP_URL_ERR_BADENCLOSURE = $04; (* URL is missing trailing ">" *)
  510. LDAP_URL_ERR_BADURL = $05; (* URL is bad *)
  511. LDAP_URL_ERR_BADHOST = $06; (* host port is bad *)
  512. LDAP_URL_ERR_BADATTRS = $07; (* bad (or missing) attributes *)
  513. LDAP_URL_ERR_BADSCOPE = $08; (* scope string is invalid (or missing) *)
  514. LDAP_URL_ERR_BADFILTER = $09; (* bad or missing filter *)
  515. LDAP_URL_ERR_BADEXTS = $0a; (* bad or missing extensions *)
  516. (*
  517. * The API draft spec says we should declare (or cause to be declared)
  518. * 'struct timeval'. We don't. See IETF LDAPext discussions.
  519. *)
  520. type
  521. ptimeval = Pointer;
  522. (*
  523. * in options.c:
  524. *)
  525. function ldap_get_option(
  526. ld : PLDAP;
  527. option : cint;
  528. outvalue : Pointer
  529. ): cint; cdecl; external;
  530. function ldap_set_option(
  531. ld : PLDAP;
  532. option : cint;
  533. const invalue : Pointer
  534. ): cint; cdecl; external;
  535. (* V3 REBIND Function Callback Prototype *)
  536. type
  537. LDAP_REBIND_PROC = function(ld: PLDAP; const url: pcchar; request: ber_tag_t; msgid: ber_int_t; params: Pointer): cint; cdecl;
  538. function ldap_set_rebind_proc(
  539. ld : PLDAP;
  540. rebind_proc : LDAP_REBIND_PROC;
  541. params : Pointer
  542. ): cint; cdecl; external;
  543. (* V3 referral selection Function Callback Prototype *)
  544. type
  545. LDAP_NEXTREF_PROC = function(ld: PLDAP; refsp: pppcchar; cntp: pcint; params: Pointer): cint; cdecl;
  546. function ldap_set_nextref_proc(
  547. ld : PLDAP;
  548. nextref_proc : LDAP_NEXTREF_PROC;
  549. params : Pointer
  550. ): cint; cdecl; external;
  551. (*
  552. * in controls.c:
  553. *)
  554. function ldap_create_control(
  555. const requestOID: pcchar;
  556. ber : PBerElement;
  557. iscritical : cint;
  558. var ctrlp : PLDAPControl
  559. ): cint; cdecl; external;
  560. function ldap_find_control(
  561. const oid : pcchar;
  562. ctrls : PPLDAPControl
  563. ): PLDAPControl; cdecl; external;
  564. procedure ldap_control_free(
  565. ctrl : PLDAPControl
  566. ); cdecl; external;
  567. procedure ldap_controls_free(
  568. ctrls : PPLDAPControl
  569. ); cdecl; external;
  570. (*
  571. * in dnssrv.c:
  572. *)
  573. function ldap_domain2dn(
  574. const domain : pcchar;
  575. var dn : pcchar
  576. ): cint; cdecl; external;
  577. function ldap_dn2domain(
  578. const dn : pcchar;
  579. var domain : pcchar
  580. ): cint; cdecl; external;
  581. function ldap_domain2hostlist(
  582. const domain : pcchar;
  583. var hostlist : pcchar
  584. ): cint; cdecl; external;
  585. (*
  586. * in extended.c:
  587. *)
  588. function ldap_extended_operation(
  589. ld : PLDAP;
  590. const reqoid : pcchar;
  591. reqdata : PBerval;
  592. serverctrls : PPLDAPControl;
  593. clientctrls : PPLDAPControl;
  594. var msgidp : cint
  595. ): cint; cdecl; external;
  596. function ldap_extended_operation_s(
  597. ld : PLDAP;
  598. const reqoid : pcchar;
  599. reqdata : PBerval;
  600. serverctrls : PPLDAPControl;
  601. clientctrls : PPLDAPControl;
  602. var retoidp : pcchar;
  603. var retdatap : PBerval
  604. ): cint; cdecl; external;
  605. function ldap_parse_extended_result(
  606. ld : PLDAP;
  607. res : PLDAPMessage;
  608. var retoidp : pcchar;
  609. var retdatap : PBerval;
  610. freeit : cbool
  611. ): cint; cdecl; external;
  612. function ldap_parse_intermediate(
  613. ld : PLDAP;
  614. res : PLDAPMessage;
  615. var retoidp : pcchar;
  616. var retdatap : PBerval;
  617. serverctrls : PPPLDAPControl;
  618. freeit : cbool
  619. ): cint; cdecl; external;
  620. (*
  621. * in groupings.c:
  622. *)
  623. (*#ifdef LDAP_EXOP_GROUPING_CREATE
  624. LDAP_F( int )
  625. ldap_grouping_create LDAP_P((
  626. LDAP *ld,
  627. LDAP_CONST cchar *grpoid,
  628. struct berval *grpdata,
  629. LDAPControl **serverctrls,
  630. LDAPControl **clientctrls,
  631. int *msgidp ));
  632. LDAP_F( int )
  633. ldap_grouping_create_s LDAP_P((
  634. LDAP *ld,
  635. LDAP_CONST cchar *grpoid,
  636. struct berval *grpdata,
  637. LDAPControl **serverctrls,
  638. LDAPControl **clientctrls,
  639. struct berval **retgrpcookiep,
  640. struct berval **retgrpdatap ));
  641. LDAP_F( int )
  642. ldap_parse_grouping_create_result LDAP_P((
  643. LDAP *ld,
  644. LDAPMessage *res,
  645. struct berval **retgrpcookiep,
  646. struct berval **retgrpdatap,
  647. LDAPControl ***serverctrls,
  648. int freeit ));
  649. LDAP_F( int )
  650. ldap_grouping_end LDAP_P((
  651. LDAP *ld,
  652. LDAP_CONST cchar *grpoid,
  653. struct berval *grpdata,
  654. LDAPControl **serverctrls,
  655. LDAPControl **clientctrls,
  656. int *msgidp ));
  657. LDAP_F( int )
  658. ldap_grouping_end_s LDAP_P((
  659. LDAP *ld,
  660. LDAP_CONST cchar *grpoid,
  661. struct berval *grpdata,
  662. LDAPControl **serverctrls,
  663. LDAPControl **clientctrls,
  664. struct berval **retgrpdatap ));
  665. LDAP_F( int )
  666. ldap_parse_grouping_end_result LDAP_P((
  667. LDAP *ld,
  668. LDAPMessage *res,
  669. struct berval **retgrpdatap,
  670. LDAPControl ***serverctrls,
  671. int freeit ));
  672. LDAP_F( int )
  673. ldap_grouping_action_operation LDAP_P((
  674. LDAP *ld,
  675. LDAP_CONST cchar *grpoid,
  676. struct berval *grpdata,
  677. LDAPControl **serverctrls,
  678. LDAPControl **clientctrls,
  679. int *msgidp ));
  680. LDAP_F( int )
  681. ldap_grouping_action_operation_s LDAP_P((
  682. LDAP *ld,
  683. LDAP_CONST cchar *grpoid,
  684. struct berval *grpdata,
  685. LDAPControl **serverctrls,
  686. LDAPControl **clientctrls,
  687. struct berval **retgrpcookiep,
  688. struct berval **retgrpdatap ));
  689. LDAP_F( int )
  690. ldap_parse_grouping_action_result LDAP_P((
  691. LDAP *ld,
  692. LDAPMessage *res,
  693. struct berval **retgrpcookiep,
  694. struct berval **retgrpdatap,
  695. LDAPControl ***serverctrls,
  696. int freeit ));
  697. LDAP_F( int )
  698. ldap_parse_grouping_end_notice LDAP_P((
  699. LDAP *ld,
  700. LDAPMessage *res,
  701. struct berval **retdatap,
  702. struct berval **retgrpcookiep,
  703. struct berval **retgrpdatap,
  704. int freeit ));
  705. LDAP_F( int )
  706. ldap_parse_grouping_info_notice LDAP_P((
  707. LDAP *ld,
  708. LDAPMessage *res,
  709. struct berval **retdatap,
  710. struct berval **retgrpcookiep,
  711. struct berval **retgrpdatap,
  712. int freeit ));
  713. #endif
  714. *)
  715. (*
  716. * in abandon.c:
  717. *)
  718. function ldap_abandon_ext(
  719. ld : PLDAP;
  720. msgid : cint;
  721. serverctrls : PPLDAPControl;
  722. clientctrls : PPLDAPControl
  723. ): cint; cdecl; external;
  724. (*
  725. * in add.c:
  726. *)
  727. function ldap_add_ext(
  728. ld : PLDAP;
  729. const dn : pcchar;
  730. attrs : PPLDAPMod;
  731. serverctrls : PPLDAPControl;
  732. clientctrls : PPLDAPControl;
  733. var msgidp : cint
  734. ): cint; cdecl; external;
  735. function ldap_add_ext_s(
  736. ld : PLDAP;
  737. const dn : pcchar;
  738. attrs : PPLDAPMod;
  739. serverctrls : PPLDAPControl;
  740. clientctrls : PPLDAPControl
  741. ): cint; cdecl; external;
  742. (*
  743. * in sasl.c:
  744. *)
  745. function ldap_sasl_bind(
  746. ld : PLDAP;
  747. const dn : pcchar;
  748. const mechanism : pcchar;
  749. cred : PBerval;
  750. serverctrls : PPLDAPControl;
  751. clientctrls : PPLDAPControl;
  752. var msgidp : cint
  753. ): cint; cdecl; external;
  754. function ldap_sasl_bind_s(
  755. ld : PLDAP;
  756. const dn : pcchar;
  757. const mechanism : pcchar;
  758. cred : PBerval;
  759. serverctrls : PPLDAPControl;
  760. clientctrls : PPLDAPControl;
  761. servercredp : PPBerval
  762. ): cint; cdecl; external;
  763. (* Interaction flags (should be passed about in a control)
  764. * Automatic (default): use defaults, prompt otherwise
  765. * Interactive: prompt always
  766. * Quiet: never prompt
  767. *)
  768. const
  769. LDAP_SASL_AUTOMATIC = 0;
  770. LDAP_SASL_INTERACTIVE = 1;
  771. LDAP_SASL_QUIET = 2;
  772. (*
  773. * V3 SASL Interaction Function Callback Prototype
  774. * when using Cyrus SASL, interact is pointer to sasl_interact_t
  775. * should likely passed in a control (and provided controls)
  776. *)
  777. type
  778. LDAP_SASL_INTERACT_PROC = function(ld: PLDAP; flags: cuint; defaults, interact: Pointer): cint; cdecl;
  779. function ldap_sasl_interactive_bind_s(
  780. ld : PLDAP;
  781. const dn : pcchar;
  782. const mechanism : pcchar;
  783. serverctrls : PPLDAPControl;
  784. clientctrls : PPLDAPControl;
  785. flags : cuint;
  786. proc : LDAP_SASL_INTERACT_PROC;
  787. defaults : Pointer
  788. ): cint; cdecl; external;
  789. function ldap_parse_sasl_bind_result(
  790. ld : PLDAP;
  791. res : PLDAPMessage;
  792. var servercredp : PBerval;
  793. freeit : cbool
  794. ): cint; cdecl; external;
  795. (*
  796. * in compare.c:
  797. *)
  798. function ldap_compare_ext(
  799. ld : PLDAP;
  800. const dn : pcchar;
  801. const attr : pcchar;
  802. bvalue : PBerval;
  803. serverctrls : PPLDAPControl;
  804. clientctrls : PPLDAPControl;
  805. var msgidp : cint
  806. ): cint; cdecl; external;
  807. function ldap_compare_ext_s(
  808. ld : PLDAP;
  809. const dn : pcchar;
  810. const attr : pcchar;
  811. bvalue : PBerval;
  812. serverctrls : PPLDAPControl;
  813. clientctrls : PPLDAPControl
  814. ): cint; cdecl; external;
  815. (*
  816. * in delete.c:
  817. *)
  818. function ldap_delete_ext(
  819. ld : PLDAP;
  820. const dn : pcchar;
  821. serverctrls : PPLDAPControl;
  822. clientctrls : PPLDAPControl;
  823. var msgidp : cint
  824. ): cint; cdecl; external;
  825. function ldap_delete_ext_s(
  826. ld : PLDAP;
  827. const dn : pcchar;
  828. serverctrls : PPLDAPControl;
  829. clientctrls : PPLDAPControl
  830. ): cint; cdecl; external;
  831. (*
  832. * in error.c:
  833. *)
  834. function ldap_parse_result(
  835. ld : PLDAP;
  836. res : PLDAPMessage;
  837. errcodep : pcint;
  838. matcheddnp : ppcchar;
  839. errmsgp : ppcchar;
  840. referralsp : pppcchar;
  841. serverctrls : PPPLDAPControl;
  842. freeit : cbool
  843. ): cint; cdecl; external;
  844. function ldap_err2string(
  845. err : cint
  846. ): pcchar; cdecl; external;
  847. (*
  848. * in modify.c:
  849. *)
  850. function ldap_modify_ext(
  851. ld : PLDAP;
  852. const dn : pcchar;
  853. mods : PPLDAPMod;
  854. serverctrls : PPLDAPControl;
  855. clientctrls : PPLDAPControl;
  856. var msgidp : cint
  857. ): cint; cdecl; external;
  858. function ldap_modify_ext_s(
  859. ld : PLDAP;
  860. const dn : pcchar;
  861. mods : PPLDAPMod;
  862. serverctrls : PPLDAPControl;
  863. clientctrls : PPLDAPControl
  864. ): cint; cdecl; external;
  865. (*
  866. * in modrdn.c:
  867. *)
  868. function ldap_rename(
  869. ld : PLDAP;
  870. const dn : pcchar;
  871. const newrdn : pcchar;
  872. const newSuperior: pcchar;
  873. deleteoldrdn : cbool;
  874. sctrls : PPLDAPControl;
  875. cctrls : PPPLDAPControl;
  876. var msgidp : cint
  877. ): cint; cdecl; external;
  878. function ldap_rename_s(
  879. ld : PLDAP;
  880. const dn : pcchar;
  881. const newrdn : pcchar;
  882. const newSuperior: pcchar;
  883. deleteoldrdn : cbool;
  884. sctrls : PPLDAPControl;
  885. cctrls : PPLDAPControl
  886. ): cint; cdecl; external;
  887. (*
  888. * in open.c:
  889. *)
  890. function ldap_create(
  891. var ld : PLDAP
  892. ): cint; cdecl; external;
  893. function ldap_initialize(
  894. var ld : PLDAP;
  895. const url : pcchar
  896. ): cint; cdecl; external;
  897. (*
  898. * in tls.c
  899. *)
  900. function ldap_tls_inplace(
  901. ld : PLDAP
  902. ): cint; cdecl; external;
  903. function ldap_install_tls(
  904. ld : PLDAP
  905. ): cint; cdecl; external;
  906. function ldap_start_tls(
  907. ld : PLDAP;
  908. serverctrls : PPLDAPControl;
  909. clientctrls : PPLDAPControl;
  910. var msgidp : cint
  911. ): cint; cdecl; external;
  912. function ldap_start_tls_s(
  913. ld : PLDAP;
  914. serverctrls : PPLDAPControl;
  915. clientctrls : PPLDAPControl
  916. ): cint; cdecl; external;
  917. (*
  918. * in messages.c:
  919. *)
  920. function ldap_first_message(
  921. ld : PLDAP;
  922. chain : PLDAPMessage
  923. ): PLDAPMessage; cdecl; external;
  924. function ldap_next_message(
  925. ld : PLDAP;
  926. msg : PLDAPMessage
  927. ): PLDAPMessage; cdecl; external;
  928. function ldap_count_messages(
  929. ld : PLDAP;
  930. chain : PLDAPMessage
  931. ): cint; cdecl; external;
  932. (*
  933. * in references.c:
  934. *)
  935. function ldap_first_reference(
  936. ld : PLDAP;
  937. chain : PLDAPMessage
  938. ): PLDAPMessage; cdecl; external;
  939. function ldap_next_reference(
  940. ld : PLDAP;
  941. ref : PLDAPMessage
  942. ): PLDAPMessage; cdecl; external;
  943. function ldap_count_references(
  944. ld : PLDAP;
  945. chain : PLDAPMessage
  946. ): cint; cdecl; external;
  947. function ldap_parse_reference(
  948. ld : PLDAP;
  949. ref : PLDAPMessage;
  950. var referralsp : ppcchar;
  951. serverctrls : PPPLDAPControl;
  952. freeit : cbool
  953. ): cint; cdecl; external;
  954. (*
  955. * in getentry.c:
  956. *)
  957. function ldap_first_entry(
  958. ld : PLDAP;
  959. chain : PLDAPMessage
  960. ): PLDAPMessage; cdecl; external;
  961. function ldap_next_entry(
  962. ld : PLDAP;
  963. entry : PLDAPMessage
  964. ): PLDAPMessage; cdecl; external;
  965. function ldap_count_entries(
  966. ld : PLDAP;
  967. chain : PLDAPMessage
  968. ): cint; cdecl; external;
  969. function ldap_get_entry_controls(
  970. ld : PLDAP;
  971. entry : PLDAPMessage;
  972. var serverctrls : PPLDAPControl
  973. ): cint; cdecl; external;
  974. (*
  975. * in addentry.c
  976. *)
  977. function ldap_delete_result_entry(
  978. list : PPLDAPMessage;
  979. e : PLDAPMessage
  980. ): PLDAPMessage; cdecl; external;
  981. procedure ldap_add_result_entry(
  982. list : PPLDAPMessage;
  983. e : PLDAPMessage
  984. ); cdecl; external;
  985. (*
  986. * in getdn.c
  987. *)
  988. function ldap_get_dn(
  989. ld : PLDAP;
  990. entry : PLDAPMessage
  991. ): pcchar; cdecl; external;
  992. const
  993. LDAP_AVA_NULL = $0000;
  994. LDAP_AVA_STRING = $0001;
  995. LDAP_AVA_BINARY = $0002;
  996. LDAP_AVA_NONPRINTABLE = $0004;
  997. LDAP_AVA_FREE_ATTR = $0010;
  998. LDAP_AVA_FREE_VALUE = $0020;
  999. type
  1000. pldap_ava = ^ldap_ava;
  1001. ldap_ava = record
  1002. la_attr : berval;
  1003. la_value : berval;
  1004. la_flags : cuint;
  1005. la_private : Pointer;
  1006. end;
  1007. PLDAPAVA = ^LDAPAVA;
  1008. LDAPAVA = ldap_ava;
  1009. PLDAPRDN = ^LDAPRDN;
  1010. LDAPRDN = ^PLDAPAVA;
  1011. PLDAPDN = ^LDAPDN;
  1012. LDAPDN = ^LDAPRDN;
  1013. const
  1014. (* DN formats *)
  1015. LDAP_DN_FORMAT_LDAP = $0000;
  1016. LDAP_DN_FORMAT_LDAPV3 = $0010;
  1017. LDAP_DN_FORMAT_LDAPV2 = $0020;
  1018. LDAP_DN_FORMAT_DCE = $0030;
  1019. LDAP_DN_FORMAT_UFN = $0040; (* dn2str only *)
  1020. LDAP_DN_FORMAT_AD_CANONICAL = $0050; (* dn2str only *)
  1021. LDAP_DN_FORMAT_LBER = $00F0; (* for testing only *)
  1022. LDAP_DN_FORMAT_MASK = $00F0;
  1023. (* DN flags *)
  1024. LDAP_DN_PRETTY = $0100;
  1025. LDAP_DN_SKIP = $0200;
  1026. LDAP_DN_P_NOLEADTRAILSPACES = $1000;
  1027. LDAP_DN_P_NOSPACEAFTERRDN = $2000;
  1028. LDAP_DN_PEDANTIC = $F000;
  1029. procedure ldap_rdnfree(rdn: LDAPRDN); cdecl; external;
  1030. procedure ldap_dnfree(rdn: LDAPDN); cdecl; external;
  1031. function ldap_bv2dn(
  1032. bv : PBerval;
  1033. var dn : LDAPDN;
  1034. flags : cuint
  1035. ): cint; cdecl; external;
  1036. function ldap_str2dn(
  1037. const str : pcchar;
  1038. var dn : LDAPDN;
  1039. flags : cuint
  1040. ): cint; cdecl; external;
  1041. function ldap_dn2bv(
  1042. dn : LDAPDN;
  1043. bv : PBerval;
  1044. flags : cuint
  1045. ): cint; cdecl; external;
  1046. function ldap_dn2str(
  1047. dn : LDAPDN;
  1048. var str : pcchar;
  1049. flags : cuint
  1050. ): cint; cdecl; external;
  1051. function ldap_bv2rdn(
  1052. bv : PBerval;
  1053. var rdn : LDAPRDN;
  1054. var next : pcchar;
  1055. flags : cuint
  1056. ): cint; cdecl; external;
  1057. function ldap_str2rdn(
  1058. const str : pcchar;
  1059. var rdn : LDAPRDN;
  1060. var next : pcchar;
  1061. flags : cuint
  1062. ): cint; cdecl; external;
  1063. function ldap_rdn2bv(
  1064. rdn : LDAPRDN;
  1065. bv : PBerval;
  1066. flags : cuint
  1067. ): cint; cdecl; external;
  1068. function ldap_rdn2str(
  1069. rdn : LDAPRDN;
  1070. var str : pcchar;
  1071. flags : cuint
  1072. ): cint; cdecl; external;
  1073. function ldap_dn_normalize(
  1074. const _in : pcchar;
  1075. iflags : cuint;
  1076. var _out : pcchar;
  1077. oflags : cuint
  1078. ): cint; cdecl; external;
  1079. type
  1080. LDAPDN_rewrite_func = function(dn: LDAPDN; flags: cuint; ctx: Pointer): cint; cdecl;
  1081. function ldap_X509dn2bv(
  1082. x509_name : Pointer;
  1083. dn : PBerval;
  1084. func : LDAPDN_rewrite_func;
  1085. flags : cuint
  1086. ): cint; cdecl; external;
  1087. function ldap_get_dn_ber(
  1088. ld : PLDAP;
  1089. e : PLDAPMessage;
  1090. var berout : PBerElement;
  1091. dn : PBerval
  1092. ): cint; cdecl; external;
  1093. function ldap_get_attribute_ber(
  1094. ld : PLDAP;
  1095. e : PLDAPMessage;
  1096. ber : PBerElement;
  1097. attr : PBerval;
  1098. var vals : PBerval
  1099. ): cint; cdecl; external;
  1100. (*
  1101. * in getattr.c
  1102. *)
  1103. function ldap_first_attribute(
  1104. ld : PLDAP;
  1105. entry : PLDAPMessage;
  1106. var ber : PBerElement
  1107. ): pcchar; cdecl; external;
  1108. function ldap_next_attribute(
  1109. ld : PLDAP;
  1110. entry : PLDAPMessage;
  1111. ber : PBerElement
  1112. ): pcchar; cdecl; external;
  1113. (*
  1114. * in getvalues.c
  1115. *)
  1116. function ldap_get_values_len(
  1117. ld : PLDAP;
  1118. entry : PLDAPMessage;
  1119. const target : pcchar
  1120. ): PPBerval; cdecl; external;
  1121. function ldap_count_values_len(
  1122. vals : PPBerval
  1123. ): cint; cdecl; external;
  1124. procedure ldap_value_free_len(
  1125. vals : PPBerval
  1126. ); cdecl; external;
  1127. (*
  1128. * in result.c:
  1129. *)
  1130. function ldap_result(
  1131. ld : PLDAP;
  1132. msgid : cint;
  1133. all : cint;
  1134. timeout : ptimeval;
  1135. var result : PLDAPMessage
  1136. ): cint; cdecl; external;
  1137. function ldap_msgtype(
  1138. lm : PLDAPMessage
  1139. ): cint; cdecl; external;
  1140. function ldap_msgid(
  1141. lm : PLDAPMessage
  1142. ): cint; cdecl; external;
  1143. function ldap_msgfree(
  1144. lm : PLDAPMessage
  1145. ): cint; cdecl; external;
  1146. function ldap_msgdelete(
  1147. ld : PLDAP;
  1148. msgid : cint
  1149. ): cint; cdecl; external;
  1150. (*
  1151. * in search.c:
  1152. *)
  1153. function ldap_search_ext(
  1154. ld : PLDAP;
  1155. const base : pcchar;
  1156. scope : cint;
  1157. const filter : pcchar;
  1158. attrs : ppcchar;
  1159. attrsonly : cbool;
  1160. serverctrls : PPLDAPControl;
  1161. clientctrls : PPLDAPControl;
  1162. timout : ptimeval;
  1163. sizelimit : cint;
  1164. var msgidp : cint
  1165. ): cint; cdecl; external;
  1166. function ldap_search_ext_s(
  1167. ld : PLDAP;
  1168. const base : pcchar;
  1169. scope : cint;
  1170. const filter : pcchar;
  1171. attrs : ppcchar;
  1172. attrsonly : cbool;
  1173. serverctrls : PPLDAPControl;
  1174. clientctrls : PPLDAPControl;
  1175. timout : ptimeval;
  1176. sizelimit : cint;
  1177. var res : PLDAPMessage
  1178. ): cint; cdecl; external;
  1179. (*
  1180. * in unbind.c
  1181. *)
  1182. function ldap_unbind_ext(
  1183. ld : PLDAP;
  1184. serverctrls : PPLDAPControl;
  1185. clientctrls : PPLDAPControl
  1186. ): cint; cdecl; external;
  1187. function ldap_unbind_ext_s(
  1188. ld : PLDAP;
  1189. serverctrls : PPLDAPControl;
  1190. clientctrls : PPLDAPControl
  1191. ): cint; cdecl; external;
  1192. (*
  1193. * in filter.c
  1194. *)
  1195. function ldap_put_vrFilter(
  1196. ber : PBerElement;
  1197. const vrf : pcchar
  1198. ): cint; cdecl; external;
  1199. (*
  1200. * in free.c
  1201. *)
  1202. function ldap_memalloc(
  1203. s : ber_len_t
  1204. ): Pointer; cdecl; external;
  1205. function ldap_memrealloc(
  1206. p : Pointer;
  1207. s : ber_len_t
  1208. ): Pointer; cdecl; external;
  1209. function ldap_memcalloc(
  1210. n : ber_len_t;
  1211. s : ber_len_t
  1212. ): Pointer; cdecl; external;
  1213. procedure ldap_memfree(
  1214. p : Pointer
  1215. ); cdecl; external;
  1216. procedure ldap_memvfree(
  1217. v : PPointer
  1218. ); cdecl; external;
  1219. function ldap_strdup(
  1220. const str : pcchar
  1221. ): pcchar; cdecl; external;
  1222. procedure ldap_mods_free(
  1223. mods : PPLDAPMod;
  1224. freemods : cbool
  1225. ); cdecl; external;
  1226. (*
  1227. * in url.c
  1228. *)
  1229. function ldap_is_ldap_url(
  1230. const url : pcchar
  1231. ): cint; cdecl; external;
  1232. function ldap_is_ldaps_url(
  1233. const url : pcchar
  1234. ): cint; cdecl; external;
  1235. function ldap_is_ldapi_url(
  1236. const url : pcchar
  1237. ): cint; cdecl; external;
  1238. function ldap_url_parse(
  1239. const url : pcchar;
  1240. var ludpp : PLDAPURLDesc
  1241. ): cint; cdecl; external;
  1242. function ldap_url_desc2str(
  1243. ludpp : PLDAPURLDesc
  1244. ): pcchar; cdecl; external;
  1245. procedure ldap_free_urldesc(
  1246. ludpp : PLDAPURLDesc
  1247. ); cdecl; external;
  1248. (*
  1249. * LDAP Cancel Extended Operation <draft-zeilenga-ldap-cancel-xx.txt>
  1250. * in cancel.c
  1251. *)
  1252. const
  1253. LDAP_API_FEATURE_CANCEL = 1000;
  1254. function ldap_cancel(
  1255. ld : PLDAP;
  1256. cancelid : cint;
  1257. sctrl : PPLDAPControl;
  1258. cctrl : PPLDAPControl;
  1259. var msgidp : cint
  1260. ): cint; cdecl; external;
  1261. function ldap_cancel_s(
  1262. ld : PLDAP;
  1263. cancelid : cint;
  1264. sctrl : PPLDAPControl;
  1265. cctrl : PPLDAPControl
  1266. ): cint; cdecl; external;
  1267. (*
  1268. * LDAP Server Side Sort
  1269. * in sortctrl.c
  1270. *)
  1271. const
  1272. LDAP_API_FEATURE_SERVER_SIDE_SORT = 1000;
  1273. (* structure for a sort-key *)
  1274. type
  1275. PPLDAPSortKey = ^PLDAPSortKey;
  1276. PLDAPSortKey = ^LDAPSortKey;
  1277. LDAPSortKey = record
  1278. attributeType : pcchar;
  1279. orderingRule : pcchar;
  1280. reverseOrder : cbool;
  1281. end;
  1282. function ldap_create_sort_keylist(
  1283. var sortKeyList : PPLDAPSortKey;
  1284. keyString : pcchar
  1285. ): cint; cdecl; external;
  1286. procedure ldap_free_sort_keylist(
  1287. sortKeyList : PPLDAPSortKey
  1288. ); cdecl; external;
  1289. function ldap_create_sort_control(
  1290. ld : PLDAP;
  1291. keyList : PPLDAPSortKey;
  1292. ctl_iscritical : cbool;
  1293. var ctrlp : PLDAPControl
  1294. ): cint; cdecl; external;
  1295. function ldap_parse_sort_control(
  1296. ld : PLDAP;
  1297. ctrlp : PPLDAPControl;
  1298. var result : culong;
  1299. var attribute : pcchar
  1300. ): cint; cdecl; external;
  1301. (*
  1302. * LDAP Virtual List View
  1303. * in vlvctrl.c
  1304. *)
  1305. const
  1306. LDAP_API_FEATURE_VIRTUAL_LIST_VIEW = 1000;
  1307. (* structure for virtual list *)
  1308. type
  1309. PLDAPVLVInfo = ^LDAPVLVInfo;
  1310. LDAPVLVInfo = record
  1311. ldvlv_version : cint;
  1312. ldvlv_before_count : culong;
  1313. ldvlv_after_count : culong;
  1314. ldvlv_offset : culong;
  1315. ldvlv_count : culong;
  1316. ldvlv_attrvalue : PBerval;
  1317. ldvlv_context : PBerval;
  1318. ldvlv_extradata : Pointer;
  1319. end;
  1320. function ldap_create_vlv_control(
  1321. ld : PLDAP;
  1322. ldvlistp : PLDAPVLVInfo;
  1323. var ctrlp : PLDAPControl
  1324. ): cint; cdecl; external;
  1325. function ldap_parse_vlv_control(
  1326. ld : PLDAP;
  1327. ctrls : PPLDAPControl;
  1328. var target_posp : culong;
  1329. var list_countp : culong;
  1330. var contextp : PBerval;
  1331. var errcodep : cint
  1332. ): cint; cdecl; external;
  1333. (*
  1334. * LDAP Transactions
  1335. * in txn.c
  1336. *)
  1337. (*
  1338. #ifdef LDAP_GROUP_TRANSACTION
  1339. LDAP_F( int )
  1340. ldap_parse_txn_create LDAP_P((
  1341. LDAP *ld,
  1342. LDAPMessage *res,
  1343. struct berval **cookie ));
  1344. LDAP_F( int )
  1345. ldap_txn_create LDAP_P((
  1346. LDAP *ld,
  1347. LDAPControl **sctrls,
  1348. LDAPControl **cctrls,
  1349. int *msgidp ));
  1350. LDAP_F( int )
  1351. ldap_txn_create_s LDAP_P((
  1352. LDAP *ld,
  1353. struct berval **cookie,
  1354. LDAPControl **sctrls,
  1355. LDAPControl **cctrls ));
  1356. LDAP_F( int )
  1357. ldap_txn_end LDAP_P((
  1358. LDAP *ld,
  1359. struct berval *cookie,
  1360. int commit,
  1361. LDAPControl **sctrls,
  1362. LDAPControl **cctrls,
  1363. int *msgidp ));
  1364. LDAP_F( int )
  1365. ldap_txn_end_s LDAP_P((
  1366. LDAP *ld,
  1367. struct berval *cookie,
  1368. int commit,
  1369. LDAPControl **sctrls,
  1370. LDAPControl **cctrls ));
  1371. #endif*)
  1372. (*
  1373. * LDAP Who Am I?
  1374. * in whoami.c
  1375. *)
  1376. const
  1377. LDAP_API_FEATURE_WHOAMI = 1000;
  1378. function ldap_parse_whoami(
  1379. ld : PLDAP;
  1380. res : PLDAPMessage;
  1381. var authzid : PBerval
  1382. ): cint; cdecl; external;
  1383. function ldap_whoami(
  1384. ld : PLDAP;
  1385. sctrl : PPLDAPControl;
  1386. cctrl : PPLDAPControl;
  1387. var msgidp : cint
  1388. ): cint; cdecl; external;
  1389. function ldap_whoami_s(
  1390. ld : PLDAP;
  1391. var authzid : PBerval;
  1392. sctrl : PPLDAPControl;
  1393. cctrl : PPLDAPControl
  1394. ): cint; cdecl; external;
  1395. (*
  1396. * LDAP Password Modify
  1397. * in passwd.c
  1398. *)
  1399. const
  1400. LDAP_API_FEATURE_PASSWD_MODIFY = 1000;
  1401. function ldap_parse_passwd(
  1402. ld : PLDAP;
  1403. res : PLDAPMessage;
  1404. newpasswd : PBerval
  1405. ): cint; cdecl; external;
  1406. function ldap_passwd(
  1407. ld : PLDAP;
  1408. user : PBerval;
  1409. oldpw : PBerval;
  1410. newpw : PBerval;
  1411. sctrl : PPLDAPControl;
  1412. cctrl : PPLDAPControl;
  1413. var msgidp : cint
  1414. ): cint; cdecl; external;
  1415. function ldap_passwd_s(
  1416. ld : PLDAP;
  1417. user : PBerval;
  1418. oldpw : PBerval;
  1419. newpw : PBerval;
  1420. newpasswd : PBerval;
  1421. sctrl : PPLDAPControl;
  1422. cctrl : PPLDAPControl
  1423. ): cint; cdecl; external;
  1424. (*
  1425. * LDAP Password Policy controls
  1426. * in ppolicy.c
  1427. *)
  1428. (*
  1429. #ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
  1430. #define LDAP_API_FEATURE_PASSWORD_POLICY 1000
  1431. typedef enum passpolicyerror_enum {
  1432. PP_passwordExpired = 0,
  1433. PP_accountLocked = 1,
  1434. PP_changeAfterReset = 2,
  1435. PP_passwordModNotAllowed = 3,
  1436. PP_mustSupplyOldPassword = 4,
  1437. PP_insufficientPasswordQuality = 5,
  1438. PP_passwordTooShort = 6,
  1439. PP_passwordTooYoung = 7,
  1440. PP_passwordInHistory = 8,
  1441. PP_noError = 65535
  1442. } LDAPPasswordPolicyError;
  1443. LDAP_F( int )
  1444. ldap_create_passwordpolicy_control LDAP_P((
  1445. LDAP *ld,
  1446. LDAPControl **ctrlp ));
  1447. LDAP_F( int )
  1448. ldap_parse_passwordpolicy_control LDAP_P((
  1449. LDAP *ld,
  1450. LDAPControl *ctrl,
  1451. int *expirep,
  1452. int *gracep,
  1453. LDAPPasswordPolicyError *errorp ));
  1454. LDAP_F( const cchar * )
  1455. ldap_passwordpolicy_err2txt LDAP_P(( LDAPPasswordPolicyError ));
  1456. #endif*)
  1457. (*
  1458. * hacks for NTLM
  1459. *)
  1460. const
  1461. LDAP_AUTH_NTLM_REQUEST = ber_tag_t($8a);
  1462. LDAP_AUTH_NTLM_RESPONSE = ber_tag_t($8b);
  1463. function ldap_ntlm_bind(
  1464. ld : PLDAP;
  1465. const dn : pcchar;
  1466. tag : ber_tag_t;
  1467. cred : PBerval;
  1468. sctrl : PPLDAPControl;
  1469. cctrl : PPLDAPControl;
  1470. var msgidp : cint
  1471. ): cint; cdecl; external;
  1472. function ldap_parse_ntlm_bind_result(
  1473. ld : PLDAP;
  1474. res : PLDAPMessage;
  1475. challenge : PBerval
  1476. ): cint; cdecl; external;