repl5_init.c 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. /*
  13. repl5_init.c - plugin initialization functions
  14. */
  15. /*
  16. * Add an entry like the following to dse.ldif to enable this plugin:
  17. dn: cn=Multi-Master Replication Plugin,cn=plugins,cn=config
  18. objectclass: top
  19. objectclass: nsSlapdPlugin
  20. objectclass: extensibleObject
  21. cn: Legacy Replication Plugin
  22. nsslapd-pluginpath: /export2/servers/Hydra-supplier/lib/replication-plugin.so
  23. nsslapd-plugininitfunc: replication_multimaster_plugin_init
  24. nsslapd-plugintype: object
  25. nsslapd-pluginenabled: on
  26. nsslapd-plugin-depends-on-type: database
  27. nsslapd-plugin-depends-on-named: Class of Service
  28. nsslapd-pluginid: replication-multimaster
  29. nsslapd-pluginversion: 5.0b1
  30. nsslapd-pluginvendor: Netscape Communications
  31. nsslapd-plugindescription: Multi-Master Replication Plugin
  32. */
  33. #include "slapi-plugin.h"
  34. #include "repl.h"
  35. #include "repl5.h"
  36. #include "cl5.h" /* changelog interface */
  37. #include "plstr.h"
  38. #define NSDS_REPL_NAME_PREFIX "Netscape Replication"
  39. static char *start_oid_list[] = {
  40. REPL_START_NSDS50_REPLICATION_REQUEST_OID,
  41. REPL_START_NSDS90_REPLICATION_REQUEST_OID,
  42. NULL
  43. };
  44. static char *start_name_list[] = {
  45. NSDS_REPL_NAME_PREFIX " Start Session",
  46. NULL
  47. };
  48. static char *end_oid_list[] = {
  49. REPL_END_NSDS50_REPLICATION_REQUEST_OID,
  50. NULL
  51. };
  52. static char *end_name_list[] = {
  53. NSDS_REPL_NAME_PREFIX " End Session",
  54. NULL
  55. };
  56. static char *total_oid_list[] = {
  57. REPL_NSDS50_REPLICATION_ENTRY_REQUEST_OID,
  58. REPL_NSDS71_REPLICATION_ENTRY_REQUEST_OID,
  59. NULL
  60. };
  61. static char *total_name_list[] = {
  62. NSDS_REPL_NAME_PREFIX " Total Update Entry",
  63. NULL
  64. };
  65. static char *response_oid_list[] = {
  66. REPL_NSDS50_REPLICATION_RESPONSE_OID,
  67. NULL
  68. };
  69. static char *response_name_list[] = {
  70. NSDS_REPL_NAME_PREFIX " Response",
  71. NULL
  72. };
  73. static char *cleanruv_oid_list[] = {
  74. REPL_CLEANRUV_OID,
  75. NULL
  76. };
  77. static char *cleanruv_name_list[] = {
  78. NSDS_REPL_NAME_PREFIX " CleanAllRUV",
  79. NULL
  80. };
  81. static char *cleanruv_abort_oid_list[] = {
  82. REPL_ABORT_CLEANRUV_OID,
  83. NULL
  84. };
  85. static char *cleanruv_abort_name_list[] = {
  86. NSDS_REPL_NAME_PREFIX " CleanAllRUV Abort",
  87. NULL
  88. };
  89. static char *cleanruv_maxcsn_oid_list[] = {
  90. REPL_CLEANRUV_GET_MAXCSN_OID,
  91. NULL
  92. };
  93. static char *cleanruv_maxcsn_name_list[] = {
  94. NSDS_REPL_NAME_PREFIX " CleanAllRUV Retrieve MaxCSN",
  95. NULL
  96. };
  97. static char *cleanruv_status_oid_list[] = {
  98. REPL_CLEANRUV_CHECK_STATUS_OID,
  99. NULL
  100. };
  101. static char *cleanruv_status_name_list[] = {
  102. NSDS_REPL_NAME_PREFIX " CleanAllRUV Check Status",
  103. NULL
  104. };
  105. /* List of plugin identities for every plugin registered. Plugin identity
  106. is passed by the server in the plugin init function and must be supplied
  107. by the plugin to all internal operations it initiates
  108. */
  109. /* ----------------------------- Multi-Master Replication Plugin */
  110. static Slapi_PluginDesc multimasterdesc = {"replication-multimaster", VENDOR, DS_PACKAGE_VERSION, "Multi-master Replication Plugin"};
  111. static Slapi_PluginDesc multimasterpreopdesc = {"replication-multimaster-preop", VENDOR, DS_PACKAGE_VERSION, "Multi-master replication pre-operation plugin"};
  112. static Slapi_PluginDesc multimasterpostopdesc = {"replication-multimaster-postop", VENDOR, DS_PACKAGE_VERSION, "Multi-master replication post-operation plugin"};
  113. static Slapi_PluginDesc multimasterinternalpreopdesc = {"replication-multimaster-internalpreop", VENDOR, DS_PACKAGE_VERSION, "Multi-master replication internal pre-operation plugin"};
  114. static Slapi_PluginDesc multimasterinternalpostopdesc = {"replication-multimaster-internalpostop", VENDOR, DS_PACKAGE_VERSION, "Multimaster replication internal post-operation plugin"};
  115. static Slapi_PluginDesc multimasterbepreopdesc = {"replication-multimaster-bepreop", VENDOR, DS_PACKAGE_VERSION, "Multimaster replication bepre-operation plugin"};
  116. static Slapi_PluginDesc multimasterbepostopdesc = {"replication-multimaster-bepostop", VENDOR, DS_PACKAGE_VERSION, "Multimaster replication bepost-operation plugin"};
  117. static Slapi_PluginDesc multimasterbetxnpostopdesc = {"replication-multimaster-betxnpostop", VENDOR, DS_PACKAGE_VERSION, "Multimaster replication be transaction post-operation plugin"};
  118. static Slapi_PluginDesc multimasterextopdesc = { "replication-multimaster-extop", VENDOR, DS_PACKAGE_VERSION, "Multimaster replication extended-operation plugin" };
  119. static int multimaster_stopped_flag; /* A flag which is set when all the plugin threads are to stop */
  120. static int multimaster_started_flag = 0;
  121. /* Thread private data and interface */
  122. static PRUintn thread_private_agmtname; /* thread private index for logging*/
  123. static PRUintn thread_private_cache;
  124. char*
  125. get_thread_private_agmtname()
  126. {
  127. char *agmtname = NULL;
  128. if (thread_private_agmtname)
  129. agmtname = PR_GetThreadPrivate(thread_private_agmtname);
  130. return (agmtname ? agmtname : "");
  131. }
  132. void
  133. set_thread_private_agmtname(const char *agmtname)
  134. {
  135. if (thread_private_agmtname)
  136. PR_SetThreadPrivate(thread_private_agmtname, (void *)agmtname);
  137. }
  138. void*
  139. get_thread_private_cache ()
  140. {
  141. void *buf = NULL;
  142. if ( thread_private_cache )
  143. buf = PR_GetThreadPrivate ( thread_private_cache );
  144. return buf;
  145. }
  146. void
  147. set_thread_private_cache ( void *buf )
  148. {
  149. if ( thread_private_cache )
  150. PR_SetThreadPrivate ( thread_private_cache, buf );
  151. }
  152. char*
  153. get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
  154. {
  155. int opid=-1;
  156. PRUint64 connid = 0;
  157. CSN *opcsn;
  158. char opcsnstr[CSN_STRSIZE];
  159. *idstr = '\0';
  160. opcsn = NULL;
  161. opcsnstr[0] = '\0';
  162. if (pb) {
  163. Slapi_Operation *op;
  164. slapi_pblock_get (pb, SLAPI_OPERATION_ID, &opid);
  165. /* Avoid "Connection is NULL and hence cannot access SLAPI_CONN_ID" */
  166. if (opid) {
  167. slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
  168. PR_snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%" NSPRIu64 " op=%d",
  169. connid, opid);
  170. }
  171. slapi_pblock_get ( pb, SLAPI_OPERATION, &op );
  172. opcsn = operation_get_csn (op);
  173. if (opcsn) {
  174. csn_as_string (opcsn, PR_FALSE, opcsnstr);
  175. PL_strcatn (idstr, REPL_SESSION_ID_SIZE, " csn=");
  176. PL_strcatn (idstr, REPL_SESSION_ID_SIZE, opcsnstr);
  177. }
  178. }
  179. if (csn) {
  180. *csn = opcsn;
  181. }
  182. return idstr;
  183. }
  184. /* preop acquires csn generator handle */
  185. int repl5_is_betxn = 0;
  186. int
  187. multimaster_preop_init( Slapi_PBlock *pb )
  188. {
  189. int rc= 0; /* OK */
  190. if( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  191. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterpreopdesc ) != 0 ||
  192. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_BIND_FN, (void *) multimaster_preop_bind ) != 0 ||
  193. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_ADD_FN, (void *) multimaster_preop_add ) != 0 ||
  194. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_DELETE_FN, (void *) multimaster_preop_delete ) != 0 ||
  195. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_MODIFY_FN, (void *) multimaster_preop_modify ) != 0 ||
  196. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_MODRDN_FN, (void *) multimaster_preop_modrdn ) != 0 ||
  197. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_SEARCH_FN, (void *) multimaster_preop_search ) != 0 ||
  198. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_COMPARE_FN, (void *) multimaster_preop_compare ) != 0 ||
  199. slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_ENTRY_FN, (void *) multimaster_ruv_search ) != 0)
  200. {
  201. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_preop_init failed\n" );
  202. rc= -1;
  203. }
  204. return rc;
  205. }
  206. /* process_postop (core op of post op) frees CSN,
  207. * which should be called after betxn is finieshed. */
  208. int
  209. multimaster_postop_init( Slapi_PBlock *pb )
  210. {
  211. int rc= 0; /* OK */
  212. if( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  213. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterpostopdesc ) != 0 ||
  214. slapi_pblock_set( pb, SLAPI_PLUGIN_POST_BIND_FN, (void *) multimaster_postop_bind ) != 0 ||
  215. slapi_pblock_set( pb, SLAPI_PLUGIN_POST_ADD_FN, (void *) multimaster_postop_add ) != 0 ||
  216. slapi_pblock_set( pb, SLAPI_PLUGIN_POST_DELETE_FN, (void *) multimaster_postop_delete ) != 0 ||
  217. slapi_pblock_set( pb, SLAPI_PLUGIN_POST_MODIFY_FN, (void *) multimaster_postop_modify ) != 0 ||
  218. slapi_pblock_set( pb, SLAPI_PLUGIN_POST_MODRDN_FN, (void *) multimaster_postop_modrdn ) != 0 )
  219. {
  220. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_postop_init failed\n" );
  221. rc= -1;
  222. }
  223. return rc;
  224. }
  225. int
  226. multimaster_internalpreop_init( Slapi_PBlock *pb )
  227. {
  228. int rc= 0; /* OK */
  229. if( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  230. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterinternalpreopdesc ) != 0 ||
  231. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN, (void *) multimaster_preop_add ) != 0 ||
  232. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN, (void *) multimaster_preop_delete ) != 0 ||
  233. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN, (void *) multimaster_preop_modify ) != 0 ||
  234. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN, (void *) multimaster_preop_modrdn ) != 0 )
  235. {
  236. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_internalpreop_init failed\n" );
  237. rc= -1;
  238. }
  239. return rc;
  240. }
  241. int
  242. multimaster_internalpostop_init( Slapi_PBlock *pb )
  243. {
  244. int rc= 0; /* OK */
  245. if( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  246. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterinternalpostopdesc ) != 0 ||
  247. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_POST_ADD_FN, (void *) multimaster_postop_add ) != 0 ||
  248. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN, (void *) multimaster_postop_delete ) != 0 ||
  249. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN, (void *) multimaster_postop_modify ) != 0 ||
  250. slapi_pblock_set( pb, SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN, (void *) multimaster_postop_modrdn ) != 0 )
  251. {
  252. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_internalpostop_init failed\n" );
  253. rc= -1;
  254. }
  255. return rc;
  256. }
  257. /*
  258. * bepreop: setting SLAPI_TXN_RUV_MODS_FN, cleanup old stateinfo.
  259. * If betxn is off, preop urp is called here, too.
  260. */
  261. int
  262. multimaster_bepreop_init( Slapi_PBlock *pb )
  263. {
  264. int rc= 0; /* OK */
  265. if( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  266. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterbepreopdesc ) != 0 ||
  267. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_PRE_ADD_FN, (void *) multimaster_bepreop_add ) != 0 ||
  268. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_PRE_DELETE_FN, (void *) multimaster_bepreop_delete ) != 0 ||
  269. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_PRE_MODIFY_FN, (void *) multimaster_bepreop_modify ) != 0 ||
  270. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_PRE_MODRDN_FN, (void *) multimaster_bepreop_modrdn ) != 0 ||
  271. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_PRE_CLOSE_FN, (void *) cl5Close ) != 0 ||
  272. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_PRE_BACKUP_FN, (void *) cl5WriteRUV ) != 0 )
  273. {
  274. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_bepreop_init failed\n" );
  275. rc= -1;
  276. }
  277. return rc;
  278. }
  279. /*
  280. * betxnpreop: if betxn is on, call preop urp at betxnpreop.
  281. */
  282. int
  283. multimaster_betxnpreop_init( Slapi_PBlock *pb )
  284. {
  285. int rc= 0; /* OK */
  286. return rc;
  287. }
  288. /*
  289. * This bepostop_init is registered only if plugintype is NOT betxn.
  290. * if plugintype is betxn, callbacks are set in each multimaster_betxnpostop
  291. * function.
  292. */
  293. int
  294. multimaster_bepostop_init( Slapi_PBlock *pb )
  295. {
  296. int rc= 0; /* OK */
  297. if( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  298. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterbepostopdesc ) != 0 ||
  299. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_POST_MODRDN_FN, (void *) multimaster_bepostop_modrdn ) != 0 ||
  300. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_POST_DELETE_FN, (void *) multimaster_bepostop_delete ) != 0 ||
  301. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_POST_OPEN_FN, (void *) changelog5_init ) != 0 ||
  302. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_POST_BACKUP_FN, (void *) cl5DeleteRUV ) != 0 )
  303. {
  304. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_bepostop_init failed\n" );
  305. rc= -1;
  306. }
  307. return rc;
  308. }
  309. /*
  310. * This betxn_bepostop_init is registered only if plugintype is betxn.
  311. * Note: other callbacks (add/delete/modify/modrdn) are set in each
  312. * multimaster_betxnpostop function.
  313. */
  314. int
  315. multimaster_betxn_bepostop_init( Slapi_PBlock *pb )
  316. {
  317. int rc= 0; /* OK */
  318. if( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) ||
  319. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterbepostopdesc ) ||
  320. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_POST_OPEN_FN, (void *) changelog5_init ) ||
  321. slapi_pblock_set( pb, SLAPI_PLUGIN_BE_POST_BACKUP_FN, (void *) cl5DeleteRUV ) )
  322. {
  323. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_betxn_bepostop_init failed\n" );
  324. rc= -1;
  325. }
  326. return rc;
  327. }
  328. int
  329. multimaster_betxnpostop_init( Slapi_PBlock *pb )
  330. {
  331. int rc = 0; /* OK */
  332. void *add_fn;
  333. void *del_fn;
  334. void *mod_fn;
  335. void *mdn_fn;
  336. if (repl5_is_betxn) {
  337. add_fn = multimaster_be_betxnpostop_add;
  338. del_fn = multimaster_be_betxnpostop_delete;
  339. mod_fn = multimaster_be_betxnpostop_modify;
  340. mdn_fn = multimaster_be_betxnpostop_modrdn;
  341. } else {
  342. add_fn = multimaster_betxnpostop_add;
  343. del_fn = multimaster_betxnpostop_delete;
  344. mod_fn = multimaster_betxnpostop_modify;
  345. mdn_fn = multimaster_betxnpostop_modrdn;
  346. }
  347. if (slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01) ||
  348. slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION,
  349. (void *)&multimasterbetxnpostopdesc) ||
  350. slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_ADD_FN, add_fn) ||
  351. slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_DELETE_FN, del_fn) ||
  352. slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN, mdn_fn) ||
  353. slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN, mod_fn)) {
  354. slapi_log_error(SLAPI_LOG_PLUGIN, repl_plugin_name,
  355. "multimaster_betxnpostop_init failed\n");
  356. rc = -1;
  357. }
  358. return rc;
  359. }
  360. int
  361. multimaster_start_extop_init( Slapi_PBlock *pb )
  362. {
  363. int rc= 0; /* OK */
  364. if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  365. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  366. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)start_oid_list ) != 0 ||
  367. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)start_name_list ) != 0 ||
  368. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)multimaster_extop_StartNSDS50ReplicationRequest ))
  369. {
  370. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_start_extop_init (StartNSDS50ReplicationRequest) failed\n" );
  371. rc= -1;
  372. }
  373. return rc;
  374. }
  375. int
  376. multimaster_end_extop_init( Slapi_PBlock *pb )
  377. {
  378. int rc= 0; /* OK */
  379. if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  380. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  381. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)end_oid_list ) != 0 ||
  382. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)end_name_list ) != 0 ||
  383. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)multimaster_extop_EndNSDS50ReplicationRequest ))
  384. {
  385. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_end_extop_init (EndNSDS50ReplicationRequest) failed\n" );
  386. rc= -1;
  387. }
  388. return rc;
  389. }
  390. int
  391. multimaster_cleanruv_maxcsn_extop_init( Slapi_PBlock *pb )
  392. {
  393. int rc= 0; /* OK */
  394. void *identity = NULL;
  395. /* get plugin identity and store it to pass to internal operations */
  396. slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
  397. PR_ASSERT (identity);
  398. if (slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  399. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  400. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)cleanruv_maxcsn_oid_list ) != 0 ||
  401. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)cleanruv_maxcsn_name_list ) != 0 ||
  402. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)multimaster_extop_cleanruv_get_maxcsn ))
  403. {
  404. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_cleanruv_extop_init failed\n" );
  405. rc= -1;
  406. }
  407. return rc;
  408. }
  409. int
  410. multimaster_cleanruv_status_extop_init( Slapi_PBlock *pb )
  411. {
  412. int rc= 0; /* OK */
  413. void *identity = NULL;
  414. /* get plugin identity and store it to pass to internal operations */
  415. slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
  416. PR_ASSERT (identity);
  417. if (slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  418. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  419. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)cleanruv_status_oid_list ) != 0 ||
  420. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)cleanruv_status_name_list ) != 0 ||
  421. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)multimaster_extop_cleanruv_check_status ))
  422. {
  423. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_cleanruv_extop_init failed\n" );
  424. rc= -1;
  425. }
  426. return rc;
  427. }
  428. int
  429. multimaster_total_extop_init( Slapi_PBlock *pb )
  430. {
  431. int rc= 0; /* OK */
  432. void *identity = NULL;
  433. /* get plugin identity and store it to pass to internal operations */
  434. slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
  435. PR_ASSERT (identity);
  436. if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  437. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  438. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)total_oid_list ) != 0 ||
  439. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)total_name_list ) != 0 ||
  440. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)multimaster_extop_NSDS50ReplicationEntry ))
  441. {
  442. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_start_extop_init (NSDS50ReplicationEntry failed\n" );
  443. rc= -1;
  444. }
  445. return rc;
  446. }
  447. int
  448. multimaster_response_extop_init( Slapi_PBlock *pb )
  449. {
  450. int rc= 0; /* OK */
  451. void *identity = NULL;
  452. /* get plugin identity and store it to pass to internal operations */
  453. slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
  454. PR_ASSERT (identity);
  455. if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  456. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  457. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)response_oid_list ) != 0 ||
  458. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)response_name_list ) != 0 ||
  459. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)extop_noop ))
  460. {
  461. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_start_extop_init (NSDS50ReplicationResponse failed\n" );
  462. rc= -1;
  463. }
  464. return rc;
  465. }
  466. int
  467. multimaster_cleanruv_extop_init( Slapi_PBlock *pb )
  468. {
  469. int rc= 0; /* OK */
  470. void *identity = NULL;
  471. /* get plugin identity and store it to pass to internal operations */
  472. slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
  473. PR_ASSERT (identity);
  474. if (slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  475. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  476. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)cleanruv_oid_list ) != 0 ||
  477. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)cleanruv_name_list ) != 0 ||
  478. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)multimaster_extop_cleanruv ))
  479. {
  480. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_cleanruv_extop_init failed\n" );
  481. rc= -1;
  482. }
  483. return rc;
  484. }
  485. int
  486. multimaster_cleanruv_abort_extop_init( Slapi_PBlock *pb )
  487. {
  488. int rc= 0; /* OK */
  489. void *identity = NULL;
  490. /* get plugin identity and store it to pass to internal operations */
  491. slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
  492. PR_ASSERT (identity);
  493. if (slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  494. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterextopdesc ) != 0 ||
  495. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_OIDLIST, (void *)cleanruv_abort_oid_list ) != 0 ||
  496. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_NAMELIST, (void *)cleanruv_abort_name_list ) != 0 ||
  497. slapi_pblock_set( pb, SLAPI_PLUGIN_EXT_OP_FN, (void *)multimaster_extop_abort_cleanruv ))
  498. {
  499. slapi_log_error( SLAPI_LOG_PLUGIN, repl_plugin_name, "multimaster_cleanruv_abort_extop_init failed\n" );
  500. rc= -1;
  501. }
  502. return rc;
  503. }
  504. static PRBool
  505. check_for_ldif_dump(Slapi_PBlock *pb)
  506. {
  507. int i;
  508. int argc;
  509. char **argv;
  510. PRBool return_value = PR_FALSE;
  511. slapi_pblock_get( pb, SLAPI_ARGC, &argc);
  512. slapi_pblock_get( pb, SLAPI_ARGV, &argv);
  513. for (i = 1; i < argc && !return_value; i++)
  514. {
  515. if (strcmp(argv[i], "db2ldif") == 0)
  516. {
  517. return_value = PR_TRUE;
  518. }
  519. }
  520. return return_value;
  521. }
  522. /*
  523. * If the entries do not exist, it create the entries of the schema replication policies
  524. * returns 0 if success
  525. */
  526. static int
  527. create_repl_schema_policy()
  528. {
  529. /* DN part of this entry_string: no need to be optimized. */
  530. char entry_string[1024];
  531. Slapi_PBlock *pb;
  532. Slapi_Entry *e ;
  533. int return_value;
  534. char *repl_schema_top, *repl_schema_supplier, *repl_schema_consumer;
  535. char *default_supplier_policy = NULL;
  536. char *default_consumer_policy = NULL;
  537. int rc = 0;
  538. slapi_schema_get_repl_entries(&repl_schema_top, &repl_schema_supplier, &repl_schema_consumer, &default_supplier_policy, &default_consumer_policy);
  539. /* Create cn=replSchema,cn=config */
  540. PR_snprintf(entry_string, sizeof(entry_string), "dn: %s\nobjectclass: top\nobjectclass: nsSchemaPolicy\ncn: replSchema\n", repl_schema_top);
  541. e = slapi_str2entry(entry_string, 0);
  542. pb = slapi_pblock_new();
  543. slapi_add_entry_internal_set_pb(pb, e, NULL, /* controls */
  544. repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION), 0 /* flags */);
  545. slapi_add_internal_pb(pb);
  546. slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &return_value);
  547. if (return_value != LDAP_SUCCESS && return_value != LDAP_ALREADY_EXISTS) {
  548. slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Warning: unable to "
  549. "create configuration entry %s: %s\n", repl_schema_top,
  550. ldap_err2string(return_value));
  551. rc = -1;
  552. slapi_entry_free (e); /* The entry was not consumed */
  553. goto done;
  554. }
  555. slapi_pblock_destroy(pb);
  556. /* Create cn=supplierUpdatePolicy,cn=replSchema,cn=config */
  557. PR_snprintf(entry_string, sizeof(entry_string), "dn: %s\nobjectclass: top\nobjectclass: nsSchemaPolicy\ncn: supplierUpdatePolicy\n%s",
  558. repl_schema_supplier,
  559. default_supplier_policy ? default_supplier_policy : "");
  560. e = slapi_str2entry(entry_string, 0);
  561. pb = slapi_pblock_new();
  562. slapi_add_entry_internal_set_pb(pb, e, NULL, /* controls */
  563. repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION), 0 /* flags */);
  564. slapi_add_internal_pb(pb);
  565. slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &return_value);
  566. if (return_value != LDAP_SUCCESS && return_value != LDAP_ALREADY_EXISTS) {
  567. slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Warning: unable to "
  568. "create configuration entry %s: %s\n", repl_schema_supplier,
  569. ldap_err2string(return_value));
  570. rc = -1;
  571. slapi_entry_free(e); /* The entry was not consumed */
  572. goto done;
  573. }
  574. slapi_pblock_destroy(pb);
  575. /* Create cn=consumerUpdatePolicy,cn=replSchema,cn=config */
  576. PR_snprintf(entry_string, sizeof(entry_string), "dn: %s\nobjectclass: top\nobjectclass: nsSchemaPolicy\ncn: consumerUpdatePolicy\n%s",
  577. repl_schema_consumer,
  578. default_consumer_policy ? default_consumer_policy : "");
  579. e = slapi_str2entry(entry_string, 0);
  580. pb = slapi_pblock_new();
  581. slapi_add_entry_internal_set_pb(pb, e, NULL, /* controls */
  582. repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION), 0 /* flags */);
  583. slapi_add_internal_pb(pb);
  584. slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &return_value);
  585. if (return_value != LDAP_SUCCESS && return_value != LDAP_ALREADY_EXISTS) {
  586. slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Warning: unable to "
  587. "create configuration entry %s: %s\n", repl_schema_consumer,
  588. ldap_err2string(return_value));
  589. rc = -1;
  590. slapi_entry_free(e); /* The entry was not consumed */
  591. goto done;
  592. }
  593. slapi_pblock_destroy(pb);
  594. pb = NULL;
  595. /* Load the policies of the schema replication */
  596. if (slapi_schema_load_repl_policies()) {
  597. slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Warning: unable to "
  598. "load the schema replication policies\n");
  599. rc = -1;
  600. goto done;
  601. }
  602. done:
  603. if (pb) {
  604. slapi_pblock_destroy(pb);
  605. pb = NULL;
  606. }
  607. return rc;
  608. }
  609. static PRBool is_ldif_dump = PR_FALSE;
  610. PRBool
  611. ldif_dump_is_running()
  612. {
  613. return is_ldif_dump;
  614. }
  615. int
  616. multimaster_start( Slapi_PBlock *pb )
  617. {
  618. int rc= 0; /* OK */
  619. if (!multimaster_started_flag)
  620. {
  621. /* Get any registered replication session API */
  622. repl_session_plugin_init();
  623. /* Initialize thread private data for logging. Ignore if fails */
  624. PR_NewThreadPrivateIndex (&thread_private_agmtname, NULL);
  625. PR_NewThreadPrivateIndex (&thread_private_cache, NULL);
  626. /* Decode the command line args to see if we're dumping to LDIF */
  627. is_ldif_dump = check_for_ldif_dump(pb);
  628. /* allow online replica configuration */
  629. rc = replica_config_init ();
  630. if (rc != 0)
  631. goto out;
  632. slapi_register_supported_control(REPL_NSDS50_UPDATE_INFO_CONTROL_OID,
  633. SLAPI_OPERATION_ADD | SLAPI_OPERATION_DELETE |
  634. SLAPI_OPERATION_MODIFY | SLAPI_OPERATION_MODDN);
  635. /* Stash away our partial URL, used in RUVs */
  636. rc = multimaster_set_local_purl();
  637. if (rc != 0)
  638. goto out;
  639. /* Initialise support for cn=monitor */
  640. rc = repl_monitor_init();
  641. if (rc != 0)
  642. goto out;
  643. /* initialize name hash */
  644. rc = replica_init_name_hash ();
  645. if (rc != 0)
  646. goto out;
  647. /* initialize dn hash */
  648. rc = replica_init_dn_hash ();
  649. if (rc != 0)
  650. goto out;
  651. /* create replicas */
  652. multimaster_mtnode_construct_replicas ();
  653. /* Initialise the 5.0 Changelog */
  654. rc = changelog5_init();
  655. if (rc != 0)
  656. goto out;
  657. /* Initialize the replication agreements, unless we're dumping LDIF */
  658. if (!is_ldif_dump)
  659. {
  660. rc = agmtlist_config_init();
  661. if (rc != 0)
  662. goto out;
  663. }
  664. rc = create_repl_schema_policy();
  665. if (rc != 0)
  666. goto out;
  667. /* check if the replica's data was reloaded offline and we need
  668. to reinitialize replica's changelog. This should be done
  669. after the changelog is initialized */
  670. replica_enumerate_replicas (replica_check_for_data_reload, NULL);
  671. /* register to be notified when backend state changes */
  672. slapi_register_backend_state_change((void *)multimaster_be_state_change,
  673. multimaster_be_state_change);
  674. multimaster_started_flag = 1;
  675. multimaster_stopped_flag = 0;
  676. }
  677. out:
  678. return rc;
  679. }
  680. int
  681. multimaster_stop( Slapi_PBlock *pb )
  682. {
  683. int rc= 0; /* OK */
  684. if (!multimaster_stopped_flag)
  685. {
  686. if (!is_ldif_dump)
  687. {
  688. /* Shut down replication agreements */
  689. agmtlist_shutdown();
  690. }
  691. /* if we are cleaning a ruv, stop */
  692. stop_ruv_cleaning();
  693. /* unregister backend state change notification */
  694. slapi_unregister_backend_state_change((void *)multimaster_be_state_change);
  695. changelog5_cleanup(); /* Shut down the changelog */
  696. multimaster_mtnode_extension_destroy(); /* Destroy mapping tree node exts */
  697. replica_destroy_name_hash(); /* destroy the hash and its remaining content */
  698. replica_config_destroy (); /* Destroy replica config info */
  699. multimaster_stopped_flag = 1;
  700. }
  701. return rc;
  702. }
  703. PRBool
  704. multimaster_started()
  705. {
  706. return(multimaster_started_flag != 0);
  707. }
  708. /*
  709. * Initialize the multimaster replication plugin.
  710. */
  711. int replication_multimaster_plugin_init(Slapi_PBlock *pb)
  712. {
  713. static int multimaster_initialised= 0;
  714. int rc= 0; /* OK */
  715. void *identity = NULL;
  716. Slapi_Entry *plugin_entry = NULL;
  717. slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
  718. PR_ASSERT (identity);
  719. repl_set_plugin_identity (PLUGIN_MULTIMASTER_REPLICATION, identity);
  720. /* need the repl plugin path for the chain on update function */
  721. /* slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &entry);
  722. PR_ASSERT(entry);
  723. path = slapi_entry_attr_get_charptr(entry, "nsslapd-pluginpath");
  724. repl_set_repl_plugin_path(path);
  725. slapi_ch_free_string(&path);
  726. */
  727. multimaster_mtnode_extension_init ();
  728. if ((slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &plugin_entry) == 0) &&
  729. plugin_entry) {
  730. repl5_is_betxn = slapi_entry_attr_get_bool(plugin_entry,
  731. "nsslapd-pluginbetxn");
  732. }
  733. if(!multimaster_initialised)
  734. {
  735. /* Initialize extensions */
  736. repl_con_init_ext();
  737. repl_sup_init_ext();
  738. rc= slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 );
  739. rc= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&multimasterdesc );
  740. rc= slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN, (void *) multimaster_start );
  741. rc= slapi_pblock_set( pb, SLAPI_PLUGIN_CLOSE_FN, (void *) multimaster_stop );
  742. /* Register the plugin interfaces we implement */
  743. /* preop acquires csn generator handle */
  744. rc = slapi_register_plugin("preoperation", 1 /* Enabled */,
  745. "multimaster_preop_init",
  746. multimaster_preop_init,
  747. "Multimaster replication preoperation plugin",
  748. NULL, identity);
  749. /* bepreop: setting SLAPI_TXN_RUV_MODS_FN and cleanup old stateinfo
  750. * -- should be done before transaction */
  751. /* if betxn is off, urp is called at bepreop. */
  752. rc = slapi_register_plugin("bepreoperation", 1 /* Enabled */,
  753. "multimaster_bepreop_init",
  754. multimaster_bepreop_init,
  755. "Multimaster replication bepreoperation plugin",
  756. NULL, identity);
  757. /* is_betxn: be post ops (add/del/mod/mdn) are combined into betxn ops.
  758. * no betxn: be post ops are regsitered at bepostoperation. */
  759. rc = slapi_register_plugin("betxnpostoperation", 1 /* Enabled */,
  760. "multimaster_betxnpostop_init",
  761. multimaster_betxnpostop_init,
  762. "Multimaster replication betxnpostoperation plugin",
  763. NULL, identity);
  764. if (repl5_is_betxn) {
  765. /* if betxn is on, urp is called at betxnpreop. */
  766. rc = slapi_register_plugin("betxnpreoperation", 1 /* Enabled */,
  767. "multimaster_betxnpreop_init",
  768. multimaster_betxnpreop_init,
  769. "Multimaster replication betxnpreoperation plugin",
  770. NULL, identity);
  771. /* bepostop configures open and backup only (no betxn) */
  772. rc = slapi_register_plugin("bepostoperation", 1 /* Enabled */,
  773. "multimaster_betxn_bepostop_init",
  774. multimaster_betxn_bepostop_init,
  775. "Multimaster replication bepostoperation plugin",
  776. NULL, identity);
  777. } else {
  778. /* bepostop configures open and backup only as well as add/del/
  779. * mod/mdn bepost ops */
  780. rc = slapi_register_plugin("bepostoperation", 1 /* Enabled */,
  781. "multimaster_bepostop_init",
  782. multimaster_bepostop_init,
  783. "Multimaster replication bepostoperation2 plugin",
  784. NULL, identity);
  785. }
  786. /* process_postop (core op of post op) frees CSN,
  787. * which should wait until betxn is done. */
  788. rc = slapi_register_plugin("postoperation", 1 /* Enabled */,
  789. "multimaster_postop_init",
  790. multimaster_postop_init,
  791. "Multimaster replication postoperation plugin",
  792. NULL, identity);
  793. rc = slapi_register_plugin("internalpreoperation", 1 /* Enabled */,
  794. "multimaster_internalpreop_init",
  795. multimaster_internalpreop_init,
  796. "Multimaster replication internal preoperation plugin",
  797. NULL, identity);
  798. rc = slapi_register_plugin("internalpostoperation", 1 /* Enabled */,
  799. "multimaster_internalpostop_init",
  800. multimaster_internalpostop_init,
  801. "Multimaster replication internal postoperation plugin",
  802. NULL, identity);
  803. rc = slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_start_extop_init", multimaster_start_extop_init, "Multimaster replication start extended operation plugin", NULL, identity);
  804. rc= slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_end_extop_init", multimaster_end_extop_init, "Multimaster replication end extended operation plugin", NULL, identity);
  805. rc= slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_total_extop_init", multimaster_total_extop_init, "Multimaster replication total update extended operation plugin", NULL, identity);
  806. rc= slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_response_extop_init", multimaster_response_extop_init, "Multimaster replication extended response plugin", NULL, identity);
  807. rc= slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_cleanruv_extop_init", multimaster_cleanruv_extop_init, "Multimaster replication cleanruv extended operation plugin", NULL, identity);
  808. rc= slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_cleanruv_abort_extop_init", multimaster_cleanruv_abort_extop_init, "Multimaster replication cleanruv abort extended operation plugin", NULL, identity);
  809. rc= slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_cleanruv_maxcsn_extop_init", multimaster_cleanruv_maxcsn_extop_init, "Multimaster replication cleanruv maxcsn extended operation plugin", NULL, identity);
  810. rc= slapi_register_plugin("extendedop", 1 /* Enabled */, "multimaster_cleanruv_status_extop_init", multimaster_cleanruv_status_extop_init, "Multimaster replication cleanruv status extended operation plugin", NULL, identity);
  811. if (0 == rc)
  812. {
  813. multimaster_initialised = 1;
  814. }
  815. }
  816. return rc;
  817. }