winsync-plugin.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  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) 2008 Red Hat, Inc.
  35. * All rights reserved.
  36. * END COPYRIGHT BLOCK **/
  37. #ifndef WINSYNC_PLUGIN_PUBLIC_API
  38. #define WINSYNC_PLUGIN_PUBLIC_API
  39. #ifdef HAVE_CONFIG_H
  40. # include <config.h>
  41. #endif
  42. /* windows_private.c */
  43. #include "slapi-plugin.h"
  44. /*
  45. * WinSync plug-in API
  46. */
  47. #define WINSYNC_v1_0_GUID "CDA8F029-A3C6-4EBB-80B8-A2E183DB0481"
  48. #define WINSYNC_v2_0_GUID "706B83AA-FC51-444A-ACC9-53DC73D641D4"
  49. /*
  50. * This callback is called when a winsync agreement is created.
  51. * The ds_subtree and ad_subtree from the agreement are read-only.
  52. * The callback can allocate some private data to return. If so
  53. * the callback must define a winsync_plugin_destroy_agmt_cb so
  54. * that the private data can be freed. This private data is passed
  55. * to every other callback function as the void *cookie argument.
  56. */
  57. typedef void * (*winsync_plugin_init_cb)(const Slapi_DN *ds_subtree, const Slapi_DN *ad_subtree);
  58. #define WINSYNC_PLUGIN_INIT_CB 1
  59. #define WINSYNC_PLUGIN_VERSION_1_BEGIN WINSYNC_PLUGIN_INIT_CB
  60. /* agmt_dn - const - the original AD base dn from the winsync agreement
  61. scope - set directly e.g. *scope = 42;
  62. base, filter - malloced - to set, free first e.g.
  63. slapi_ch_free_string(filter);
  64. *base = slapi_ch_strdup("(objectclass=foobar)");
  65. winsync code will use slapi_ch_free_string to free this value, so no static strings
  66. attrs - NULL or null terminated array of strings - can use slapi_ch_array_add to add e.g.
  67. slapi_ch_array_add(attrs, slapi_ch_strdup("myattr"));
  68. attrs will be freed with slapi_ch_array_free, so caller must own the memory
  69. serverctrls - NULL or null terminated array of LDAPControl* - can use slapi_add_control_ext to add
  70. slapi_add_control_ext(serverctrls, mynewctrl, 1 / add a copy /);
  71. serverctrls will be freed with ldap_controls_free, so caller must own memory
  72. */
  73. typedef void (*winsync_search_params_cb)(void *cookie, const char *agmt_dn, char **base, int *scope, char **filter, char ***attrs, LDAPControl ***serverctrls);
  74. #define WINSYNC_PLUGIN_DIRSYNC_SEARCH_CB 2 /* serverctrls will already contain the DirSync control */
  75. #define WINSYNC_PLUGIN_PRE_AD_SEARCH_CB 3
  76. #define WINSYNC_PLUGIN_PRE_DS_SEARCH_ENTRY_CB 4
  77. #define WINSYNC_PLUGIN_PRE_DS_SEARCH_ALL_CB 5
  78. /*
  79. * These callbacks are the main entry points that allow the plugin
  80. * to intercept modifications to local and remote entries.
  81. * rawentry - the raw AD entry, read directly from AD - this is read only
  82. * ad_entry - the "cooked" AD entry - the DN in this entry should be set
  83. * when the operation is to modify the AD entry
  84. * ds_entry - the entry from the ds - the DN in this entry should be set
  85. * when the operation is to modify the DS entry
  86. * smods - the post-processing modifications - these should be modified
  87. * by the plugin as needed
  88. * do_modify - if the code has some modifications that need to be applied, this
  89. * will be set to true - if the plugin has added some items to smods
  90. * this should be set to true - if the plugin has removed all of
  91. * the smods, and no operation should be performed, this should
  92. * be set to false
  93. */
  94. typedef void (*winsync_pre_mod_cb)(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, Slapi_Mods *smods, int *do_modify);
  95. #define WINSYNC_PLUGIN_PRE_AD_MOD_USER_CB 6
  96. #define WINSYNC_PLUGIN_PRE_AD_MOD_GROUP_CB 7
  97. #define WINSYNC_PLUGIN_PRE_DS_MOD_USER_CB 8
  98. #define WINSYNC_PLUGIN_PRE_DS_MOD_GROUP_CB 9
  99. /*
  100. * These callbacks are called when a new entry is being added to the
  101. * local directory server from AD.
  102. * rawentry - the raw AD entry, read directly from AD - this is read only
  103. * ad_entry - the "cooked" AD entry
  104. * ds_entry - the entry to be added to the DS - all modifications should
  105. * be made to this entry, including changing the DN if needed,
  106. * since the DN of this entry will be used as the ADD target DN
  107. * This entry will already have had the default schema mapping applied
  108. */
  109. typedef void (*winsync_pre_add_cb)(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry);
  110. #define WINSYNC_PLUGIN_PRE_DS_ADD_USER_CB 10
  111. #define WINSYNC_PLUGIN_PRE_DS_ADD_GROUP_CB 11
  112. /*
  113. * If a new entry has been added to AD, and we're sync'ing it over
  114. * to the DS, we may need to create a new DN for the entry. The
  115. * code tries to come up with a reasonable DN, but the plugin may
  116. * have different ideas. These callbacks allow the plugin to specify
  117. * what the new DN for the new entry should be. This is called from
  118. * map_entry_dn_inbound which is called from various places where the DN for
  119. * the new entry is needed. The winsync_plugin_call_pre_ds_add_* callbacks
  120. * can also be used to set the DN just before the entry is stored in the DS.
  121. * This is also used when we are mapping a dn valued attribute e.g. owner
  122. * or secretary
  123. * rawentry - the raw AD entry, read directly from AD - this is read only
  124. * ad_entry - the "cooked" AD entry
  125. * new_dn_string - the given value will be the default value created by the sync code
  126. * to change it, slapi_ch_free_string first, then malloc the value to use
  127. * ds_suffix - the suffix from the DS side of the sync agreement
  128. * ad_suffix - the suffix from the AD side of the sync agreement
  129. */
  130. typedef void (*winsync_get_new_dn_cb)(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, char **new_dn_string,
  131. const Slapi_DN *ds_suffix, const Slapi_DN *ad_suffix);
  132. #define WINSYNC_PLUGIN_GET_NEW_DS_USER_DN_CB 12
  133. #define WINSYNC_PLUGIN_GET_NEW_DS_GROUP_DN_CB 13
  134. /*
  135. * These callbacks are called when a mod operation is going to be replayed
  136. * to AD. This case is different than the pre add or pre mod callbacks
  137. * above because in this context, we may only have the list of modifications
  138. * and the DN to which the mods were applied.
  139. * rawentry - the raw AD entry, read directly from AD - may be NULL
  140. * local_dn - the original local DN used in the modification
  141. * ds_entry - the current DS entry that has the operation nsUniqueID
  142. * origmods - the original mod list
  143. * remote_dn - this is the DN which will be used with the remote modify operation
  144. * to AD - the winsync code may have already attempted to calculate its value
  145. * modstosend - this is the list of modifications which will be sent - the winsync
  146. * code will already have done its default mapping to these values
  147. *
  148. */
  149. typedef void (*winsync_pre_ad_mod_mods_cb)(void *cookie, const Slapi_Entry *rawentry, const Slapi_DN *local_dn, const Slapi_Entry *ds_entry, LDAPMod * const *origmods, Slapi_DN *remote_dn, LDAPMod ***modstosend);
  150. #define WINSYNC_PLUGIN_PRE_AD_MOD_USER_MODS_CB 14
  151. #define WINSYNC_PLUGIN_PRE_AD_MOD_GROUP_MODS_CB 15
  152. /*
  153. * Callbacks used to determine if an entry should be added to the
  154. * AD side if it does not already exist.
  155. * local_entry - the candidate entry to test
  156. * remote_DN - the candidate remote entry to add
  157. */
  158. typedef int (*winsync_can_add_to_ad_cb)(void *cookie, const Slapi_Entry *local_entry, const Slapi_DN *remote_dn);
  159. #define WINSYNC_PLUGIN_CAN_ADD_ENTRY_TO_AD_CB 16
  160. /*
  161. * Callbacks called at begin and end of update
  162. *
  163. * The ds subtree and the ad subtree from the sync agreement are passed in.
  164. * These are read only.
  165. * is_total will be true if this is a total update, or false if this
  166. * is an incremental update
  167. */
  168. typedef void (*winsync_plugin_update_cb)(void *cookie, const Slapi_DN *ds_subtree, const Slapi_DN *ad_subtree, int is_total);
  169. #define WINSYNC_PLUGIN_BEGIN_UPDATE_CB 17
  170. #define WINSYNC_PLUGIN_END_UPDATE_CB 18
  171. /*
  172. * Callbacks called when the agreement is destroyed.
  173. *
  174. * The ds subtree and the ad subtree from the sync agreement are passed in.
  175. * These are read only.
  176. * The plugin must define this function to free the cookie allocated
  177. * in the init function, if any.
  178. */
  179. typedef void (*winsync_plugin_destroy_agmt_cb)(void *cookie, const Slapi_DN *ds_subtree, const Slapi_DN *ad_subtree);
  180. #define WINSYNC_PLUGIN_DESTROY_AGMT_CB 19
  181. #define WINSYNC_PLUGIN_VERSION_1_END WINSYNC_PLUGIN_DESTROY_AGMT_CB
  182. /* Functions added for API version 2.0 */
  183. /*
  184. * These callbacks are called after a modify operation. They are called upon both
  185. * success and failure of the modify operation. The plugin is responsible for
  186. * looking at the result code of the modify to decide what action to take. The
  187. * plugin may change the result code e.g. to force an error for an otherwise
  188. * successful operation, or to ignore certain errors.
  189. * rawentry - the raw AD entry, read directly from AD - this is read only
  190. * ad_entry - the "cooked" AD entry - the entry passed to the pre_mod callback
  191. * ds_entry - the entry from the ds - the DS entry passed to the pre_mod callback
  192. * smods - the mods used in the modify operation
  193. * result - the result code from the modify operation - the plugin can change this
  194. */
  195. typedef void (*winsync_post_mod_cb)(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, Slapi_Mods *smods, int *result);
  196. #define WINSYNC_PLUGIN_POST_AD_MOD_USER_CB 20
  197. #define WINSYNC_PLUGIN_POST_AD_MOD_GROUP_CB 21
  198. #define WINSYNC_PLUGIN_POST_DS_MOD_USER_CB 22
  199. #define WINSYNC_PLUGIN_POST_DS_MOD_GROUP_CB 23
  200. #define WINSYNC_PLUGIN_VERSION_2_BEGIN WINSYNC_PLUGIN_POST_AD_MOD_USER_CB
  201. /*
  202. * These callbacks are called after an attempt to add a new entry to the
  203. * local directory server from AD. They are called upon success or failure
  204. * of the add attempt. The result code tells if the operation succeeded.
  205. * The plugin may change the result code e.g. to force an error for an
  206. * otherwise successful operation, or to ignore certain errors.
  207. * rawentry - the raw AD entry, read directly from AD - this is read only
  208. * ad_entry - the "cooked" AD entry
  209. * ds_entry - the entry attempted to be added to the DS
  210. * result - the result code from the add operation - plugin may change this
  211. */
  212. typedef void (*winsync_post_add_cb)(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, int *result);
  213. #define WINSYNC_PLUGIN_POST_DS_ADD_USER_CB 24
  214. #define WINSYNC_PLUGIN_POST_DS_ADD_GROUP_CB 25
  215. /*
  216. * These callbacks are called when a new entry is being added to AD from
  217. * the local directory server.
  218. * ds_entry - the local DS entry
  219. * ad_entry - the entry to be added to AD - all modifications should
  220. * be made to this entry, including changing the DN if needed,
  221. * since the DN of this entry will be used as the ADD target DN
  222. * This entry will already have had the default schema mapping applied
  223. */
  224. typedef void (*winsync_pre_ad_add_cb)(void *cookie, Slapi_Entry *ds_entry, Slapi_Entry *ad_entry);
  225. #define WINSYNC_PLUGIN_PRE_AD_ADD_USER_CB 26
  226. #define WINSYNC_PLUGIN_PRE_AD_ADD_GROUP_CB 27
  227. /*
  228. * These callbacks are called after an attempt to add a new entry to AD from
  229. * the local directory server. They are called upon success or failure
  230. * of the add attempt. The result code tells if the operation succeeded.
  231. * The plugin may change the result code e.g. to force an error for an
  232. * otherwise successful operation, or to ignore certain errors.
  233. * ad_entry - the AD entry
  234. * ds_entry - the DS entry
  235. * result - the result code from the add operation - plugin may change this
  236. */
  237. typedef void (*winsync_post_ad_add_cb)(void *cookie, Slapi_Entry *ds_entry, Slapi_Entry *ad_entry, int *result);
  238. #define WINSYNC_PLUGIN_POST_AD_ADD_USER_CB 28
  239. #define WINSYNC_PLUGIN_POST_AD_ADD_GROUP_CB 29
  240. /*
  241. * These callbacks are called after a mod operation has been replayed
  242. * to AD. This case is different than the pre add or pre mod callbacks
  243. * above because in this context, we may only have the list of modifications
  244. * and the DN to which the mods were applied. If the plugin wants the modified
  245. * entry, the plugin can search for it from AD. The plugin is called upon
  246. * success or failure of the modify operation. The result parameter gives
  247. * the ldap result code of the operation. The plugin may change the result code
  248. * e.g. to force an error for an otherwise successful operation, or to ignore
  249. * certain errors.
  250. * rawentry - the raw AD entry, read directly from AD - may be NULL
  251. * local_dn - the original local DN used in the modification
  252. * ds_entry - the current DS entry that has the operation nsUniqueID
  253. * origmods - the original mod list
  254. * remote_dn - the DN of the AD entry
  255. * modstosend - the mods sent to AD
  256. * result - the result code of the modify operation
  257. *
  258. */
  259. typedef void (*winsync_post_ad_mod_mods_cb)(void *cookie, const Slapi_Entry *rawentry, const Slapi_DN *local_dn, const Slapi_Entry *ds_entry, LDAPMod * const *origmods, Slapi_DN *remote_dn, LDAPMod **modstosend, int *result);
  260. #define WINSYNC_PLUGIN_POST_AD_MOD_USER_MODS_CB 30
  261. #define WINSYNC_PLUGIN_POST_AD_MOD_GROUP_MODS_CB 31
  262. #define WINSYNC_PLUGIN_VERSION_2_END WINSYNC_PLUGIN_POST_AD_MOD_GROUP_MODS_CB
  263. /*
  264. The following are sample code stubs to show how to implement
  265. a plugin which uses this api
  266. */
  267. /* #define WINSYNC_SAMPLE_CODE */
  268. #ifdef WINSYNC_SAMPLE_CODE
  269. #include "slapi-plugin.h"
  270. #include "winsync-plugin.h"
  271. static char *test_winsync_plugin_name = "test_winsync_api";
  272. static void *
  273. test_winsync_api_init(const Slapi_DN *ds_subtree, const Slapi_DN *ad_subtree)
  274. {
  275. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  276. "--> test_winsync_init [%s] [%s] -- begin\n",
  277. slapi_sdn_get_dn(ds_subtree),
  278. slapi_sdn_get_dn(ad_subtree));
  279. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  280. "<-- test_winsync_init -- end\n");
  281. return NULL;
  282. }
  283. static void
  284. test_winsync_dirsync_search_params_cb(void *cbdata, const char *agmt_dn,
  285. char **base, int *scope, char **filter,
  286. char ***attrs, LDAPControl ***serverctrls)
  287. {
  288. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  289. "--> test_winsync_dirsync_search_params_cb -- begin\n");
  290. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  291. "<-- test_winsync_dirsync_search_params_cb -- end\n");
  292. return;
  293. }
  294. /* called before searching for a single entry from AD - agmt_dn will be NULL */
  295. static void
  296. test_winsync_pre_ad_search_cb(void *cbdata, const char *agmt_dn,
  297. char **base, int *scope, char **filter,
  298. char ***attrs, LDAPControl ***serverctrls)
  299. {
  300. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  301. "--> test_winsync_pre_ad_search_cb -- begin\n");
  302. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  303. "<-- test_winsync_pre_ad_search_cb -- end\n");
  304. return;
  305. }
  306. /* called before an internal search to get a single DS entry - agmt_dn will be NULL */
  307. static void
  308. test_winsync_pre_ds_search_entry_cb(void *cbdata, const char *agmt_dn,
  309. char **base, int *scope, char **filter,
  310. char ***attrs, LDAPControl ***serverctrls)
  311. {
  312. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  313. "--> test_winsync_pre_ds_search_cb -- begin\n");
  314. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  315. "<-- test_winsync_pre_ds_search_cb -- end\n");
  316. return;
  317. }
  318. /* called before the total update to get all entries from the DS to sync to AD */
  319. static void
  320. test_winsync_pre_ds_search_all_cb(void *cbdata, const char *agmt_dn,
  321. char **base, int *scope, char **filter,
  322. char ***attrs, LDAPControl ***serverctrls)
  323. {
  324. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  325. "--> test_winsync_pre_ds_search_all_cb -- orig filter [%s] -- begin\n",
  326. ((filter && *filter) ? *filter : "NULL"));
  327. /* We only want to grab users from the ds side - no groups */
  328. slapi_ch_free_string(filter);
  329. /* maybe use ntUniqueId=* - only get users that have already been
  330. synced with AD already - ntUniqueId and ntUserDomainId are
  331. indexed for equality only - need to add presence? */
  332. *filter = slapi_ch_strdup("(&(objectclass=ntuser)(ntUserDomainId=*))");
  333. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  334. "<-- test_winsync_pre_ds_search_all_cb -- end\n");
  335. return;
  336. }
  337. static void
  338. test_winsync_pre_ad_mod_user_cb(void *cbdata, const Slapi_Entry *rawentry,
  339. Slapi_Entry *ad_entry, Slapi_Entry *ds_entry,
  340. Slapi_Mods *smods, int *do_modify)
  341. {
  342. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  343. "--> test_winsync_pre_ad_mod_user_cb -- begin\n");
  344. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  345. "<-- test_winsync_pre_ad_mod_user_cb -- end\n");
  346. return;
  347. }
  348. static void
  349. test_winsync_pre_ad_mod_group_cb(void *cbdata, const Slapi_Entry *rawentry,
  350. Slapi_Entry *ad_entry, Slapi_Entry *ds_entry,
  351. Slapi_Mods *smods, int *do_modify)
  352. {
  353. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  354. "--> test_winsync_pre_ad_mod_group_cb -- begin\n");
  355. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  356. "<-- test_winsync_pre_ad_mod_group_cb -- end\n");
  357. return;
  358. }
  359. static void
  360. test_winsync_pre_ds_mod_user_cb(void *cbdata, const Slapi_Entry *rawentry,
  361. Slapi_Entry *ad_entry, Slapi_Entry *ds_entry,
  362. Slapi_Mods *smods, int *do_modify)
  363. {
  364. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  365. "--> test_winsync_pre_ds_mod_user_cb -- begin\n");
  366. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  367. "<-- test_winsync_pre_ds_mod_user_cb -- end\n");
  368. return;
  369. }
  370. static void
  371. test_winsync_pre_ds_mod_group_cb(void *cbdata, const Slapi_Entry *rawentry,
  372. Slapi_Entry *ad_entry, Slapi_Entry *ds_entry,
  373. Slapi_Mods *smods, int *do_modify)
  374. {
  375. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  376. "--> test_winsync_pre_ds_mod_group_cb -- begin\n");
  377. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  378. "<-- test_winsync_pre_ds_mod_group_cb -- end\n");
  379. return;
  380. }
  381. static void
  382. test_winsync_pre_ds_add_user_cb(void *cbdata, const Slapi_Entry *rawentry,
  383. Slapi_Entry *ad_entry, Slapi_Entry *ds_entry)
  384. {
  385. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  386. "--> test_winsync_pre_ds_add_user_cb -- begin\n");
  387. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  388. "<-- test_winsync_pre_ds_add_user_cb -- end\n");
  389. return;
  390. }
  391. static void
  392. test_winsync_pre_ds_add_group_cb(void *cbdata, const Slapi_Entry *rawentry,
  393. Slapi_Entry *ad_entry, Slapi_Entry *ds_entry)
  394. {
  395. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  396. "--> test_winsync_pre_ds_add_group_cb -- begin\n");
  397. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  398. "<-- test_winsync_pre_ds_add_group_cb -- end\n");
  399. return;
  400. }
  401. static void
  402. test_winsync_get_new_ds_user_dn_cb(void *cbdata, const Slapi_Entry *rawentry,
  403. Slapi_Entry *ad_entry, char **new_dn_string,
  404. const Slapi_DN *ds_suffix, const Slapi_DN *ad_suffix)
  405. {
  406. char **rdns = NULL;
  407. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  408. "--> test_winsync_get_new_ds_user_dn_cb -- old dn [%s] -- begin\n",
  409. *new_dn_string);
  410. rdns = slapi_ldap_explode_dn(*new_dn_string, 0);
  411. if (!rdns || !rdns[0]) {
  412. slapi_ldap_value_free(rdns);
  413. return;
  414. }
  415. slapi_ch_free_string(new_dn_string);
  416. *new_dn_string = PR_smprintf("%s,%s", rdns[0], slapi_sdn_get_dn(ds_suffix));
  417. slapi_ldap_value_free(rdns);
  418. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  419. "<-- test_winsync_get_new_ds_user_dn_cb -- new dn [%s] -- end\n",
  420. *new_dn_string);
  421. return;
  422. }
  423. static void
  424. test_winsync_get_new_ds_group_dn_cb(void *cbdata, const Slapi_Entry *rawentry,
  425. Slapi_Entry *ad_entry, char **new_dn_string,
  426. const Slapi_DN *ds_suffix, const Slapi_DN *ad_suffix)
  427. {
  428. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  429. "--> test_winsync_get_new_ds_group_dn_cb -- begin\n");
  430. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  431. "<-- test_winsync_get_new_ds_group_dn_cb -- end\n");
  432. return;
  433. }
  434. static void
  435. test_winsync_pre_ad_mod_user_mods_cb(void *cbdata, const Slapi_Entry *rawentry,
  436. const Slapi_Entry *ds_entry,
  437. const Slapi_DN *local_dn, LDAPMod * const *origmods,
  438. Slapi_DN *remote_dn, LDAPMod ***modstosend)
  439. {
  440. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  441. "--> test_winsync_pre_ad_mod_user_mods_cb -- begin\n");
  442. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  443. "<-- test_winsync_pre_ad_mod_user_mods_cb -- end\n");
  444. return;
  445. }
  446. static void
  447. test_winsync_pre_ad_mod_group_mods_cb(void *cbdata, const Slapi_Entry *rawentry,
  448. const Slapi_Entry *ds_entry,
  449. const Slapi_DN *local_dn, LDAPMod * const *origmods,
  450. Slapi_DN *remote_dn, LDAPMod ***modstosend)
  451. {
  452. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  453. "--> test_winsync_pre_ad_mod_group_mods_cb -- begin\n");
  454. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  455. "<-- test_winsync_pre_ad_mod_group_mods_cb -- end\n");
  456. return;
  457. }
  458. static int
  459. test_winsync_can_add_entry_to_ad_cb(void *cbdata, const Slapi_Entry *local_entry,
  460. const Slapi_DN *remote_dn)
  461. {
  462. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  463. "--> test_winsync_can_add_entry_to_ad_cb -- begin\n");
  464. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  465. "<-- test_winsync_can_add_entry_to_ad_cb -- end\n");
  466. /* return 0;*/ /* false - do not allow entries to be added to ad */
  467. return 1; /* true - allow entries to be added to ad */
  468. }
  469. static void
  470. test_winsync_begin_update_cb(void *cbdata, const Slapi_DN *ds_subtree,
  471. const Slapi_DN *ad_subtree, int is_total)
  472. {
  473. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  474. "--> test_winsync_begin_update_cb -- begin\n");
  475. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  476. "<-- test_winsync_begin_update_cb -- end\n");
  477. return;
  478. }
  479. static void
  480. test_winsync_end_update_cb(void *cbdata, const Slapi_DN *ds_subtree,
  481. const Slapi_DN *ad_subtree, int is_total)
  482. {
  483. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  484. "--> test_winsync_end_update_cb -- begin\n");
  485. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  486. "<-- test_winsync_end_update_cb -- end\n");
  487. return;
  488. }
  489. static void
  490. test_winsync_destroy_agmt_cb(void *cbdata, const Slapi_DN *ds_subtree,
  491. const Slapi_DN *ad_subtree)
  492. {
  493. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  494. "--> test_winsync_destroy_agmt_cb -- begin\n");
  495. /* free(cbdata); */
  496. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  497. "<-- test_winsync_destroy_agmt_cb -- end\n");
  498. return;
  499. }
  500. static void
  501. test_winsync_post_ad_mod_user_cb(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, Slapi_Mods *smods, int *result)
  502. {
  503. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  504. "--> test_winsync_post_ad_mod_user_cb -- begin\n");
  505. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  506. "Result of modifying AD entry [%s] was [%d:%s]\n",
  507. slapi_entry_get_dn(ad_entry), *result, ldap_err2string(*result));
  508. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  509. "<-- test_winsync_post_ad_mod_user_cb -- end\n");
  510. return;
  511. }
  512. static void
  513. test_winsync_post_ad_mod_group_cb(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, Slapi_Mods *smods, int *result)
  514. {
  515. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  516. "--> test_winsync_post_ad_mod_group_cb -- begin\n");
  517. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  518. "Result of modifying AD entry [%s] was [%d:%s]\n",
  519. slapi_entry_get_dn(ad_entry), *result, ldap_err2string(*result));
  520. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  521. "<-- test_winsync_post_ad_mod_group_cb -- end\n");
  522. return;
  523. }
  524. static void
  525. test_winsync_post_ds_mod_user_cb(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, Slapi_Mods *smods, int *result)
  526. {
  527. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  528. "--> test_winsync_post_ds_mod_user_cb -- begin\n");
  529. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  530. "Result of modifying DS entry [%s] was [%d:%s]\n",
  531. slapi_entry_get_dn(ds_entry), *result, ldap_err2string(*result));
  532. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  533. "<-- test_winsync_post_ds_mod_user_cb -- end\n");
  534. return;
  535. }
  536. static void
  537. test_winsync_post_ds_mod_group_cb(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, Slapi_Mods *smods, int *result)
  538. {
  539. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  540. "--> test_winsync_post_ds_mod_group_cb -- begin\n");
  541. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  542. "Result of modifying DS entry [%s] was [%d:%s]\n",
  543. slapi_entry_get_dn(ds_entry), *result, ldap_err2string(*result));
  544. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  545. "<-- test_winsync_post_ds_mod_group_cb -- end\n");
  546. return;
  547. }
  548. static void
  549. test_winsync_post_ds_add_user_cb(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, int *result)
  550. {
  551. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  552. "--> test_winsync_post_ds_add_user_cb -- begin\n");
  553. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  554. "Result of adding DS entry [%s] was [%d:%s]\n",
  555. slapi_entry_get_dn(ds_entry), *result, ldap_err2string(*result));
  556. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  557. "<-- test_winsync_post_ds_add_user_cb -- end\n");
  558. return;
  559. }
  560. static void
  561. test_winsync_post_ds_add_group_cb(void *cookie, const Slapi_Entry *rawentry, Slapi_Entry *ad_entry, Slapi_Entry *ds_entry, int *result)
  562. {
  563. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  564. "--> test_winsync_post_ds_add_group_cb -- begin\n");
  565. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  566. "Result of adding DS entry [%s] was [%d:%s]\n",
  567. slapi_entry_get_dn(ds_entry), *result, ldap_err2string(*result));
  568. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  569. "<-- test_winsync_post_ds_add_group_cb -- end\n");
  570. return;
  571. }
  572. static void
  573. test_winsync_pre_ad_add_user_cb(void *cookie, Slapi_Entry *ds_entry, Slapi_Entry *ad_entry)
  574. {
  575. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  576. "--> test_winsync_pre_ad_add_user_cb -- begin\n");
  577. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  578. "Adding AD entry [%s] from add of DS entry [%s]\n",
  579. slapi_entry_get_dn(ad_entry), slapi_entry_get_dn(ds_entry));
  580. /* make modifications to ad_entry here */
  581. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  582. "<-- test_winsync_pre_ad_add_user_cb -- end\n");
  583. return;
  584. }
  585. static void
  586. test_winsync_pre_ad_add_group_cb(void *cookie, Slapi_Entry *ds_entry, Slapi_Entry *ad_entry)
  587. {
  588. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  589. "--> test_winsync_pre_ad_add_group_cb -- begin\n");
  590. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  591. "Adding AD entry [%s] from add of DS entry [%s]\n",
  592. slapi_entry_get_dn(ad_entry), slapi_entry_get_dn(ds_entry));
  593. /* make modifications to ad_entry here */
  594. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  595. "<-- test_winsync_pre_ad_add_group_cb -- end\n");
  596. return;
  597. }
  598. static void
  599. test_winsync_post_ad_add_user_cb(void *cookie, Slapi_Entry *ds_entry, Slapi_Entry *ad_entry, int *result)
  600. {
  601. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  602. "--> test_winsync_post_ad_add_user_cb -- begin\n");
  603. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  604. "Result of adding AD entry [%s] was [%d:%s]\n",
  605. slapi_entry_get_dn(ad_entry), *result, ldap_err2string(*result));
  606. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  607. "<-- test_winsync_post_ad_add_user_cb -- end\n");
  608. return;
  609. }
  610. static void
  611. test_winsync_post_ad_add_group_cb(void *cookie, Slapi_Entry *ds_entry, Slapi_Entry *ad_entry, int *result)
  612. {
  613. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  614. "--> test_winsync_post_ad_add_group_cb -- begin\n");
  615. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  616. "Result of adding AD entry [%s] was [%d:%s]\n",
  617. slapi_entry_get_dn(ad_entry), *result, ldap_err2string(*result));
  618. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  619. "<-- test_winsync_post_ad_add_group_cb -- end\n");
  620. return;
  621. }
  622. static void
  623. test_winsync_post_ad_mod_user_mods_cb(void *cookie, const Slapi_Entry *rawentry, const Slapi_DN *local_dn, const Slapi_Entry *ds_entry, LDAPMod * const *origmods, Slapi_DN *remote_dn, LDAPMod ***modstosend, int *result)
  624. {
  625. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  626. "--> test_winsync_post_ad_mod_user_mods_cb -- begin\n");
  627. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  628. "Result of modifying AD entry [%s] was [%d:%s]\n",
  629. slapi_sdn_get_dn(remote_dn), *result, ldap_err2string(*result));
  630. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  631. "<-- test_winsync_post_ad_mod_user_mods_cb -- end\n");
  632. return;
  633. }
  634. static void
  635. test_winsync_post_ad_mod_group_mods_cb(void *cookie, const Slapi_Entry *rawentry, const Slapi_DN *local_dn, const Slapi_Entry *ds_entry, LDAPMod * const *origmods, Slapi_DN *remote_dn, LDAPMod ***modstosend, int *result)
  636. {
  637. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  638. "--> test_winsync_post_ad_mod_group_mods_cb -- begin\n");
  639. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  640. "Result of modifying AD entry [%s] was [%d:%s]\n",
  641. slapi_sdn_get_dn(remote_dn), *result, ldap_err2string(*result));
  642. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  643. "<-- test_winsync_post_ad_mod_group_mods_cb -- end\n");
  644. return;
  645. }
  646. /**
  647. * Plugin identifiers
  648. */
  649. static Slapi_PluginDesc test_winsync_pdesc = {
  650. "test-winsync-plugin",
  651. VENDOR,
  652. DS_PACKAGE_VERSION,
  653. "test winsync plugin"
  654. };
  655. static Slapi_ComponentId *test_winsync_plugin_id = NULL;
  656. #ifdef TEST_V1_WINSYNC_API
  657. static void *test_winsync_api_v1[] = {
  658. NULL, /* reserved for api broker use, must be zero */
  659. test_winsync_api_init,
  660. test_winsync_dirsync_search_params_cb,
  661. test_winsync_pre_ad_search_cb,
  662. test_winsync_pre_ds_search_entry_cb,
  663. test_winsync_pre_ds_search_all_cb,
  664. test_winsync_pre_ad_mod_user_cb,
  665. test_winsync_pre_ad_mod_group_cb,
  666. test_winsync_pre_ds_mod_user_cb,
  667. test_winsync_pre_ds_mod_group_cb,
  668. test_winsync_pre_ds_add_user_cb,
  669. test_winsync_pre_ds_add_group_cb,
  670. test_winsync_get_new_ds_user_dn_cb,
  671. test_winsync_get_new_ds_group_dn_cb,
  672. test_winsync_pre_ad_mod_user_mods_cb,
  673. test_winsync_pre_ad_mod_group_mods_cb,
  674. test_winsync_can_add_entry_to_ad_cb,
  675. test_winsync_begin_update_cb,
  676. test_winsync_end_update_cb,
  677. test_winsync_destroy_agmt_cb
  678. };
  679. #endif /* TEST_V1_WINSYNC_API */
  680. static void *test_winsync_api_v2[] = {
  681. NULL, /* reserved for api broker use, must be zero */
  682. test_winsync_api_init,
  683. test_winsync_dirsync_search_params_cb,
  684. test_winsync_pre_ad_search_cb,
  685. test_winsync_pre_ds_search_entry_cb,
  686. test_winsync_pre_ds_search_all_cb,
  687. test_winsync_pre_ad_mod_user_cb,
  688. test_winsync_pre_ad_mod_group_cb,
  689. test_winsync_pre_ds_mod_user_cb,
  690. test_winsync_pre_ds_mod_group_cb,
  691. test_winsync_pre_ds_add_user_cb,
  692. test_winsync_pre_ds_add_group_cb,
  693. test_winsync_get_new_ds_user_dn_cb,
  694. test_winsync_get_new_ds_group_dn_cb,
  695. test_winsync_pre_ad_mod_user_mods_cb,
  696. test_winsync_pre_ad_mod_group_mods_cb,
  697. test_winsync_can_add_entry_to_ad_cb,
  698. test_winsync_begin_update_cb,
  699. test_winsync_end_update_cb,
  700. test_winsync_destroy_agmt_cb,
  701. test_winsync_post_ad_mod_user_cb,
  702. test_winsync_post_ad_mod_group_cb,
  703. test_winsync_post_ds_mod_user_cb,
  704. test_winsync_post_ds_mod_group_cb,
  705. test_winsync_post_ds_add_user_cb,
  706. test_winsync_post_ds_add_group_cb,
  707. test_winsync_pre_ad_add_user_cb,
  708. test_winsync_pre_ad_add_group_cb,
  709. test_winsync_post_ad_add_user_cb,
  710. test_winsync_post_ad_add_group_cb,
  711. test_winsync_post_ad_mod_user_mods_cb,
  712. test_winsync_post_ad_mod_group_mods_cb
  713. };
  714. static int
  715. test_winsync_plugin_start(Slapi_PBlock *pb)
  716. {
  717. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  718. "--> test_winsync_plugin_start -- begin\n");
  719. if( slapi_apib_register(WINSYNC_v2_0_GUID, test_winsync_api_v2) ) {
  720. slapi_log_error( SLAPI_LOG_FATAL, test_winsync_plugin_name,
  721. "<-- test_winsync_plugin_start -- failed to register winsync api -- end\n");
  722. return -1;
  723. }
  724. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  725. "<-- test_winsync_plugin_start -- end\n");
  726. return 0;
  727. }
  728. static int
  729. test_winsync_plugin_close(Slapi_PBlock *pb)
  730. {
  731. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  732. "--> test_winsync_plugin_close -- begin\n");
  733. slapi_apib_unregister(WINSYNC_v2_0_GUID);
  734. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  735. "<-- test_winsync_plugin_close -- end\n");
  736. return 0;
  737. }
  738. /* this is the slapi plugin init function,
  739. not the one used by the winsync api
  740. */
  741. int test_winsync_plugin_init(Slapi_PBlock *pb)
  742. {
  743. slapi_log_error(SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  744. "--> test_winsync_plugin_init -- begin\n");
  745. if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
  746. SLAPI_PLUGIN_VERSION_01 ) != 0 ||
  747. slapi_pblock_set(pb, SLAPI_PLUGIN_START_FN,
  748. (void *) test_winsync_plugin_start ) != 0 ||
  749. slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN,
  750. (void *) test_winsync_plugin_close ) != 0 ||
  751. slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
  752. (void *)&test_winsync_pdesc ) != 0 )
  753. {
  754. slapi_log_error( SLAPI_LOG_FATAL, test_winsync_plugin_name,
  755. "<-- test_winsync_plugin_init -- failed to register plugin -- end\n");
  756. return -1;
  757. }
  758. /* Retrieve and save the plugin identity to later pass to
  759. internal operations */
  760. if (slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &test_winsync_plugin_id) != 0) {
  761. slapi_log_error(SLAPI_LOG_FATAL, test_winsync_plugin_name,
  762. "<-- test_winsync_plugin_init -- failed to retrieve plugin identity -- end\n");
  763. return -1;
  764. }
  765. slapi_log_error( SLAPI_LOG_PLUGIN, test_winsync_plugin_name,
  766. "<-- test_winsync_plugin_init -- end\n");
  767. return 0;
  768. }
  769. /*
  770. dn: cn=Test Winsync API,cn=plugins,cn=config
  771. objectclass: top
  772. objectclass: nsSlapdPlugin
  773. objectclass: extensibleObject
  774. cn: Test Winsync API
  775. nsslapd-pluginpath: libtestwinsync-plugin
  776. nsslapd-plugininitfunc: test_winsync_plugin_init
  777. nsslapd-plugintype: preoperation
  778. nsslapd-pluginenabled: on
  779. nsslapd-plugin-depends-on-type: database
  780. nsslapd-plugin-depends-on-named: Multimaster Replication Plugin
  781. */
  782. #endif /* WINSYNC_SAMPLE_CODE */
  783. #endif /* WINSYNC_PLUGIN_PUBLIC_API */