slapi-plugin.h 69 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. /* slapi-plugin.h - public Directory Server plugin interface */
  42. #ifndef _SLAPIPLUGIN
  43. #define _SLAPIPLUGIN
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. #include "prtypes.h"
  48. #include "ldap.h"
  49. /*
  50. * The slapi_attr_get_flags() routine returns a bitmap that contains one or
  51. * more of these values.
  52. *
  53. * Note that the flag values 0x0010, 0x0020, 0x4000, and 0x8000 are reserved.
  54. */
  55. #define SLAPI_ATTR_FLAG_SINGLE 0x0001 /* single-valued attribute */
  56. #define SLAPI_ATTR_FLAG_OPATTR 0x0002 /* operational attribute */
  57. #define SLAPI_ATTR_FLAG_READONLY 0x0004 /* read from shipped config file */
  58. #define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY /* alias for read only */
  59. #define SLAPI_ATTR_FLAG_OBSOLETE 0x0040 /* an outdated definition */
  60. #define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080 /* collective (not supported) */
  61. #define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100 /* can't be modified over LDAP */
  62. #define SLAPI_ATTR_FLAG_NORMALIZED 0x0200 /* the attr value is normalized */
  63. /* operation flags */
  64. #define SLAPI_OP_FLAG_NEVER_CHAIN 0x00800 /* Do not chain the operation */
  65. #define SLAPI_OP_FLAG_NO_ACCESS_CHECK 0x10000 /* Do not check for access control - bypass them */
  66. /*
  67. * access control levels
  68. */
  69. #define SLAPI_ACL_COMPARE 0x01
  70. #define SLAPI_ACL_SEARCH 0x02
  71. #define SLAPI_ACL_READ 0x04
  72. #define SLAPI_ACL_WRITE 0x08
  73. #define SLAPI_ACL_DELETE 0x10
  74. #define SLAPI_ACL_ADD 0x20
  75. #define SLAPI_ACL_SELF 0x40
  76. #define SLAPI_ACL_PROXY 0x80
  77. #define SLAPI_ACL_ALL 0x7f
  78. /*
  79. * filter types
  80. */
  81. #define LDAP_FILTER_AND 0xa0L
  82. #define LDAP_FILTER_OR 0xa1L
  83. #define LDAP_FILTER_NOT 0xa2L
  84. #define LDAP_FILTER_EQUALITY 0xa3L
  85. #define LDAP_FILTER_SUBSTRINGS 0xa4L
  86. #define LDAP_FILTER_GE 0xa5L
  87. #define LDAP_FILTER_LE 0xa6L
  88. #define LDAP_FILTER_PRESENT 0x87L
  89. #define LDAP_FILTER_APPROX 0xa8L
  90. #define LDAP_FILTER_EXTENDED 0xa9L
  91. /*
  92. * Sequential access types
  93. */
  94. #define SLAPI_SEQ_FIRST 1
  95. #define SLAPI_SEQ_LAST 2
  96. #define SLAPI_SEQ_PREV 3
  97. #define SLAPI_SEQ_NEXT 4
  98. /*
  99. * return codes from a backend API call
  100. */
  101. #define SLAPI_FAIL_GENERAL -1
  102. #define SLAPI_FAIL_DISKFULL -2
  103. /*
  104. * return codes used by BIND functions
  105. */
  106. #define SLAPI_BIND_SUCCESS 0 /* front end will send result */
  107. #define SLAPI_BIND_FAIL 2 /* back end should send result */
  108. #define SLAPI_BIND_ANONYMOUS 3 /* front end will send result */
  109. /* commonly used attributes names */
  110. #define SLAPI_ATTR_UNIQUEID "nsuniqueid"
  111. #define SLAPI_ATTR_OBJECTCLASS "objectclass"
  112. #define SLAPI_ATTR_VALUE_TOMBSTONE "nsTombstone"
  113. #define SLAPI_ATTR_VALUE_PARENT_UNIQUEID "nsParentUniqueID"
  114. #define SLAPI_ATTR_NSCP_ENTRYDN "nscpEntryDN"
  115. /* opaque structures */
  116. typedef struct slapi_pblock Slapi_PBlock;
  117. typedef struct slapi_entry Slapi_Entry;
  118. typedef struct slapi_attr Slapi_Attr;
  119. typedef struct slapi_value Slapi_Value;
  120. typedef struct slapi_value_set Slapi_ValueSet;
  121. typedef struct slapi_filter Slapi_Filter;
  122. typedef struct backend Slapi_Backend;
  123. typedef struct _guid_t Slapi_UniqueID;
  124. typedef struct op Slapi_Operation;
  125. typedef struct conn Slapi_Connection;
  126. typedef struct slapi_dn Slapi_DN;
  127. typedef struct slapi_rdn Slapi_RDN;
  128. typedef struct slapi_mod Slapi_Mod;
  129. typedef struct slapi_mods Slapi_Mods;
  130. typedef struct slapi_componentid Slapi_ComponentId;
  131. /* Online tasks interface (to support import, export, etc) */
  132. typedef struct _slapi_task Slapi_Task;
  133. typedef int (*TaskCallbackFn)(Slapi_Task *task);
  134. /*
  135. * The default thread stacksize for nspr21 is 64k (except on IRIX! It's 32k!).
  136. * For OSF, we require a larger stacksize as actual storage allocation is
  137. * higher i.e pointers are allocated 8 bytes but lower 4 bytes are used.
  138. * The value 0 means use the default stacksize.
  139. *
  140. * larger stacksize (256KB) is needed on IRIX due to its 4KB BUFSIZ.
  141. * (@ pthread IRIX porting -- 01/11/99)
  142. *
  143. * Don't know why HP was defined as follows up until DS6.1x. HP BUFSIZ is 1KB
  144. #elif ( defined( hpux ))
  145. #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
  146. */
  147. #if ( defined( irix ))
  148. #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
  149. #elif ( defined ( OSF1 ))
  150. #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
  151. #elif ( defined ( AIX ))
  152. #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
  153. /* All 64-bit builds get a bigger stack size */
  154. #elif ( defined ( __LP64__ )) || defined (_LP64)
  155. #define SLAPD_DEFAULT_THREAD_STACKSIZE 262144L
  156. #else
  157. #define SLAPD_DEFAULT_THREAD_STACKSIZE 0
  158. #endif
  159. /*
  160. * parameter block routines
  161. */
  162. Slapi_PBlock *slapi_pblock_new( void ); /* allocate and initialize */
  163. int slapi_pblock_get( Slapi_PBlock *pb, int arg, void *value );
  164. int slapi_pblock_set( Slapi_PBlock *pb, int arg, void *value );
  165. void slapi_pblock_destroy( Slapi_PBlock *pb );
  166. /*
  167. * entry routines
  168. */
  169. Slapi_Entry *slapi_str2entry( char *s, int flags );
  170. /* Flags for slapi_str2entry() */
  171. /* Remove duplicate values */
  172. #define SLAPI_STR2ENTRY_REMOVEDUPVALS 1
  173. /* Add any missing values from RDN */
  174. #define SLAPI_STR2ENTRY_ADDRDNVALS 2
  175. /* Provide a hint that the entry is large; this enables some optimizations
  176. related to large entries. */
  177. #define SLAPI_STR2ENTRY_BIGENTRY 4
  178. /* Check to see if the entry is a tombstone; if so, set the tombstone flag
  179. (SLAPI_ENTRY_FLAG_TOMBSTONE) */
  180. #define SLAPI_STR2ENTRY_TOMBSTONE_CHECK 8
  181. /* Ignore entry state information if present */
  182. #define SLAPI_STR2ENTRY_IGNORE_STATE 16
  183. /* Return entries that have a "version: 1" line as part of the LDIF
  184. representation */
  185. #define SLAPI_STR2ENTRY_INCLUDE_VERSION_STR 32
  186. /* Add any missing ancestor values based on the object class hierarchy */
  187. #define SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES 64
  188. /* Inform slapi_str2entry() that the LDIF input is not well formed.
  189. Well formed LDIF has no duplicate attribute values, already
  190. has the RDN as an attribute of the entry, and has all values for a
  191. given attribute type listed contiguously. */
  192. #define SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF 128
  193. char *slapi_entry2str_with_options( Slapi_Entry *e, int *len, int options );
  194. /* Options for slapi_entry2str_with_options() */
  195. #define SLAPI_DUMP_STATEINFO 1 /* replication state */
  196. #define SLAPI_DUMP_UNIQUEID 2 /* unique ID */
  197. #define SLAPI_DUMP_NOOPATTRS 4 /* suppress operational attrs */
  198. #define SLAPI_DUMP_NOWRAP 8 /* no line breaks */
  199. #define SLAPI_DUMP_MINIMAL_ENCODING 16 /* use less base64 encoding */
  200. char *slapi_entry2str( Slapi_Entry *e, int *len );
  201. Slapi_Entry *slapi_entry_alloc(void);
  202. void slapi_entry_init(Slapi_Entry *e, char *dn, Slapi_Attr *a);
  203. void slapi_entry_free( Slapi_Entry *e );
  204. Slapi_Entry *slapi_entry_dup( const Slapi_Entry *e );
  205. char *slapi_entry_get_dn( Slapi_Entry *e );
  206. char *slapi_entry_get_ndn( Slapi_Entry *e );
  207. const Slapi_DN *slapi_entry_get_sdn_const( const Slapi_Entry *e );
  208. Slapi_DN *slapi_entry_get_sdn( Slapi_Entry *e );
  209. const char *slapi_entry_get_dn_const( const Slapi_Entry *e );
  210. void slapi_entry_set_dn( Slapi_Entry *e, char *dn );
  211. void slapi_entry_set_sdn( Slapi_Entry *e, const Slapi_DN *sdn );
  212. int slapi_entry_attr_find( const Slapi_Entry *e, const char *type, Slapi_Attr **attr );
  213. int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr );
  214. int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr );
  215. const char *slapi_entry_get_uniqueid( const Slapi_Entry *e );
  216. void slapi_entry_set_uniqueid( Slapi_Entry *e, char *uniqueid );
  217. int slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e );
  218. int slapi_entry_rdn_values_present( const Slapi_Entry *e );
  219. int slapi_entry_add_rdn_values( Slapi_Entry *e );
  220. int slapi_entry_attr_delete( Slapi_Entry *e, const char *type );
  221. char **slapi_entry_attr_get_charray(const Slapi_Entry* e, const char *type);
  222. char *slapi_entry_attr_get_charptr(const Slapi_Entry* e, const char *type);
  223. int slapi_entry_attr_get_int(const Slapi_Entry* e, const char *type);
  224. unsigned int slapi_entry_attr_get_uint(const Slapi_Entry* e, const char *type);
  225. long slapi_entry_attr_get_long( const Slapi_Entry* e, const char *type);
  226. unsigned long slapi_entry_attr_get_ulong( const Slapi_Entry* e, const char *type);
  227. PRBool slapi_entry_attr_get_bool( const Slapi_Entry* e, const char *type);
  228. void slapi_entry_attr_set_charptr(Slapi_Entry* e, const char *type, const char *value);
  229. void slapi_entry_attr_set_int( Slapi_Entry* e, const char *type, int l);
  230. void slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigned int l);
  231. void slapi_entry_attr_set_long(Slapi_Entry* e, const char *type, long l);
  232. void slapi_entry_attr_set_ulong(Slapi_Entry* e, const char *type, unsigned long l);
  233. int slapi_entry_attr_has_syntax_value(const Slapi_Entry *e, const char *type, const Slapi_Value *value);
  234. int slapi_entry_has_children(const Slapi_Entry *e);
  235. int slapi_is_rootdse( const char *dn );
  236. size_t slapi_entry_size(Slapi_Entry *e);
  237. int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
  238. int slapi_entry_add_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
  239. int slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs);
  240. int slapi_entry_delete_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
  241. int slapi_entry_merge_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
  242. int slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
  243. int slapi_entry_add_value(Slapi_Entry *e, const char *type, const Slapi_Value *value);
  244. int slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *value);
  245. int slapi_entry_delete_string(Slapi_Entry *e, const char *type, const char *value);
  246. void slapi_entry_diff(Slapi_Mods *smods, Slapi_Entry *e1, Slapi_Entry *e2, int diff_ctrl);
  247. /*
  248. * Entry flags.
  249. */
  250. #define SLAPI_ENTRY_FLAG_TOMBSTONE 1
  251. int slapi_entry_flag_is_set( const Slapi_Entry *e, unsigned char flag );
  252. void slapi_entry_set_flag( Slapi_Entry *e, unsigned char flag);
  253. void slapi_entry_clear_flag( Slapi_Entry *e, unsigned char flag);
  254. /* exported vattrcache routines */
  255. int slapi_entry_vattrcache_watermark_isvalid(const Slapi_Entry *e);
  256. void slapi_entry_vattrcache_watermark_set(Slapi_Entry *e);
  257. void slapi_entry_vattrcache_watermark_invalidate(Slapi_Entry *e);
  258. void slapi_entrycache_vattrcache_watermark_invalidate();
  259. /*
  260. * Slapi_DN routines
  261. */
  262. Slapi_DN *slapi_sdn_new( void );
  263. Slapi_DN *slapi_sdn_new_dn_byval(const char *dn);
  264. Slapi_DN *slapi_sdn_new_ndn_byval(const char *ndn);
  265. Slapi_DN *slapi_sdn_new_dn_byref(const char *dn);
  266. Slapi_DN *slapi_sdn_new_ndn_byref(const char *ndn);
  267. Slapi_DN *slapi_sdn_new_dn_passin(const char *dn);
  268. Slapi_DN *slapi_sdn_set_dn_byval(Slapi_DN *sdn, const char *dn);
  269. Slapi_DN *slapi_sdn_set_dn_byref(Slapi_DN *sdn, const char *dn);
  270. Slapi_DN *slapi_sdn_set_dn_passin(Slapi_DN *sdn, const char *dn);
  271. Slapi_DN *slapi_sdn_set_ndn_byval(Slapi_DN *sdn, const char *ndn);
  272. Slapi_DN *slapi_sdn_set_ndn_byref(Slapi_DN *sdn, const char *ndn);
  273. void slapi_sdn_done(Slapi_DN *sdn);
  274. void slapi_sdn_free(Slapi_DN **sdn);
  275. const char * slapi_sdn_get_dn(const Slapi_DN *sdn);
  276. const char * slapi_sdn_get_ndn(const Slapi_DN *sdn);
  277. void slapi_sdn_get_parent(const Slapi_DN *sdn,Slapi_DN *sdn_parent);
  278. void slapi_sdn_get_backend_parent(const Slapi_DN *sdn,Slapi_DN *sdn_parent,const Slapi_Backend *backend);
  279. Slapi_DN * slapi_sdn_dup(const Slapi_DN *sdn);
  280. void slapi_sdn_copy(const Slapi_DN *from, Slapi_DN *to);
  281. int slapi_sdn_compare( const Slapi_DN *sdn1, const Slapi_DN *sdn2 );
  282. int slapi_sdn_isempty( const Slapi_DN *sdn);
  283. int slapi_sdn_issuffix(const Slapi_DN *sdn, const Slapi_DN *suffixsdn);
  284. int slapi_sdn_isparent( const Slapi_DN *parent, const Slapi_DN *child );
  285. int slapi_sdn_isgrandparent( const Slapi_DN *parent, const Slapi_DN *child );
  286. int slapi_sdn_get_ndn_len(const Slapi_DN *sdn);
  287. int slapi_sdn_scope_test( const Slapi_DN *dn, const Slapi_DN *base, int scope );
  288. void slapi_sdn_get_rdn(const Slapi_DN *sdn,Slapi_RDN *rdn);
  289. Slapi_DN *slapi_sdn_set_rdn(Slapi_DN *sdn, const Slapi_RDN *rdn);
  290. Slapi_DN *slapi_sdn_set_parent(Slapi_DN *sdn, const Slapi_DN *parentdn);
  291. int slapi_sdn_is_rdn_component(const Slapi_DN *rdn, const Slapi_Attr *a, const Slapi_Value *v);
  292. char * slapi_moddn_get_newdn(Slapi_DN *dn_olddn, char *newrdn, char *newsuperiordn);
  293. /*
  294. * Slapi_RDN functions
  295. */
  296. Slapi_RDN *slapi_rdn_new( void );
  297. Slapi_RDN *slapi_rdn_new_dn(const char *dn);
  298. Slapi_RDN *slapi_rdn_new_sdn(const Slapi_DN *sdn);
  299. Slapi_RDN *slapi_rdn_new_rdn(const Slapi_RDN *fromrdn);
  300. void slapi_rdn_init(Slapi_RDN *rdn);
  301. void slapi_rdn_init_dn(Slapi_RDN *rdn,const char *dn);
  302. void slapi_rdn_init_sdn(Slapi_RDN *rdn,const Slapi_DN *sdn);
  303. void slapi_rdn_init_rdn(Slapi_RDN *rdn,const Slapi_RDN *fromrdn);
  304. void slapi_rdn_set_dn(Slapi_RDN *rdn,const char *dn);
  305. void slapi_rdn_set_sdn(Slapi_RDN *rdn,const Slapi_DN *sdn);
  306. void slapi_rdn_set_rdn(Slapi_RDN *rdn,const Slapi_RDN *fromrdn);
  307. void slapi_rdn_free(Slapi_RDN **rdn);
  308. void slapi_rdn_done(Slapi_RDN *rdn);
  309. int slapi_rdn_get_first(Slapi_RDN *rdn, char **type, char **value);
  310. int slapi_rdn_get_next(Slapi_RDN *rdn, int index, char **type, char **value);
  311. int slapi_rdn_get_index(Slapi_RDN *rdn, const char *type, const char *value,size_t length);
  312. int slapi_rdn_get_index_attr(Slapi_RDN *rdn, const char *type, char **value);
  313. int slapi_rdn_contains(Slapi_RDN *rdn, const char *type, const char *value,size_t length);
  314. int slapi_rdn_contains_attr(Slapi_RDN *rdn, const char *type, char **value);
  315. int slapi_rdn_add(Slapi_RDN *rdn, const char *type, const char *value);
  316. int slapi_rdn_remove_index(Slapi_RDN *rdn, int atindex);
  317. int slapi_rdn_remove(Slapi_RDN *rdn, const char *type, const char *value, size_t length);
  318. int slapi_rdn_remove_attr(Slapi_RDN *rdn, const char *type);
  319. int slapi_rdn_isempty(const Slapi_RDN *rdn);
  320. int slapi_rdn_get_num_components(Slapi_RDN *rdn);
  321. int slapi_rdn_compare(Slapi_RDN *rdn1, Slapi_RDN *rdn2);
  322. const char *slapi_rdn_get_rdn(const Slapi_RDN *rdn);
  323. const char *slapi_rdn_get_nrdn(const Slapi_RDN *rdn);
  324. Slapi_DN *slapi_sdn_add_rdn(Slapi_DN *sdn, const Slapi_RDN *rdn);
  325. /*
  326. * utility routines for dealing with DNs
  327. */
  328. char *slapi_dn_normalize( char *dn );
  329. char *slapi_dn_normalize_to_end( char *dn, char *end );
  330. char *slapi_dn_ignore_case( char *dn );
  331. char *slapi_dn_normalize_case( char *dn );
  332. char *slapi_dn_beparent( Slapi_PBlock *pb, const char *dn );
  333. const char *slapi_dn_find_parent( const char *dn );
  334. char *slapi_dn_parent( const char *dn );
  335. int slapi_dn_issuffix( const char *dn, const char *suffix );
  336. int slapi_dn_isparent( const char *parentdn, const char *childdn );
  337. int slapi_dn_isroot( const char *dn );
  338. int slapi_dn_isbesuffix( Slapi_PBlock *pb, const char *dn );
  339. int slapi_rdn2typeval( char *rdn, char **type, struct berval *bv );
  340. char *slapi_dn_plus_rdn(const char *dn, const char *rdn);
  341. /*
  342. * thread safe random functions
  343. */
  344. int slapi_rand_r(unsigned int * seed);
  345. void slapi_rand_array(void *randx, size_t len);
  346. int slapi_rand();
  347. /*
  348. * attribute routines
  349. */
  350. Slapi_Attr *slapi_attr_new( void );
  351. Slapi_Attr *slapi_attr_init(Slapi_Attr *a, const char *type);
  352. void slapi_attr_free( Slapi_Attr **a );
  353. Slapi_Attr *slapi_attr_dup(const Slapi_Attr *attr);
  354. int slapi_attr_add_value(Slapi_Attr *a, const Slapi_Value *v);
  355. int slapi_attr_type2plugin( const char *type, void **pi );
  356. int slapi_attr_get_type( Slapi_Attr *attr, char **type );
  357. int slapi_attr_get_oid_copy( const Slapi_Attr *attr, char **oidp );
  358. int slapi_attr_get_syntax_oid_copy( const Slapi_Attr *a, char **oidp );
  359. int slapi_attr_get_flags( const Slapi_Attr *attr, unsigned long *flags );
  360. int slapi_attr_flag_is_set( const Slapi_Attr *attr, unsigned long flag );
  361. int slapi_attr_value_cmp( const Slapi_Attr *attr, const struct berval *v1, const struct berval *v2 );
  362. int slapi_attr_value_find( const Slapi_Attr *a, const struct berval *v );
  363. int slapi_attr_type_cmp( const char *t1, const char *t2, int opt );
  364. /* Mode of operation (opt) values for slapi_attr_type_cmp() */
  365. #define SLAPI_TYPE_CMP_EXACT 0
  366. #define SLAPI_TYPE_CMP_BASE 1
  367. #define SLAPI_TYPE_CMP_SUBTYPE 2
  368. int slapi_attr_types_equivalent(const char *t1, const char *t2);
  369. char *slapi_attr_basetype( const char *type, char *buf, size_t bufsiz );
  370. int slapi_attr_first_value( Slapi_Attr *a, Slapi_Value **v );
  371. int slapi_attr_next_value( Slapi_Attr *a, int hint, Slapi_Value **v );
  372. int slapi_attr_get_numvalues( const Slapi_Attr *a, int *numValues);
  373. int slapi_attr_get_valueset(const Slapi_Attr *a, Slapi_ValueSet **vs);
  374. /* Make the valuset in Slapi_Attr be *vs--not a copy */
  375. int slapi_attr_set_valueset(Slapi_Attr *a, const Slapi_ValueSet *vs);
  376. int slapi_attr_set_type(Slapi_Attr *a, const char *type);
  377. int slapi_attr_get_bervals_copy( Slapi_Attr *a, struct berval ***vals );
  378. char * slapi_attr_syntax_normalize( const char *s );
  379. void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2);
  380. void slapi_valueset_set_from_smod(Slapi_ValueSet *vs, Slapi_Mod *smod);
  381. /*
  382. * value routines
  383. */
  384. Slapi_Value *slapi_value_new( void );
  385. Slapi_Value *slapi_value_new_berval(const struct berval *bval);
  386. Slapi_Value *slapi_value_new_value(const Slapi_Value *v);
  387. Slapi_Value *slapi_value_new_string(const char *s);
  388. Slapi_Value *slapi_value_new_string_passin(char *s);
  389. Slapi_Value *slapi_value_init(Slapi_Value *v);
  390. Slapi_Value *slapi_value_init_berval(Slapi_Value *v, struct berval *bval);
  391. Slapi_Value *slapi_value_init_string(Slapi_Value *v,const char *s);
  392. Slapi_Value *slapi_value_init_string_passin(Slapi_Value *v, char *s);
  393. Slapi_Value *slapi_value_dup(const Slapi_Value *v);
  394. void slapi_value_set_flags(Slapi_Value *v, unsigned long flags);
  395. void slapi_values_set_flags(Slapi_Value **vs, unsigned long flags);
  396. unsigned long slapi_value_get_flags(Slapi_Value *v);
  397. void slapi_value_free(Slapi_Value **value);
  398. const struct berval *slapi_value_get_berval( const Slapi_Value *value );
  399. Slapi_Value *slapi_value_set_berval( Slapi_Value *value, const struct berval *bval );
  400. Slapi_Value *slapi_value_set_value( Slapi_Value *value, const Slapi_Value *vfrom);
  401. Slapi_Value *slapi_value_set( Slapi_Value *value, void *val, unsigned long len);
  402. int slapi_value_set_string(Slapi_Value *value, const char *strVal);
  403. int slapi_value_set_string_passin(Slapi_Value *value, char *strVal);
  404. int slapi_value_set_int(Slapi_Value *value, int intVal);
  405. const char*slapi_value_get_string(const Slapi_Value *value);
  406. int slapi_value_get_int(const Slapi_Value *value);
  407. unsigned int slapi_value_get_uint(const Slapi_Value *value);
  408. long slapi_value_get_long(const Slapi_Value *value);
  409. unsigned long slapi_value_get_ulong(const Slapi_Value *value);
  410. size_t slapi_value_get_length(const Slapi_Value *value);
  411. int slapi_value_compare(const Slapi_Attr *a,const Slapi_Value *v1,const Slapi_Value *v2);
  412. /*
  413. * Valueset functions.
  414. */
  415. #define SLAPI_VALUE_FLAG_PASSIN 0x1
  416. #define SLAPI_VALUE_FLAG_IGNOREERROR 0x2
  417. #define SLAPI_VALUE_FLAG_PRESERVECSNSET 0x4
  418. Slapi_ValueSet *slapi_valueset_new( void );
  419. void slapi_valueset_free(Slapi_ValueSet *vs);
  420. void slapi_valueset_init(Slapi_ValueSet *vs);
  421. void slapi_valueset_done(Slapi_ValueSet *vs);
  422. void slapi_valueset_add_value(Slapi_ValueSet *vs, const Slapi_Value *addval);
  423. void slapi_valueset_add_value_ext(Slapi_ValueSet *vs, Slapi_Value *addval, unsigned long flags);
  424. int slapi_valueset_first_value( Slapi_ValueSet *vs, Slapi_Value **v );
  425. int slapi_valueset_next_value( Slapi_ValueSet *vs, int index, Slapi_Value **v);
  426. int slapi_valueset_count( const Slapi_ValueSet *vs);
  427. void slapi_valueset_set_from_smod(Slapi_ValueSet *vs, Slapi_Mod *smod);
  428. void slapi_valueset_set_valueset(Slapi_ValueSet *vs1, const Slapi_ValueSet *vs2);
  429. Slapi_Value *slapi_valueset_find(const Slapi_Attr *a, const Slapi_ValueSet *vs, const Slapi_Value *v);
  430. /*
  431. * operation routines
  432. */
  433. int slapi_op_abandoned( Slapi_PBlock *pb );
  434. unsigned long slapi_op_get_type(Slapi_Operation * op);
  435. void slapi_operation_set_flag(Slapi_Operation *op, unsigned long flag);
  436. void slapi_operation_clear_flag(Slapi_Operation *op, unsigned long flag);
  437. int slapi_operation_is_flag_set(Slapi_Operation *op, unsigned long flag);
  438. int slapi_op_reserved(Slapi_PBlock *pb);
  439. void slapi_operation_set_csngen_handler ( Slapi_Operation *op, void *callback );
  440. void slapi_operation_set_replica_attr_handler ( Slapi_Operation *op, void *callback );
  441. int slapi_operation_get_replica_attr ( Slapi_PBlock *pb, Slapi_Operation *op, const char *type, void *value );
  442. char *slapi_op_type_to_string(unsigned long type);
  443. /*
  444. * LDAPMod manipulation routines
  445. */
  446. Slapi_Mods* slapi_mods_new( void );
  447. void slapi_mods_init(Slapi_Mods *smods, int initCount);
  448. void slapi_mods_init_byref(Slapi_Mods *smods, LDAPMod **mods);
  449. void slapi_mods_init_passin(Slapi_Mods *smods, LDAPMod **mods);
  450. void slapi_mods_free(Slapi_Mods **smods);
  451. void slapi_mods_done(Slapi_Mods *smods);
  452. void slapi_mods_insert_at(Slapi_Mods *smods, LDAPMod *mod, int pos);
  453. void slapi_mods_insert_smod_at(Slapi_Mods *smods, Slapi_Mod *smod, int pos);
  454. void slapi_mods_insert_before(Slapi_Mods *smods, LDAPMod *mod);
  455. void slapi_mods_insert_smod_before(Slapi_Mods *smods, Slapi_Mod *smod);
  456. void slapi_mods_insert_after(Slapi_Mods *smods, LDAPMod *mod);
  457. void slapi_mods_insert_after(Slapi_Mods *smods, LDAPMod *mod);
  458. void slapi_mods_add( Slapi_Mods *smods, int modtype, const char *type, unsigned long len, const char *val);
  459. void slapi_mods_add_ldapmod(Slapi_Mods *smods, LDAPMod *mod);
  460. void slapi_mods_add_modbvps( Slapi_Mods *smods, int modtype, const char *type, struct berval **bvps );
  461. void slapi_mods_add_mod_values( Slapi_Mods *smods, int modtype, const char *type, Slapi_Value **va );
  462. void slapi_mods_add_smod(Slapi_Mods *smods, Slapi_Mod *smod);
  463. void slapi_mods_add_string( Slapi_Mods *smods, int modtype, const char *type, const char *val);
  464. void slapi_mods_remove(Slapi_Mods *smods);
  465. LDAPMod *slapi_mods_get_first_mod(Slapi_Mods *smods);
  466. LDAPMod *slapi_mods_get_next_mod(Slapi_Mods *smods);
  467. Slapi_Mod *slapi_mods_get_first_smod(Slapi_Mods *smods, Slapi_Mod *smod);
  468. Slapi_Mod *slapi_mods_get_next_smod(Slapi_Mods *smods, Slapi_Mod *smod);
  469. void slapi_mods_iterator_backone(Slapi_Mods *smods);
  470. LDAPMod **slapi_mods_get_ldapmods_byref(Slapi_Mods *smods);
  471. LDAPMod **slapi_mods_get_ldapmods_passout(Slapi_Mods *smods);
  472. int slapi_mods_get_num_mods(const Slapi_Mods *smods);
  473. void slapi_mods_dump(const Slapi_Mods *smods, const char *text);
  474. Slapi_Mod* slapi_mod_new( void );
  475. void slapi_mod_init(Slapi_Mod *smod, int initCount);
  476. void slapi_mod_init_byval(Slapi_Mod *smod, const LDAPMod *mod);
  477. void slapi_mod_init_byref(Slapi_Mod *smod, LDAPMod *mod);
  478. void slapi_mod_init_passin(Slapi_Mod *smod, LDAPMod *mod);
  479. void slapi_mod_add_value(Slapi_Mod *smod, const struct berval *val);
  480. void slapi_mod_remove_value(Slapi_Mod *smod);
  481. struct berval *slapi_mod_get_first_value(Slapi_Mod *smod);
  482. struct berval *slapi_mod_get_next_value(Slapi_Mod *smod);
  483. const char *slapi_mod_get_type(const Slapi_Mod *smod);
  484. int slapi_mod_get_operation(const Slapi_Mod *smod);
  485. void slapi_mod_set_type(Slapi_Mod *smod, const char *type);
  486. void slapi_mod_set_operation(Slapi_Mod *smod, int op);
  487. int slapi_mod_get_num_values(const Slapi_Mod *smod);
  488. const LDAPMod *slapi_mod_get_ldapmod_byref(const Slapi_Mod *smod);
  489. LDAPMod *slapi_mod_get_ldapmod_passout(Slapi_Mod *smod);
  490. void slapi_mod_free(Slapi_Mod **smod);
  491. void slapi_mod_done(Slapi_Mod *mod);
  492. int slapi_mod_isvalid(const Slapi_Mod *mod);
  493. void slapi_mod_dump(LDAPMod *mod, int n);
  494. /* helper functions to translate between entry and a set of mods */
  495. int slapi_mods2entry(Slapi_Entry **e, const char *dn, LDAPMod **attrs);
  496. int slapi_entry2mods(const Slapi_Entry *e, char **dn, LDAPMod ***attrs);
  497. /*
  498. * routines for dealing with filters
  499. */
  500. int slapi_filter_get_choice( Slapi_Filter *f );
  501. int slapi_filter_get_ava( Slapi_Filter *f, char **type, struct berval **bval );
  502. int slapi_filter_get_attribute_type( Slapi_Filter *f, char **type );
  503. int slapi_filter_get_subfilt( Slapi_Filter *f, char **type, char **initial,
  504. char ***any, char **final );
  505. Slapi_Filter *slapi_filter_list_first( Slapi_Filter *f );
  506. Slapi_Filter *slapi_filter_list_next( Slapi_Filter *f, Slapi_Filter *fprev );
  507. Slapi_Filter *slapi_str2filter( char *str );
  508. Slapi_Filter *slapi_filter_join( int ftype, Slapi_Filter *f1,
  509. Slapi_Filter *f2 );
  510. Slapi_Filter *slapi_filter_join_ex( int ftype, Slapi_Filter *f1,
  511. Slapi_Filter *f2, int recurse_always );
  512. void slapi_filter_free( Slapi_Filter *f, int recurse );
  513. int slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
  514. int verify_access );
  515. int slapi_vattr_filter_test( Slapi_PBlock *pb, Slapi_Entry *e,
  516. struct slapi_filter *f, int verify_access);
  517. int slapi_filter_test_simple( Slapi_Entry *e, Slapi_Filter *f);
  518. char *slapi_find_matching_paren( const char *str );
  519. int slapi_filter_test_ext( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
  520. int verify_access , int only_test_access);
  521. int slapi_vattr_filter_test_ext( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f,
  522. int verify_access , int only_test_access);
  523. int slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2);
  524. Slapi_Filter *slapi_filter_dup(Slapi_Filter *f);
  525. int slapi_filter_changetype(Slapi_Filter *f, const char *newtype);
  526. /*
  527. * slapi_filter_apply() is used to apply a function to each simple filter
  528. * component within a complex filter. A 'simple filter' is anything other
  529. * than AND, OR or NOT.
  530. */
  531. typedef int (*FILTER_APPLY_FN)( Slapi_Filter *f, void *arg);
  532. int slapi_filter_apply( struct slapi_filter *f, FILTER_APPLY_FN fn, void *arg,
  533. int *error_code );
  534. /*
  535. * Possible return values for slapi_filter_apply() and FILTER_APPLY_FNs.
  536. * Note that a FILTER_APPLY_FN should return _STOP or _CONTINUE only.
  537. */
  538. #define SLAPI_FILTER_SCAN_STOP -1 /* premature abort */
  539. #define SLAPI_FILTER_SCAN_ERROR -2 /* an error occurred */
  540. #define SLAPI_FILTER_SCAN_NOMORE 0 /* success */
  541. #define SLAPI_FILTER_SCAN_CONTINUE 1 /* continue scanning */
  542. /* Error codes that slapi_filter_apply() may set in *error_code */
  543. #define SLAPI_FILTER_UNKNOWN_FILTER_TYPE 2
  544. /*
  545. * Bit-Twiddlers
  546. */
  547. unsigned char slapi_setbit_uchar(unsigned char f,unsigned char bitnum);
  548. unsigned char slapi_unsetbit_uchar(unsigned char f,unsigned char bitnum);
  549. int slapi_isbitset_uchar(unsigned char f,unsigned char bitnum);
  550. unsigned int slapi_setbit_int(unsigned int f,unsigned int bitnum);
  551. unsigned int slapi_unsetbit_int(unsigned int f,unsigned int bitnum);
  552. int slapi_isbitset_int(unsigned int f,unsigned int bitnum);
  553. /*
  554. * routines for sending entries and results to the client
  555. */
  556. int slapi_send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e,
  557. LDAPControl **ectrls, char **attrs, int attrsonly );
  558. void slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched,
  559. char *text, int nentries, struct berval **urls );
  560. int slapi_send_ldap_referral( Slapi_PBlock *pb, Slapi_Entry *e,
  561. struct berval **refs, struct berval ***urls );
  562. typedef int (*send_ldap_search_entry_fn_ptr_t)( Slapi_PBlock *pb,
  563. Slapi_Entry *e, LDAPControl **ectrls, char **attrs, int attrsonly );
  564. typedef void (*send_ldap_result_fn_ptr_t)( Slapi_PBlock *pb, int err,
  565. char *matched, char *text, int nentries, struct berval **urls );
  566. typedef int (*send_ldap_referral_fn_ptr_t)( Slapi_PBlock *pb,
  567. Slapi_Entry *e, struct berval **refs, struct berval ***urls );
  568. /*
  569. * matching rule
  570. */
  571. typedef int (*mrFilterMatchFn) (void* filter, Slapi_Entry*, Slapi_Attr* vals);
  572. /* returns: 0 filter matched
  573. * -1 filter did not match
  574. * >0 an LDAP error code
  575. */
  576. int slapi_mr_indexer_create(Slapi_PBlock* opb);
  577. int slapi_mr_filter_index(Slapi_Filter* f, Slapi_PBlock* pb);
  578. int slapi_berval_cmp(const struct berval* L, const struct berval* R);
  579. #define SLAPI_BERVAL_EQ(L,R) ((L)->bv_len == (R)->bv_len && \
  580. ! memcmp ((L)->bv_val, (R)->bv_val, (L)->bv_len))
  581. typedef struct slapi_matchingRuleEntry {
  582. char *mr_oid;
  583. char *mr_oidalias;
  584. char *mr_name;
  585. char *mr_desc;
  586. char *mr_syntax;
  587. int mr_obsolete;
  588. } slapi_matchingRuleEntry;
  589. typedef struct slapi_matchingRuleEntry Slapi_MatchingRuleEntry;
  590. Slapi_MatchingRuleEntry *slapi_matchingrule_new(void);
  591. void slapi_matchingrule_free(Slapi_MatchingRuleEntry **mrEntry,
  592. int freeMembers);
  593. int slapi_matchingrule_get(Slapi_MatchingRuleEntry *mr, int arg, void *value);
  594. int slapi_matchingrule_set(Slapi_MatchingRuleEntry *mr, int arg, void *value);
  595. int slapi_matchingrule_register(Slapi_MatchingRuleEntry *mrEntry);
  596. int slapi_matchingrule_unregister(char *oid);
  597. int slapi_matchingrule_is_ordering(const char *oid_or_name, const char *syntax_oid);
  598. /*
  599. * access control
  600. */
  601. int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e, char *attr,
  602. struct berval *val, int access );
  603. int slapi_acl_check_mods( Slapi_PBlock *pb, Slapi_Entry *e,
  604. LDAPMod **mods, char **errbuf );
  605. int slapi_acl_verify_aci_syntax(Slapi_PBlock *pb, Slapi_Entry *e, char **errbuf);
  606. /*
  607. * attribute stuff
  608. */
  609. int slapi_value_find( void *plugin, struct berval **vals, struct berval *v );
  610. /*
  611. * password handling
  612. */
  613. #define SLAPI_USERPWD_ATTR "userpassword"
  614. int slapi_pw_find_sv( Slapi_Value **vals, const Slapi_Value *v );
  615. /* value encoding encoding */
  616. /* checks if the value is encoded with any known algorithm*/
  617. int slapi_is_encoded(char *value);
  618. /* encode value with the specified algorithm */
  619. char* slapi_encode(char *value, char *alg);
  620. /* UTF8 related */
  621. int slapi_has8thBit(unsigned char *s);
  622. unsigned char *slapi_utf8StrToLower(unsigned char *s);
  623. void slapi_utf8ToLower(unsigned char *s, unsigned char *d, int *ssz, int *dsz);
  624. int slapi_utf8isUpper(unsigned char *s);
  625. unsigned char *slapi_utf8StrToUpper(unsigned char *s);
  626. void slapi_utf8ToUpper(unsigned char *s, unsigned char *d, int *ssz, int *dsz);
  627. int slapi_utf8isLower(unsigned char *s);
  628. int slapi_utf8casecmp(unsigned char *s0, unsigned char *s1);
  629. int slapi_utf8ncasecmp(unsigned char *s0, unsigned char *s1, int n);
  630. unsigned char *slapi_UTF8STRTOLOWER(char *s);
  631. void slapi_UTF8TOLOWER(char *s, char *d, int *ssz, int *dsz);
  632. int slapi_UTF8ISUPPER(char *s);
  633. unsigned char *slapi_UTF8STRTOUPPER(char *s);
  634. void slapi_UTF8TOUPPER(char *s, char *d, int *ssz, int *dsz);
  635. int slapi_UTF8ISLOWER(char *s);
  636. int slapi_UTF8CASECMP(char *s0, char *s1);
  637. int slapi_UTF8NCASECMP(char *s0, char *s1, int n);
  638. /*
  639. * Interface to the API broker service
  640. *
  641. * The API broker allows plugins to publish an API that may be discovered
  642. * and used dynamically at run time by other subsystems e.g. other plugins.
  643. */
  644. /* Function: slapi_apib_register
  645. Description: this function allows publication of an interface
  646. Parameters: guid - a string constant that uniquely identifies the
  647. interface (must exist for the life of the server)
  648. api - a vtable for the published api (must exist for the
  649. life of the server or until the reference count,
  650. if it exists, reaches zero)
  651. Return: 0 if function succeeds
  652. non-zero otherwise
  653. */
  654. int slapi_apib_register(char *guid, void **api); /* publish an interface */
  655. /* Function: slapi_apib_unregister
  656. Description: this function allows removal of a published interface
  657. Parameters: guid - a string constant that uniquely identifies the interface
  658. Return: 0 if function succeeds
  659. non-zero otherwise
  660. */
  661. int slapi_apib_unregister(char *guid); /* remove interface from published list */
  662. /* Function: slapi_apib_get_interface
  663. Description: this function allows retrieval of a published interface,
  664. if the api reference counted, then the reference
  665. count is incremented
  666. Parameters: guid - a string constant that uniquely identifies the
  667. interface requested
  668. api - the retrieved vtable for the published api (must NOT
  669. be freed)
  670. Return: 0 if function succeeds
  671. non-zero otherwise
  672. */
  673. int slapi_apib_get_interface(char *guid, void ***api); /* retrieve an interface for use */
  674. /* Function: slapi_apib_make_reference_counted
  675. Description: this function makes an interface a reference counted interface
  676. it must be called prior to registering the interface
  677. Parameters: api - the api to make a reference counted api
  678. callback - if non-zero, this must be a pointer to a function
  679. which the api broker will call when the ref count for
  680. the api reaches zero. This function must return 0 if
  681. it deregisters the api, non-zero otherwise
  682. api - the retrieved vtable for the published api (must NOT
  683. be freed)
  684. Return: 0 if function succeeds
  685. non-zero otherwise
  686. */
  687. typedef int (*slapi_apib_callback_on_zero)(void **api);
  688. int slapi_apib_make_reference_counted(void **api,
  689. slapi_apib_callback_on_zero callback);
  690. /* Function: slapi_apib_addref
  691. Description: this function adds to the reference count of an api - a
  692. call to this function should be paired with a call
  693. to slapi_apib_release
  694. - ONLY FOR REFERENCE COUNTED APIS
  695. Parameters: api - the api to add a reference to
  696. Return: the new reference count
  697. */
  698. int slapi_apib_addref(void **api);
  699. /* Function: slapi_apib_release
  700. Description: this function adds to the reference count of an api - a
  701. call to this function should be paired with a prior call
  702. to slapi_apib_addref or slapi_apib_get_interface
  703. - ONLY FOR REFERENCE COUNTED APIS
  704. Parameters: api - the api to add a reference to
  705. Return: the new reference count
  706. */
  707. int slapi_apib_release(void **api);
  708. /**** End of API broker interface. *******************************************/
  709. /*
  710. * routines for dealing with controls
  711. */
  712. int slapi_control_present( LDAPControl **controls, char *oid,
  713. struct berval **val, int *iscritical );
  714. void slapi_register_supported_control( char *controloid,
  715. unsigned long controlops );
  716. LDAPControl * slapi_dup_control( LDAPControl *ctrl );
  717. #define SLAPI_OPERATION_BIND 0x00000001UL
  718. #define SLAPI_OPERATION_UNBIND 0x00000002UL
  719. #define SLAPI_OPERATION_SEARCH 0x00000004UL
  720. #define SLAPI_OPERATION_MODIFY 0x00000008UL
  721. #define SLAPI_OPERATION_ADD 0x00000010UL
  722. #define SLAPI_OPERATION_DELETE 0x00000020UL
  723. #define SLAPI_OPERATION_MODDN 0x00000040UL
  724. #define SLAPI_OPERATION_MODRDN SLAPI_OPERATION_MODDN
  725. #define SLAPI_OPERATION_COMPARE 0x00000080UL
  726. #define SLAPI_OPERATION_ABANDON 0x00000100UL
  727. #define SLAPI_OPERATION_EXTENDED 0x00000200UL
  728. #define SLAPI_OPERATION_ANY 0xFFFFFFFFUL
  729. #define SLAPI_OPERATION_NONE 0x00000000UL
  730. int slapi_get_supported_controls_copy( char ***ctrloidsp,
  731. unsigned long **ctrlopsp );
  732. int slapi_build_control( char *oid, BerElement *ber,
  733. char iscritical, LDAPControl **ctrlp );
  734. int slapi_build_control_from_berval( char *oid, struct berval *bvp,
  735. char iscritical, LDAPControl **ctrlp );
  736. /*
  737. * routines for dealing with extended operations
  738. */
  739. char **slapi_get_supported_extended_ops_copy( void );
  740. /*
  741. * bind, including SASL
  742. */
  743. void slapi_register_supported_saslmechanism( char *mechanism );
  744. char ** slapi_get_supported_saslmechanisms_copy( void );
  745. void slapi_add_auth_response_control( Slapi_PBlock *pb, const char *binddn );
  746. int slapi_add_pwd_control( Slapi_PBlock *pb, char *arg, long time );
  747. int slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins, int error);
  748. /* Password Policy Response Control stuff - the error argument above */
  749. #define LDAP_PWPOLICY_PWDEXPIRED 0
  750. #define LDAP_PWPOLICY_ACCTLOCKED 1
  751. #define LDAP_PWPOLICY_CHGAFTERRESET 2
  752. #define LDAP_PWPOLICY_PWDMODNOTALLOWED 3
  753. #define LDAP_PWPOLICY_MUSTSUPPLYOLDPWD 4
  754. #define LDAP_PWPOLICY_INVALIDPWDSYNTAX 5
  755. #define LDAP_PWPOLICY_PWDTOOSHORT 6
  756. #define LDAP_PWPOLICY_PWDTOOYOUNG 7
  757. #define LDAP_PWPOLICY_PWDINHISTORY 8
  758. /*
  759. * routine for freeing the ch_arrays returned by the slapi_get*_copy functions above
  760. */
  761. void slapi_ch_array_free( char **array );
  762. /*
  763. * checking routines for allocating and freeing memory
  764. */
  765. char * slapi_ch_malloc( unsigned long size );
  766. char * slapi_ch_realloc( char *block, unsigned long size );
  767. char * slapi_ch_calloc( unsigned long nelem, unsigned long size );
  768. char * slapi_ch_strdup( const char *s );
  769. void slapi_ch_free( void **ptr );
  770. void slapi_ch_free_string( char **s );
  771. struct berval* slapi_ch_bvdup(const struct berval*);
  772. struct berval** slapi_ch_bvecdup(struct berval**);
  773. void slapi_ch_bvfree(struct berval** v);
  774. char * slapi_ch_smprintf(const char *fmt, ...)
  775. #ifdef __GNUC__
  776. __attribute__ ((format (printf, 1, 2)));
  777. #else
  778. ;
  779. #endif
  780. /*
  781. * syntax plugin routines
  782. */
  783. int slapi_call_syntax_values2keys_sv( void *vpi, Slapi_Value **vals,
  784. Slapi_Value ***ivals, int ftype );
  785. int slapi_call_syntax_assertion2keys_ava_sv( void *vpi, Slapi_Value *val,
  786. Slapi_Value ***ivals, int ftype );
  787. int slapi_call_syntax_assertion2keys_sub_sv( void *vpi, char *initial,
  788. char **any, char *final, Slapi_Value ***ivals );
  789. /*
  790. * internal operation and plugin callback routines
  791. */
  792. typedef void (*plugin_result_callback)(int rc, void *callback_data);
  793. typedef int (*plugin_referral_entry_callback)(char * referral,
  794. void *callback_data);
  795. typedef int (*plugin_search_entry_callback)(Slapi_Entry *e,
  796. void *callback_data);
  797. void slapi_free_search_results_internal(Slapi_PBlock *pb);
  798. /*
  799. * The following functions can be used for internal operations based on DN
  800. * as well as on uniqueid. These functions should be used by all new plugins
  801. * and preferrably old plugins should be changed to use them to take
  802. * advantage of new plugin configuration capabilities and to use an
  803. * extensible interface.
  804. *
  805. * These functions return -1 if pb is NULL and 0 otherwise.
  806. * The SLAPI_PLUGIN_INTOP_RESULT pblock parameter should be checked to
  807. * check if the operation was successful.
  808. *
  809. * Helper functions are provided to set up pblock parameters currently used
  810. * by the functions, e.g., slapi_search_internal_set_pb().
  811. * Additional parameters may be set directly in the pblock.
  812. */
  813. int slapi_search_internal_pb(Slapi_PBlock *pb);
  814. int slapi_search_internal_callback_pb(Slapi_PBlock *pb, void *callback_data,
  815. plugin_result_callback prc, plugin_search_entry_callback psec,
  816. plugin_referral_entry_callback prec);
  817. int slapi_add_internal_pb(Slapi_PBlock *pb);
  818. int slapi_modify_internal_pb(Slapi_PBlock *pb);
  819. int slapi_modrdn_internal_pb(Slapi_PBlock *pb);
  820. int slapi_delete_internal_pb(Slapi_PBlock *pb);
  821. int slapi_seq_internal_callback_pb(Slapi_PBlock *pb, void *callback_data,
  822. plugin_result_callback res_callback,
  823. plugin_search_entry_callback srch_callback,
  824. plugin_referral_entry_callback ref_callback);
  825. void slapi_search_internal_set_pb(Slapi_PBlock *pb, const char *base,
  826. int scope, const char *filter, char **attrs, int attrsonly,
  827. LDAPControl **controls, const char *uniqueid,
  828. Slapi_ComponentId *plugin_identity, int operation_flags);
  829. void slapi_add_entry_internal_set_pb(Slapi_PBlock *pb, Slapi_Entry *e,
  830. LDAPControl **controls, Slapi_ComponentId *plugin_identity,
  831. int operation_flags);
  832. int slapi_add_internal_set_pb(Slapi_PBlock *pb, const char *dn,
  833. LDAPMod **attrs, LDAPControl **controls,
  834. Slapi_ComponentId *plugin_identity, int operation_flags);
  835. void slapi_modify_internal_set_pb(Slapi_PBlock *pb, const char *dn,
  836. LDAPMod **mods, LDAPControl **controls, const char *uniqueid,
  837. Slapi_ComponentId *plugin_identity, int operation_flags);
  838. void slapi_rename_internal_set_pb(Slapi_PBlock *pb, const char *olddn,
  839. const char *newrdn, const char *newsuperior, int deloldrdn,
  840. LDAPControl **controls, const char *uniqueid,
  841. Slapi_ComponentId *plugin_identity, int operation_flags);
  842. void slapi_delete_internal_set_pb(Slapi_PBlock *pb, const char *dn,
  843. LDAPControl **controls, const char *uniqueid,
  844. Slapi_ComponentId *plugin_identity, int operation_flags);
  845. void slapi_seq_internal_set_pb(Slapi_PBlock *pb, char *ibase, int type,
  846. char *attrname, char *val, char **attrs, int attrsonly,
  847. LDAPControl **controls, Slapi_ComponentId *plugin_identity,
  848. int operation_flags);
  849. /*
  850. * slapi_search_internal_get_entry() finds an entry given a dn. It returns
  851. * an LDAP error code (LDAP_SUCCESS if all goes well).
  852. */
  853. int slapi_search_internal_get_entry( Slapi_DN *dn, char ** attrlist,
  854. Slapi_Entry **ret_entry , void *caller_identity);
  855. /*
  856. * interface for registering object extensions.
  857. */
  858. typedef void *(*slapi_extension_constructor_fnptr)(void *object, void *parent);
  859. typedef void (*slapi_extension_destructor_fnptr)(void *extension,
  860. void *object, void *parent);
  861. int slapi_register_object_extension( const char *pluginname,
  862. const char *objectname, slapi_extension_constructor_fnptr constructor,
  863. slapi_extension_destructor_fnptr destructor, int *objecttype,
  864. int *extensionhandle);
  865. /* objects that can be extended (possible values for the objectname param.) */
  866. #define SLAPI_EXT_CONNECTION "Connection"
  867. #define SLAPI_EXT_OPERATION "Operation"
  868. #define SLAPI_EXT_ENTRY "Entry"
  869. #define SLAPI_EXT_MTNODE "Mapping Tree Node"
  870. void *slapi_get_object_extension(int objecttype, void *object,
  871. int extensionhandle);
  872. void slapi_set_object_extension(int objecttype, void *object,
  873. int extensionhandle, void *extension);
  874. /*
  875. * interface to allow a plugin to register additional plugins.
  876. */
  877. typedef int (*slapi_plugin_init_fnptr)( Slapi_PBlock *pb );
  878. int slapi_register_plugin( const char *plugintype, int enabled,
  879. const char *initsymbol, slapi_plugin_init_fnptr initfunc,
  880. const char *name, char **argv, void *group_identity);
  881. /*
  882. * logging
  883. */
  884. int slapi_log_error( int severity, char *subsystem, char *fmt, ... );
  885. /* allowed values for the "severity" parameter */
  886. #define SLAPI_LOG_FATAL 0
  887. #define SLAPI_LOG_TRACE 1
  888. #define SLAPI_LOG_PACKETS 2
  889. #define SLAPI_LOG_ARGS 3
  890. #define SLAPI_LOG_CONNS 4
  891. #define SLAPI_LOG_BER 5
  892. #define SLAPI_LOG_FILTER 6
  893. #define SLAPI_LOG_CONFIG 7
  894. #define SLAPI_LOG_ACL 8
  895. #define SLAPI_LOG_SHELL 9
  896. #define SLAPI_LOG_PARSE 10
  897. #define SLAPI_LOG_HOUSE 11
  898. #define SLAPI_LOG_REPL 12
  899. #define SLAPI_LOG_CACHE 13
  900. #define SLAPI_LOG_PLUGIN 14
  901. #define SLAPI_LOG_TIMING 15
  902. #define SLAPI_LOG_ACLSUMMARY 16
  903. int slapi_is_loglevel_set( const int loglevel );
  904. /*
  905. * locks and synchronization
  906. */
  907. typedef struct slapi_mutex Slapi_Mutex;
  908. typedef struct slapi_condvar Slapi_CondVar;
  909. Slapi_Mutex *slapi_new_mutex( void );
  910. void slapi_destroy_mutex( Slapi_Mutex *mutex );
  911. void slapi_lock_mutex( Slapi_Mutex *mutex );
  912. int slapi_unlock_mutex( Slapi_Mutex *mutex );
  913. Slapi_CondVar *slapi_new_condvar( Slapi_Mutex *mutex );
  914. void slapi_destroy_condvar( Slapi_CondVar *cvar );
  915. int slapi_wait_condvar( Slapi_CondVar *cvar, struct timeval *timeout );
  916. int slapi_notify_condvar( Slapi_CondVar *cvar, int notify_all );
  917. /*
  918. * thread-safe LDAP connections
  919. */
  920. LDAP *slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared );
  921. void slapi_ldap_unbind( LDAP *ld );
  922. /*
  923. * computed attributes
  924. */
  925. struct _computed_attr_context;
  926. typedef struct _computed_attr_context computed_attr_context;
  927. typedef int (*slapi_compute_output_t)(computed_attr_context *c,Slapi_Attr *a , Slapi_Entry *e);
  928. typedef int (*slapi_compute_callback_t)(computed_attr_context *c,char* type,Slapi_Entry *e,slapi_compute_output_t outputfn);
  929. typedef int (*slapi_search_rewrite_callback_t)(Slapi_PBlock *pb);
  930. int slapi_compute_add_evaluator(slapi_compute_callback_t function);
  931. int slapi_compute_add_search_rewriter(slapi_search_rewrite_callback_t function);
  932. int compute_rewrite_search_filter(Slapi_PBlock *pb);
  933. /*
  934. * routines for dealing with backends
  935. */
  936. Slapi_Backend *slapi_be_new( const char *type, const char *name,
  937. int isprivate, int logchanges );
  938. void slapi_be_free(Slapi_Backend **be);
  939. Slapi_Backend *slapi_be_select( const Slapi_DN *sdn );
  940. Slapi_Backend *slapi_be_select_by_instance_name( const char *name );
  941. int slapi_be_exist(const Slapi_DN *sdn);
  942. void slapi_be_delete_onexit(Slapi_Backend *be);
  943. void slapi_be_set_readonly(Slapi_Backend *be, int readonly);
  944. int slapi_be_get_readonly(Slapi_Backend *be);
  945. int slapi_be_getentrypoint(Slapi_Backend *be, int entrypoint, void **ret_fnptr,
  946. Slapi_PBlock *pb);
  947. int slapi_be_setentrypoint(Slapi_Backend *be, int entrypoint, void *ret_fnptr,
  948. Slapi_PBlock *pb);
  949. int slapi_be_logchanges(Slapi_Backend *be);
  950. int slapi_be_issuffix(const Slapi_Backend *be, const Slapi_DN *suffix );
  951. void slapi_be_addsuffix(Slapi_Backend *be,const Slapi_DN *suffix);
  952. char * slapi_be_get_name(Slapi_Backend * be);
  953. const Slapi_DN *slapi_be_getsuffix(Slapi_Backend *be, int n);
  954. Slapi_Backend* slapi_get_first_backend(char **cookie);
  955. Slapi_Backend* slapi_get_next_backend(char *cookie);
  956. int slapi_be_private( Slapi_Backend *be );
  957. void * slapi_be_get_instance_info(Slapi_Backend * be);
  958. void slapi_be_set_instance_info(Slapi_Backend * be, void * data);
  959. Slapi_DN * slapi_get_first_suffix(void ** node, int show_private);
  960. Slapi_DN * slapi_get_next_suffix(void ** node, int show_private);
  961. int slapi_is_root_suffix(Slapi_DN * dn);
  962. const char * slapi_be_gettype(Slapi_Backend *be);
  963. int slapi_be_is_flag_set(Slapi_Backend * be, int flag);
  964. void slapi_be_set_flag(Slapi_Backend * be, int flag);
  965. #define SLAPI_BE_FLAG_REMOTE_DATA 0x1 /* entries held by backend are remote */
  966. #define SLAPI_BE_FLAG_DONT_BYPASS_FILTERTEST 0x10 /* force to call filter_test (search only) */
  967. /* These functions allow a plugin to register for callback when
  968. * a backend state change
  969. */
  970. typedef void (*slapi_backend_state_change_fnptr)(void *handle, char *be_name,
  971. int old_be_state, int new_be_state);
  972. void slapi_register_backend_state_change(void * handle, slapi_backend_state_change_fnptr funct);
  973. int slapi_unregister_backend_state_change(void * handle);
  974. #define SLAPI_BE_STATE_ON 1 /* backend is ON */
  975. #define SLAPI_BE_STATE_OFFLINE 2 /* backend is OFFLINE (import process) */
  976. #define SLAPI_BE_STATE_DELETE 3 /* backend has been deleted */
  977. /*
  978. * Distribution.
  979. */
  980. /* SLAPI_BE_ALL_BACKENDS is a special value that is returned by
  981. * a distribution plugin function to indicate that all backends
  982. * should be searched (it is only used for search operations).
  983. */
  984. #define SLAPI_BE_ALL_BACKENDS -1
  985. /*
  986. * virtual attribute service
  987. */
  988. /* General flags (flags parameter) */
  989. #define SLAPI_REALATTRS_ONLY 1
  990. #define SLAPI_VIRTUALATTRS_ONLY 2
  991. #define SLAPI_VIRTUALATTRS_REQUEST_POINTERS 4 /* I want to receive pointers into the entry, if possible */
  992. #define SLAPI_VIRTUALATTRS_LIST_OPERATIONAL_ATTRS 8 /* Include operational attributes in attribute lists */
  993. #define SLAPI_VIRTUALATTRS_SUPPRESS_SUBTYPES 16 /* I want only the requested attribute */
  994. /* Buffer disposition flags (buffer_flags parameter) */
  995. #define SLAPI_VIRTUALATTRS_RETURNED_POINTERS 1
  996. #define SLAPI_VIRTUALATTRS_RETURNED_COPIES 2
  997. #define SLAPI_VIRTUALATTRS_REALATTRS_ONLY 4
  998. /* Attribute type name disposition values (type_name_disposition parameter) */
  999. #define SLAPI_VIRTUALATTRS_TYPE_NAME_MATCHED_EXACTLY_OR_ALIAS 1
  1000. #define SLAPI_VIRTUALATTRS_TYPE_NAME_MATCHED_SUBTYPE 2
  1001. #define SLAPI_VIRTUALATTRS_NOT_FOUND -1
  1002. #define SLAPI_VIRTUALATTRS_LOOP_DETECTED -2
  1003. typedef struct _vattr_type_thang vattr_type_thang;
  1004. typedef struct _vattr_get_thang vattr_get_thang;
  1005. vattr_get_thang *slapi_vattr_getthang_first(vattr_get_thang *t);
  1006. vattr_get_thang *slapi_vattr_getthang_next(vattr_get_thang *t);
  1007. int slapi_vattr_values_type_thang_get(
  1008. /* Entry we're interested in */ Slapi_Entry *e,
  1009. /* attr type */ vattr_type_thang *type_thang,
  1010. /* pointer to result set */ Slapi_ValueSet** results,
  1011. int *type_name_disposition, char **actual_type_name, int flags,
  1012. int *buffer_flags);
  1013. int slapi_vattr_values_get(
  1014. /* Entry we're interested in */ Slapi_Entry *e,
  1015. /* attr type name */ char *type,
  1016. /* pointer to result set */ Slapi_ValueSet** results,
  1017. int *type_name_disposition, char **actual_type_name, int flags,
  1018. int *buffer_flags);
  1019. int slapi_vattr_values_get_ex(
  1020. /* Entry we're interested in */ Slapi_Entry *e,
  1021. /* attr type name */ char *type,
  1022. /* pointer to result set */ Slapi_ValueSet*** results,
  1023. int **type_name_disposition, char ***actual_type_name, int flags,
  1024. int *buffer_flags, int *subtype_count);
  1025. int slapi_vattr_namespace_values_get(
  1026. /* Entry we're interested in */ Slapi_Entry *e,
  1027. /* backend namespace dn */ Slapi_DN *namespace_dn,
  1028. /* attr type name */ char *type,
  1029. /* pointer to result set */ Slapi_ValueSet*** results,
  1030. int **type_name_disposition, char ***actual_type_name, int flags,
  1031. int *buffer_flags, int *subtype_count);
  1032. void slapi_vattr_values_free(Slapi_ValueSet **value, char **actual_type_name,
  1033. int flags);
  1034. int slapi_vattr_value_compare(
  1035. /* Entry we're interested in */ Slapi_Entry *e,
  1036. /* attr type name */ char *type,
  1037. Slapi_Value *test_this,/* pointer to result */ int *result,
  1038. int flags);
  1039. int slapi_vattr_namespace_value_compare(
  1040. /* Entry we're interested in */ Slapi_Entry *e,
  1041. /* backend namespace dn */ Slapi_DN *namespace_dn,
  1042. /* attr type name */ const char *type,
  1043. Slapi_Value *test_this,/* pointer to result */ int *result,
  1044. int flags);
  1045. int slapi_vattr_list_attrs(
  1046. /* Entry we're interested in */ Slapi_Entry *e,
  1047. /* pointer to receive the list */ vattr_type_thang **types,
  1048. int flags, int *buffer_flags);
  1049. void slapi_vattr_attrs_free(vattr_type_thang **types, int flags);
  1050. char *vattr_typethang_get_name(vattr_type_thang *t);
  1051. unsigned long vattr_typethang_get_flags(vattr_type_thang *t);
  1052. vattr_type_thang *vattr_typethang_next(vattr_type_thang *t);
  1053. vattr_type_thang *vattr_typethang_first(vattr_type_thang *t);
  1054. int slapi_vattr_schema_check_type(Slapi_Entry *e, char *type);
  1055. /* roles */
  1056. typedef int (*roles_check_fn_type)(Slapi_Entry *entry_to_check, Slapi_DN *role_dn, int *present);
  1057. int slapi_role_check(Slapi_Entry *entry_to_check, Slapi_DN *role_dn, int *present);
  1058. void slapi_register_role_check(roles_check_fn_type check_fn);
  1059. /* DSE */
  1060. /* Front end configuration */
  1061. typedef int (*dseCallbackFn)(Slapi_PBlock *, Slapi_Entry *, Slapi_Entry *,
  1062. int *, char*, void *);
  1063. /******************************************************************************
  1064. * Online tasks interface (to support import, export, etc)
  1065. * After some cleanup, we could consider making these public.
  1066. */
  1067. /* task states */
  1068. #define SLAPI_TASK_SETUP 0
  1069. #define SLAPI_TASK_RUNNING 1
  1070. #define SLAPI_TASK_FINISHED 2
  1071. #define SLAPI_TASK_CANCELLED 3
  1072. /* task flags (set by the task-control code) */
  1073. #define SLAPI_TASK_DESTROYING 0x01 /* queued event for destruction */
  1074. int slapi_task_register_handler(const char *name, dseCallbackFn func);
  1075. void slapi_task_status_changed(Slapi_Task *task);
  1076. void slapi_task_log_status(Slapi_Task *task, char *format, ...)
  1077. #ifdef __GNUC__
  1078. __attribute__ ((format (printf, 2, 3)));
  1079. #else
  1080. ;
  1081. #endif
  1082. void slapi_task_log_notice(Slapi_Task *task, char *format, ...)
  1083. #ifdef __GNUC__
  1084. __attribute__ ((format (printf, 2, 3)));
  1085. #else
  1086. ;
  1087. #endif
  1088. /*
  1089. * slapi_new_task: create new task, fill in DN, and setup modify callback
  1090. * argument:
  1091. * dn: task dn
  1092. * result:
  1093. * Success: Slapi_Task object
  1094. * Failure: NULL
  1095. */
  1096. Slapi_Task *slapi_new_task(const char *dn);
  1097. /* slapi_destroy_task: destroy a task
  1098. * argument:
  1099. * task: task to destroy
  1100. * result:
  1101. * none
  1102. */
  1103. void slapi_destroy_task(void *arg);
  1104. /* End of interface to support online tasks **********************************/
  1105. /* Binder-based (connection centric) resource limits */
  1106. /*
  1107. * Valid values for `type' parameter to slapi_reslimit_register().
  1108. */
  1109. #define SLAPI_RESLIMIT_TYPE_INT 0
  1110. /*
  1111. * Status codes returned by all functions.
  1112. */
  1113. #define SLAPI_RESLIMIT_STATUS_SUCCESS 0 /* goodness */
  1114. #define SLAPI_RESLIMIT_STATUS_NOVALUE 1 /* no value is available */
  1115. #define SLAPI_RESLIMIT_STATUS_INIT_FAILURE 2 /* initialization failed */
  1116. #define SLAPI_RESLIMIT_STATUS_PARAM_ERROR 3 /* bad parameter */
  1117. #define SLAPI_RESLIMIT_STATUS_UNKNOWN_HANDLE 4 /* unregistered handle */
  1118. #define SLAPI_RESLIMIT_STATUS_INTERNAL_ERROR 5 /* unexpected error */
  1119. /*
  1120. * Functions.
  1121. */
  1122. int slapi_reslimit_register( int type, const char *attrname, int *handlep );
  1123. int slapi_reslimit_get_integer_limit( Slapi_Connection *conn, int handle,
  1124. int *limitp );
  1125. /* END of Binder-based resource limits API */
  1126. /*
  1127. * Plugin and parameter block related macros (remainder of this file).
  1128. */
  1129. /*
  1130. * Plugin version. Note that the Directory Server will load version 01
  1131. * and 02 plugins, but some server features require 03 plugins.
  1132. */
  1133. #define SLAPI_PLUGIN_VERSION_01 "01"
  1134. #define SLAPI_PLUGIN_VERSION_02 "02"
  1135. #define SLAPI_PLUGIN_VERSION_03 "03"
  1136. #define SLAPI_PLUGIN_CURRENT_VERSION SLAPI_PLUGIN_VERSION_03
  1137. #define SLAPI_PLUGIN_IS_COMPAT(x) \
  1138. ((strcmp((x), SLAPI_PLUGIN_VERSION_01) == 0) || \
  1139. (strcmp((x), SLAPI_PLUGIN_VERSION_02) == 0) || \
  1140. (strcmp((x), SLAPI_PLUGIN_VERSION_03) == 0))
  1141. #define SLAPI_PLUGIN_IS_V2(x) \
  1142. ((strcmp((x)->plg_version, SLAPI_PLUGIN_VERSION_02) == 0) || \
  1143. (strcmp((x)->plg_version, SLAPI_PLUGIN_VERSION_03) == 0))
  1144. #define SLAPI_PLUGIN_IS_V3(x) \
  1145. (strcmp((x)->plg_version, SLAPI_PLUGIN_VERSION_03) == 0)
  1146. /* this one just has to be human readable */
  1147. #define SLAPI_PLUGIN_SUPPORTED_VERSIONS "01,02,03"
  1148. /*
  1149. * types of plugin interfaces
  1150. */
  1151. #define SLAPI_PLUGIN_EXTENDEDOP 2
  1152. #define SLAPI_PLUGIN_PREOPERATION 3
  1153. #define SLAPI_PLUGIN_POSTOPERATION 4
  1154. #define SLAPI_PLUGIN_MATCHINGRULE 5
  1155. #define SLAPI_PLUGIN_SYNTAX 6
  1156. #define SLAPI_PLUGIN_ACL 7
  1157. #define SLAPI_PLUGIN_BEPREOPERATION 8
  1158. #define SLAPI_PLUGIN_BEPOSTOPERATION 9
  1159. #define SLAPI_PLUGIN_ENTRY 10
  1160. #define SLAPI_PLUGIN_TYPE_OBJECT 11
  1161. #define SLAPI_PLUGIN_INTERNAL_PREOPERATION 12
  1162. #define SLAPI_PLUGIN_INTERNAL_POSTOPERATION 13
  1163. #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME 14
  1164. #define SLAPI_PLUGIN_VATTR_SP 15
  1165. #define SLAPI_PLUGIN_REVER_PWD_STORAGE_SCHEME 16
  1166. #define SLAPI_PLUGIN_LDBM_ENTRY_FETCH_STORE 17
  1167. #define SLAPI_PLUGIN_INDEX 18
  1168. /*
  1169. * special return values for extended operation plugins (zero or positive
  1170. * return values should be LDAP error codes as defined in ldap.h)
  1171. */
  1172. #define SLAPI_PLUGIN_EXTENDED_SENT_RESULT -1
  1173. #define SLAPI_PLUGIN_EXTENDED_NOT_HANDLED -2
  1174. /*
  1175. * the following can be used as the second argument to the
  1176. * slapi_pblock_get() and slapi_pblock_set() calls.
  1177. */
  1178. /* backend, connection, operation */
  1179. #define SLAPI_BACKEND 130
  1180. #define SLAPI_CONNECTION 131
  1181. #define SLAPI_OPERATION 132
  1182. #define SLAPI_REQUESTOR_ISROOT 133
  1183. #define SLAPI_BE_TYPE 135
  1184. #define SLAPI_BE_READONLY 136
  1185. #define SLAPI_BE_LASTMOD 137
  1186. #define SLAPI_CONN_ID 139
  1187. #define SLAPI_BACKEND_COUNT 860
  1188. /* operation */
  1189. #define SLAPI_OPINITIATED_TIME 140
  1190. #define SLAPI_REQUESTOR_DN 141
  1191. #define SLAPI_OPERATION_PARAMETERS 138
  1192. #define SLAPI_OPERATION_TYPE 590
  1193. #define SLAPI_OPERATION_AUTHTYPE 741
  1194. #define SLAPI_OPERATION_ID 744
  1195. #define SLAPI_IS_REPLICATED_OPERATION 142
  1196. #define SLAPI_IS_MMR_REPLICATED_OPERATION 153
  1197. #define SLAPI_IS_LEGACY_REPLICATED_OPERATION 154
  1198. /* connection */
  1199. #define SLAPI_CONN_DN 143
  1200. #define SLAPI_CONN_CLIENTNETADDR 850
  1201. #define SLAPI_CONN_SERVERNETADDR 851
  1202. #define SLAPI_CONN_IS_REPLICATION_SESSION 149
  1203. #define SLAPI_CONN_IS_SSL_SESSION 747
  1204. #define SLAPI_CONN_CERT 743
  1205. #define SLAPI_CONN_AUTHMETHOD 746
  1206. #define SLAPI_CONN_SASL_SSF 748
  1207. /*
  1208. * Types of authentication for SLAPI_CONN_AUTHMETHOD
  1209. * (and deprecated SLAPI_CONN_AUTHTYPE)
  1210. */
  1211. #define SLAPD_AUTH_NONE "none"
  1212. #define SLAPD_AUTH_SIMPLE "simple"
  1213. #define SLAPD_AUTH_SSL "SSL"
  1214. #define SLAPD_AUTH_SASL "SASL " /* followed by the mechanism name */
  1215. #define SLAPD_AUTH_OS "OS"
  1216. /* Command Line Arguments */
  1217. #define SLAPI_ARGC 147
  1218. #define SLAPI_ARGV 148
  1219. /* Slapd config file directory */
  1220. #define SLAPI_CONFIG_DIRECTORY 281
  1221. /* DSE flags */
  1222. #define SLAPI_DSE_DONT_WRITE_WHEN_ADDING 282
  1223. #define SLAPI_DSE_MERGE_WHEN_ADDING 283
  1224. #define SLAPI_DSE_DONT_CHECK_DUPS 284
  1225. #define SLAPI_DSE_REAPPLY_MODS 287
  1226. #define SLAPI_DSE_IS_PRIMARY_FILE 289
  1227. /* internal schema flags */
  1228. #define SLAPI_SCHEMA_USER_DEFINED_ONLY 285
  1229. /* urp flags */
  1230. #define SLAPI_URP_NAMING_COLLISION_DN 286
  1231. #define SLAPI_URP_TOMBSTONE_UNIQUEID 288
  1232. /* common to all plugins */
  1233. #define SLAPI_PLUGIN 3
  1234. #define SLAPI_PLUGIN_PRIVATE 4
  1235. #define SLAPI_PLUGIN_TYPE 5
  1236. #define SLAPI_PLUGIN_ARGV 6
  1237. #define SLAPI_PLUGIN_ARGC 7
  1238. #define SLAPI_PLUGIN_VERSION 8
  1239. #define SLAPI_PLUGIN_OPRETURN 9
  1240. #define SLAPI_PLUGIN_OBJECT 10
  1241. #define SLAPI_PLUGIN_DESTROY_FN 11
  1242. #define SLAPI_PLUGIN_DESCRIPTION 12
  1243. typedef struct slapi_plugindesc {
  1244. char *spd_id;
  1245. char *spd_vendor;
  1246. char *spd_version;
  1247. char *spd_description;
  1248. } Slapi_PluginDesc;
  1249. #define SLAPI_PLUGIN_IDENTITY 13
  1250. /* common for internal plugin_ops */
  1251. #define SLAPI_PLUGIN_INTOP_RESULT 15
  1252. #define SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES 16
  1253. #define SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS 17
  1254. /* miscellaneous plugin functions */
  1255. #define SLAPI_PLUGIN_CLOSE_FN 210
  1256. #define SLAPI_PLUGIN_START_FN 212
  1257. #define SLAPI_PLUGIN_CLEANUP_FN 232
  1258. #define SLAPI_PLUGIN_POSTSTART_FN 233
  1259. /* extendedop plugin functions */
  1260. #define SLAPI_PLUGIN_EXT_OP_FN 300
  1261. #define SLAPI_PLUGIN_EXT_OP_OIDLIST 301
  1262. #define SLAPI_PLUGIN_EXT_OP_NAMELIST 302
  1263. /* preoperation plugin functions */
  1264. #define SLAPI_PLUGIN_PRE_BIND_FN 401
  1265. #define SLAPI_PLUGIN_PRE_UNBIND_FN 402
  1266. #define SLAPI_PLUGIN_PRE_SEARCH_FN 403
  1267. #define SLAPI_PLUGIN_PRE_COMPARE_FN 404
  1268. #define SLAPI_PLUGIN_PRE_MODIFY_FN 405
  1269. #define SLAPI_PLUGIN_PRE_MODRDN_FN 406
  1270. #define SLAPI_PLUGIN_PRE_ADD_FN 407
  1271. #define SLAPI_PLUGIN_PRE_DELETE_FN 408
  1272. #define SLAPI_PLUGIN_PRE_ABANDON_FN 409
  1273. #define SLAPI_PLUGIN_PRE_ENTRY_FN 410
  1274. #define SLAPI_PLUGIN_PRE_REFERRAL_FN 411
  1275. #define SLAPI_PLUGIN_PRE_RESULT_FN 412
  1276. /* internal preoperation plugin functions */
  1277. #define SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN 420
  1278. #define SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN 421
  1279. #define SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN 422
  1280. #define SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN 423
  1281. /* preoperation plugin to the backend */
  1282. #define SLAPI_PLUGIN_BE_PRE_ADD_FN 450
  1283. #define SLAPI_PLUGIN_BE_PRE_MODIFY_FN 451
  1284. #define SLAPI_PLUGIN_BE_PRE_MODRDN_FN 452
  1285. #define SLAPI_PLUGIN_BE_PRE_DELETE_FN 453
  1286. /* postoperation plugin functions */
  1287. #define SLAPI_PLUGIN_POST_BIND_FN 501
  1288. #define SLAPI_PLUGIN_POST_UNBIND_FN 502
  1289. #define SLAPI_PLUGIN_POST_SEARCH_FN 503
  1290. #define SLAPI_PLUGIN_POST_COMPARE_FN 504
  1291. #define SLAPI_PLUGIN_POST_MODIFY_FN 505
  1292. #define SLAPI_PLUGIN_POST_MODRDN_FN 506
  1293. #define SLAPI_PLUGIN_POST_ADD_FN 507
  1294. #define SLAPI_PLUGIN_POST_DELETE_FN 508
  1295. #define SLAPI_PLUGIN_POST_ABANDON_FN 509
  1296. #define SLAPI_PLUGIN_POST_ENTRY_FN 510
  1297. #define SLAPI_PLUGIN_POST_REFERRAL_FN 511
  1298. #define SLAPI_PLUGIN_POST_RESULT_FN 512
  1299. #define SLAPI_PLUGIN_POST_SEARCH_FAIL_FN 513
  1300. /* internal preoperation plugin functions */
  1301. #define SLAPI_PLUGIN_INTERNAL_POST_ADD_FN 520
  1302. #define SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN 521
  1303. #define SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN 522
  1304. #define SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN 523
  1305. /* postoperation plugin to the backend */
  1306. #define SLAPI_PLUGIN_BE_POST_ADD_FN 550
  1307. #define SLAPI_PLUGIN_BE_POST_MODIFY_FN 551
  1308. #define SLAPI_PLUGIN_BE_POST_MODRDN_FN 552
  1309. #define SLAPI_PLUGIN_BE_POST_DELETE_FN 553
  1310. /* matching rule plugin functions */
  1311. #define SLAPI_PLUGIN_MR_FILTER_CREATE_FN 600
  1312. #define SLAPI_PLUGIN_MR_INDEXER_CREATE_FN 601
  1313. #define SLAPI_PLUGIN_MR_FILTER_MATCH_FN 602
  1314. #define SLAPI_PLUGIN_MR_FILTER_INDEX_FN 603
  1315. #define SLAPI_PLUGIN_MR_FILTER_RESET_FN 604
  1316. #define SLAPI_PLUGIN_MR_INDEX_FN 605
  1317. /* matching rule plugin arguments */
  1318. #define SLAPI_PLUGIN_MR_OID 610
  1319. #define SLAPI_PLUGIN_MR_TYPE 611
  1320. #define SLAPI_PLUGIN_MR_VALUE 612
  1321. #define SLAPI_PLUGIN_MR_VALUES 613
  1322. #define SLAPI_PLUGIN_MR_KEYS 614
  1323. #define SLAPI_PLUGIN_MR_FILTER_REUSABLE 615
  1324. #define SLAPI_PLUGIN_MR_QUERY_OPERATOR 616
  1325. #define SLAPI_PLUGIN_MR_USAGE 617
  1326. /* Defined values of SLAPI_PLUGIN_MR_QUERY_OPERATOR: */
  1327. #define SLAPI_OP_LESS 1
  1328. #define SLAPI_OP_LESS_OR_EQUAL 2
  1329. #define SLAPI_OP_EQUAL 3
  1330. #define SLAPI_OP_GREATER_OR_EQUAL 4
  1331. #define SLAPI_OP_GREATER 5
  1332. #define SLAPI_OP_SUBSTRING 6
  1333. /* Defined values of SLAPI_PLUGIN_MR_USAGE: */
  1334. #define SLAPI_PLUGIN_MR_USAGE_INDEX 0
  1335. #define SLAPI_PLUGIN_MR_USAGE_SORT 1
  1336. /* Defined values for matchingRuleEntry accessor functions */
  1337. #define SLAPI_MATCHINGRULE_NAME 1
  1338. #define SLAPI_MATCHINGRULE_OID 2
  1339. #define SLAPI_MATCHINGRULE_DESC 3
  1340. #define SLAPI_MATCHINGRULE_SYNTAX 4
  1341. #define SLAPI_MATCHINGRULE_OBSOLETE 5
  1342. /* syntax plugin functions and arguments */
  1343. #define SLAPI_PLUGIN_SYNTAX_FILTER_AVA 700
  1344. #define SLAPI_PLUGIN_SYNTAX_FILTER_SUB 701
  1345. #define SLAPI_PLUGIN_SYNTAX_VALUES2KEYS 702
  1346. #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA 703
  1347. #define SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB 704
  1348. #define SLAPI_PLUGIN_SYNTAX_NAMES 705
  1349. #define SLAPI_PLUGIN_SYNTAX_OID 706
  1350. #define SLAPI_PLUGIN_SYNTAX_FLAGS 707
  1351. #define SLAPI_PLUGIN_SYNTAX_COMPARE 708
  1352. /* ACL plugin functions and arguments */
  1353. #define SLAPI_PLUGIN_ACL_INIT 730
  1354. #define SLAPI_PLUGIN_ACL_SYNTAX_CHECK 731
  1355. #define SLAPI_PLUGIN_ACL_ALLOW_ACCESS 732
  1356. #define SLAPI_PLUGIN_ACL_MODS_ALLOWED 733
  1357. #define SLAPI_PLUGIN_ACL_MODS_UPDATE 734
  1358. #define ACLPLUGIN_ACCESS_DEFAULT 0
  1359. #define ACLPLUGIN_ACCESS_READ_ON_ENTRY 1
  1360. #define ACLPLUGIN_ACCESS_READ_ON_ATTR 2
  1361. #define ACLPLUGIN_ACCESS_READ_ON_VLV 3
  1362. #define ACLPLUGIN_ACCESS_MODRDN 4
  1363. #define ACLPLUGIN_ACCESS_GET_EFFECTIVE_RIGHTS 5
  1364. /* Authorization types */
  1365. #define SLAPI_BE_MAXNESTLEVEL 742
  1366. #define SLAPI_CLIENT_DNS 745
  1367. /* Password storage scheme functions and arguments */
  1368. #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_ENC_FN 800
  1369. #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DEC_FN 801 /* only meaningfull for reversible encryption */
  1370. #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_CMP_FN 802
  1371. #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_NAME 810 /* name of the method: SHA, SSHA... */
  1372. #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD 811 /* value sent over LDAP */
  1373. #define SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD 812 /* value from the DB */
  1374. /* entry fetch and entry store values */
  1375. #define SLAPI_PLUGIN_ENTRY_FETCH_FUNC 813
  1376. #define SLAPI_PLUGIN_ENTRY_STORE_FUNC 814
  1377. /*
  1378. * Defined values of SLAPI_PLUGIN_SYNTAX_FLAGS:
  1379. */
  1380. #define SLAPI_PLUGIN_SYNTAX_FLAG_ORKEYS 1
  1381. #define SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING 2
  1382. /* controls we know about */
  1383. #define SLAPI_MANAGEDSAIT 1000
  1384. #define SLAPI_PWPOLICY 1001
  1385. /* arguments that are common to all operation */
  1386. #define SLAPI_TARGET_ADDRESS 48 /* target address (dn + uniqueid) should be normalized */
  1387. #define SLAPI_TARGET_UNIQUEID 49 /* target uniqueid of the operation */
  1388. #define SLAPI_TARGET_DN 50 /* target dn of the operation should be normalized */
  1389. #define SLAPI_REQCONTROLS 51 /* request controls */
  1390. /* Copies of entry before and after add, mod, mod[r]dn operations */
  1391. #define SLAPI_ENTRY_PRE_OP 52
  1392. #define SLAPI_ENTRY_POST_OP 53
  1393. /* LDAPv3 controls to be sent with the operation result */
  1394. #define SLAPI_RESCONTROLS 55
  1395. #define SLAPI_ADD_RESCONTROL 56 /* add result control */
  1396. /* Extra notes to be logged within access log RESULT lines */
  1397. #define SLAPI_OPERATION_NOTES 57
  1398. #define SLAPI_OP_NOTE_UNINDEXED 0x01
  1399. /* Allows controls to be passed before operation object is created */
  1400. #define SLAPI_CONTROLS_ARG 58
  1401. /* specify whether pblock content should be destroyed when the pblock is destroyed */
  1402. #define SLAPI_DESTROY_CONTENT 59
  1403. /* add arguments */
  1404. #define SLAPI_ADD_TARGET SLAPI_TARGET_DN
  1405. #define SLAPI_ADD_ENTRY 60
  1406. #define SLAPI_ADD_EXISTING_DN_ENTRY 61
  1407. #define SLAPI_ADD_PARENT_ENTRY 62
  1408. #define SLAPI_ADD_PARENT_UNIQUEID 63
  1409. #define SLAPI_ADD_EXISTING_UNIQUEID_ENTRY 64
  1410. /* bind arguments */
  1411. #define SLAPI_BIND_TARGET SLAPI_TARGET_DN
  1412. #define SLAPI_BIND_METHOD 70
  1413. #define SLAPI_BIND_CREDENTIALS 71 /* v3 only */
  1414. #define SLAPI_BIND_SASLMECHANISM 72 /* v3 only */
  1415. /* bind return values */
  1416. #define SLAPI_BIND_RET_SASLCREDS 73 /* v3 only */
  1417. /* compare arguments */
  1418. #define SLAPI_COMPARE_TARGET SLAPI_TARGET_DN
  1419. #define SLAPI_COMPARE_TYPE 80
  1420. #define SLAPI_COMPARE_VALUE 81
  1421. /* delete arguments */
  1422. #define SLAPI_DELETE_TARGET SLAPI_TARGET_DN
  1423. #define SLAPI_DELETE_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
  1424. #define SLAPI_DELETE_GLUE_PARENT_ENTRY SLAPI_ADD_PARENT_ENTRY
  1425. /* modify arguments */
  1426. #define SLAPI_MODIFY_TARGET SLAPI_TARGET_DN
  1427. #define SLAPI_MODIFY_MODS 90
  1428. #define SLAPI_MODIFY_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
  1429. /* modrdn arguments */
  1430. #define SLAPI_MODRDN_TARGET SLAPI_TARGET_DN
  1431. #define SLAPI_MODRDN_NEWRDN 100
  1432. #define SLAPI_MODRDN_DELOLDRDN 101
  1433. #define SLAPI_MODRDN_NEWSUPERIOR 102 /* v3 only */
  1434. #define SLAPI_MODRDN_EXISTING_ENTRY SLAPI_ADD_EXISTING_DN_ENTRY
  1435. #define SLAPI_MODRDN_PARENT_ENTRY 104
  1436. #define SLAPI_MODRDN_NEWPARENT_ENTRY 105
  1437. #define SLAPI_MODRDN_TARGET_ENTRY 106
  1438. #define SLAPI_MODRDN_NEWSUPERIOR_ADDRESS 107
  1439. /*
  1440. * unnormalized dn argument (useful for MOD, MODRDN and DEL operations to carry
  1441. * the original non-escaped dn as introduced by the client application)
  1442. */
  1443. #define SLAPI_ORIGINAL_TARGET_DN 109
  1444. #define SLAPI_ORIGINAL_TARGET SLAPI_ORIGINAL_TARGET_DN
  1445. /* search arguments */
  1446. #define SLAPI_SEARCH_TARGET SLAPI_TARGET_DN
  1447. #define SLAPI_SEARCH_SCOPE 110
  1448. #define SLAPI_SEARCH_DEREF 111
  1449. #define SLAPI_SEARCH_SIZELIMIT 112
  1450. #define SLAPI_SEARCH_TIMELIMIT 113
  1451. #define SLAPI_SEARCH_FILTER 114
  1452. #define SLAPI_SEARCH_STRFILTER 115
  1453. #define SLAPI_SEARCH_ATTRS 116
  1454. #define SLAPI_SEARCH_ATTRSONLY 117
  1455. #define SLAPI_SEARCH_IS_AND 118
  1456. /* abandon arguments */
  1457. #define SLAPI_ABANDON_MSGID 120
  1458. /* seq access arguments */
  1459. #define SLAPI_SEQ_TYPE 150
  1460. #define SLAPI_SEQ_ATTRNAME 151
  1461. #define SLAPI_SEQ_VAL 152
  1462. /* extended operation arguments */
  1463. #define SLAPI_EXT_OP_REQ_OID 160 /* v3 only */
  1464. #define SLAPI_EXT_OP_REQ_VALUE 161 /* v3 only */
  1465. /* extended operation return values */
  1466. #define SLAPI_EXT_OP_RET_OID 162 /* v3 only */
  1467. #define SLAPI_EXT_OP_RET_VALUE 163 /* v3 only */
  1468. /* extended filter arguments */
  1469. #define SLAPI_MR_FILTER_ENTRY 170 /* v3 only */
  1470. #define SLAPI_MR_FILTER_TYPE 171 /* v3 only */
  1471. #define SLAPI_MR_FILTER_VALUE 172 /* v3 only */
  1472. #define SLAPI_MR_FILTER_OID 173 /* v3 only */
  1473. #define SLAPI_MR_FILTER_DNATTRS 174 /* v3 only */
  1474. /* ldif2db arguments */
  1475. /* ldif file to convert to db */
  1476. #define SLAPI_LDIF2DB_FILE 180
  1477. /* check for duplicate values or not */
  1478. #define SLAPI_LDIF2DB_REMOVEDUPVALS 185
  1479. /* index only this attribute from existing database */
  1480. #define SLAPI_DB2INDEX_ATTRS 186
  1481. /* do not generate attribute indexes */
  1482. #define SLAPI_LDIF2DB_NOATTRINDEXES 187
  1483. /* list if DNs to include */
  1484. #define SLAPI_LDIF2DB_INCLUDE 188
  1485. /* list of DNs to exclude */
  1486. #define SLAPI_LDIF2DB_EXCLUDE 189
  1487. /* generate uniqueid */
  1488. #define SLAPI_LDIF2DB_GENERATE_UNIQUEID 175
  1489. #define SLAPI_LDIF2DB_NAMESPACEID 177
  1490. #define SLAPI_LDIF2DB_ENCRYPT 303
  1491. #define SLAPI_DB2LDIF_DECRYPT 304
  1492. /* uniqueid generation options */
  1493. #define SLAPI_UNIQUEID_GENERATE_NONE 0 /* do not generate */
  1494. #define SLAPI_UNIQUEID_GENERATE_TIME_BASED 1 /* generate time based id */
  1495. #define SLAPI_UNIQUEID_GENERATE_NAME_BASED 2 /* generate name based id */
  1496. /* db2ldif arguments */
  1497. /* print keys or not in ldif */
  1498. #define SLAPI_DB2LDIF_PRINTKEY 183
  1499. /* filename to export */
  1500. #define SLAPI_DB2LDIF_FILE 184
  1501. /* dump uniqueid */
  1502. #define SLAPI_DB2LDIF_DUMP_UNIQUEID 176
  1503. #define SLAPI_DB2LDIF_SERVER_RUNNING 197
  1504. /* db2ldif/ldif2db/bak2db/db2bak arguments */
  1505. #define SLAPI_BACKEND_INSTANCE_NAME 178
  1506. #define SLAPI_BACKEND_TASK 179
  1507. #define SLAPI_TASK_FLAGS 181
  1508. /* bulk import (online wire import) */
  1509. #define SLAPI_BULK_IMPORT_ENTRY 182
  1510. #define SLAPI_BULK_IMPORT_STATE 192
  1511. /* the actual states (these are not pblock args) */
  1512. #define SLAPI_BI_STATE_START 1
  1513. #define SLAPI_BI_STATE_DONE 2
  1514. #define SLAPI_BI_STATE_ADD 3
  1515. /* possible error codes from a bulk import */
  1516. #define SLAPI_BI_ERR_BUSY -23 /* backend is busy; try later */
  1517. /* transaction arguments */
  1518. #define SLAPI_PARENT_TXN 190
  1519. #define SLAPI_TXN 191
  1520. /*
  1521. * The following are used to pass information back and forth
  1522. * between the front end and the back end. The backend
  1523. * creates a search result set as an opaque structure and
  1524. * passes a reference to this back to the front end. The
  1525. * front end uses the backend's iterator entry point to
  1526. * step through the results. The entry, nentries, and
  1527. * referrals options, below, are set/read by both the
  1528. * front end and back end while stepping through the
  1529. * search results.
  1530. */
  1531. /* Search result set */
  1532. #define SLAPI_SEARCH_RESULT_SET 193
  1533. /* Search result - next entry returned from search result set */
  1534. #define SLAPI_SEARCH_RESULT_ENTRY 194
  1535. #define SLAPI_SEARCH_RESULT_ENTRY_EXT 1944
  1536. /* Number of entries returned from search */
  1537. #define SLAPI_NENTRIES 195
  1538. /* Any referrals encountered during the search */
  1539. #define SLAPI_SEARCH_REFERRALS 196
  1540. #define SLAPI_RESULT_CODE 881
  1541. #define SLAPI_RESULT_TEXT 882
  1542. #define SLAPI_RESULT_MATCHED 883
  1543. #define SLAPI_PB_RESULT_TEXT 885
  1544. /* Size of the database, in kilobytes */
  1545. #define SLAPI_DBSIZE 199
  1546. #ifdef __cplusplus
  1547. }
  1548. #endif
  1549. #endif /* _SLAPIPLUGIN */