slapi-plugin.h 67 KB

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