backend.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /** BEGIN COPYRIGHT BLOCK
  2. * This Program is free software; you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation; version 2 of the License.
  5. *
  6. * This Program is distributed in the hope that it will be useful, but WITHOUT
  7. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. *
  10. * You should have received a copy of the GNU General Public License along with
  11. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  12. * Place, Suite 330, Boston, MA 02111-1307 USA.
  13. *
  14. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  15. * right to link the code of this Program with code not covered under the GNU
  16. * General Public License ("Non-GPL Code") and to distribute linked combinations
  17. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  18. * permitted under this exception must only link to the code of this Program
  19. * through those well defined interfaces identified in the file named EXCEPTION
  20. * found in the source code files (the "Approved Interfaces"). The files of
  21. * Non-GPL Code may instantiate templates or use macros or inline functions from
  22. * the Approved Interfaces without causing the resulting work to be covered by
  23. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  24. * additions to the list of Approved Interfaces. You must obey the GNU General
  25. * Public License in all respects for all of the Program code and other code used
  26. * in conjunction with the Program except the Non-GPL Code covered by this
  27. * exception. If you modify this file, you may extend this exception to your
  28. * version of the file, but you are not obligated to do so. If you do not wish to
  29. * provide this exception without modification, you must delete this exception
  30. * statement from your version and license this file solely under the GPL without
  31. * exception.
  32. *
  33. *
  34. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  35. * Copyright (C) 2005 Red Hat, Inc.
  36. * All rights reserved.
  37. * END COPYRIGHT BLOCK **/
  38. #ifdef HAVE_CONFIG_H
  39. # include <config.h>
  40. #endif
  41. /* backend.c - Slapi_Backend methods */
  42. #include "slap.h"
  43. void
  44. be_init( Slapi_Backend *be, const char *type, const char *name, int isprivate, int logchanges, int sizelimit, int timelimit )
  45. {
  46. slapdFrontendConfig_t *fecfg;
  47. be->be_suffix = NULL;
  48. be->be_suffixlock= PR_NewLock();
  49. be->be_suffixcount= 0;
  50. /* e.g. dn: cn=config,cn=NetscapeRoot,cn=ldbm database,cn=plugins,cn=config */
  51. be->be_basedn = slapi_create_dn_string("cn=%s,cn=%s,cn=plugins,cn=config",
  52. name, type);
  53. if (NULL == be->be_basedn) {
  54. LDAPDebug2Args(LDAP_DEBUG_ANY,
  55. "be_init: failed create instance dn for plugin %s, "
  56. "instance %s\n", type, name);
  57. }
  58. be->be_configdn = slapi_create_dn_string("cn=config,cn=%s,cn=%s,cn=plugins,cn=config",
  59. name, type);
  60. if (NULL == be->be_configdn) {
  61. LDAPDebug2Args(LDAP_DEBUG_ANY,
  62. "be_init: failed create instance config dn for "
  63. "plugin %s, instance %s\n", type, name);
  64. }
  65. be->be_monitordn = slapi_create_dn_string("cn=monitor,cn=%s,cn=%s,cn=plugins,cn=config",
  66. name, type);
  67. if (NULL == be->be_configdn) {
  68. LDAPDebug2Args(LDAP_DEBUG_ANY,
  69. "be_init: failed create instance monitor dn for "
  70. "plugin %s, instance %s\n", type, name);
  71. }
  72. be->be_sizelimit = sizelimit;
  73. be->be_timelimit = timelimit;
  74. /* maximum group nesting level before giving up */
  75. be->be_maxnestlevel = SLAPD_DEFAULT_GROUPNESTLEVEL;
  76. be->be_noacl= 0;
  77. be->be_flags=0;
  78. if (( fecfg = getFrontendConfig()) != NULL )
  79. {
  80. if ( fecfg->backendconfig != NULL && fecfg->backendconfig[ 0 ] != NULL )
  81. {
  82. be->be_backendconfig = slapi_ch_strdup( fecfg->backendconfig[0] );
  83. }
  84. else
  85. {
  86. be->be_backendconfig= NULL;
  87. }
  88. be->be_readonly = fecfg->readonly;
  89. }
  90. else
  91. {
  92. be->be_readonly= 0;
  93. be->be_backendconfig= NULL;
  94. }
  95. be->be_lastmod = LDAP_UNDEFINED;
  96. be->be_type = slapi_ch_strdup(type);
  97. be->be_include = NULL;
  98. be->be_private = isprivate;
  99. be->be_logchanges = logchanges;
  100. be->be_database = NULL;
  101. be->be_writeconfig = NULL;
  102. be->be_delete_on_exit = 0;
  103. be->be_state = BE_STATE_STOPPED;
  104. be->be_state_lock = PR_NewLock();
  105. be->be_name = slapi_ch_strdup(name);
  106. be->be_mapped = 0;
  107. be->be_usn_counter = NULL;
  108. }
  109. void
  110. be_done(Slapi_Backend *be)
  111. {
  112. int i;
  113. for(i=0;i<be->be_suffixcount;i++)
  114. {
  115. slapi_sdn_free(&be->be_suffix[i]);
  116. }
  117. slapi_ch_free((void**)&be->be_suffix);
  118. PR_DestroyLock(be->be_suffixlock);
  119. slapi_ch_free((void **)&be->be_basedn);
  120. slapi_ch_free((void **)&be->be_configdn);
  121. slapi_ch_free((void **)&be->be_monitordn);
  122. slapi_ch_free((void **)&be->be_type);
  123. slapi_ch_free((void **)&be->be_backendconfig);
  124. /* JCM char **be_include; ??? */
  125. slapi_ch_free((void **)&be->be_name);
  126. if (!config_get_entryusn_global()) {
  127. slapi_counter_destroy(&be->be_usn_counter);
  128. }
  129. PR_DestroyLock(be->be_state_lock);
  130. if (be->be_lock != NULL)
  131. {
  132. slapi_destroy_rwlock(be->be_lock);
  133. be->be_lock = NULL;
  134. }
  135. }
  136. void
  137. slapi_be_delete_onexit (Slapi_Backend *be)
  138. {
  139. be->be_delete_on_exit = 1;
  140. }
  141. void
  142. slapi_be_set_readonly(Slapi_Backend *be, int readonly)
  143. {
  144. be->be_readonly = readonly;
  145. }
  146. int
  147. slapi_be_get_readonly(Slapi_Backend *be)
  148. {
  149. return be->be_readonly;
  150. }
  151. /*
  152. * Check if suffix, exactly matches a registered
  153. * suffix of this backend.
  154. */
  155. int
  156. slapi_be_issuffix( const Slapi_Backend *be, const Slapi_DN *suffix )
  157. {
  158. int r= 0;
  159. /* this backend is no longer valid */
  160. if (be->be_state != BE_STATE_DELETED)
  161. {
  162. int i;
  163. PR_Lock(be->be_suffixlock);
  164. for ( i = 0; be->be_suffix != NULL && i<be->be_suffixcount; i++ )
  165. {
  166. if ( slapi_sdn_compare( be->be_suffix[i], suffix ) == 0)
  167. {
  168. r= 1;
  169. break;
  170. }
  171. }
  172. PR_Unlock(be->be_suffixlock);
  173. }
  174. return r;
  175. }
  176. int
  177. be_isdeleted( const Slapi_Backend *be )
  178. {
  179. return ((be == NULL) || (BE_STATE_DELETED == be->be_state));
  180. }
  181. void
  182. be_addsuffix(Slapi_Backend *be,const Slapi_DN *suffix)
  183. {
  184. if (be->be_state != BE_STATE_DELETED)
  185. {
  186. PR_Lock(be->be_suffixlock);
  187. if(be->be_suffix==NULL)
  188. {
  189. be->be_suffix= (Slapi_DN **)slapi_ch_malloc(sizeof(Slapi_DN *));
  190. }
  191. else
  192. {
  193. be->be_suffix= (Slapi_DN **)slapi_ch_realloc((char*)be->be_suffix,(be->be_suffixcount+1)*sizeof(Slapi_DN *));
  194. }
  195. be->be_suffix[be->be_suffixcount]= slapi_sdn_dup(suffix);
  196. be->be_suffixcount++;
  197. PR_Unlock(be->be_suffixlock);
  198. }
  199. }
  200. void slapi_be_addsuffix(Slapi_Backend *be,const Slapi_DN *suffix)
  201. {
  202. be_addsuffix(be,suffix);
  203. }
  204. /*
  205. * The caller may use the returned pointer without holding the
  206. * be_suffixlock since we never remove suffixes from the array.
  207. * The Slapi_DN pointer will always be valid even though the array
  208. * itself may be changing due to the addition of a suffix.
  209. */
  210. const Slapi_DN *
  211. slapi_be_getsuffix(Slapi_Backend *be,int n)
  212. {
  213. Slapi_DN *sdn = NULL;
  214. if(NULL == be)
  215. return NULL;
  216. if(be->be_state != BE_STATE_DELETED) {
  217. PR_Lock(be->be_suffixlock);
  218. if (be->be_suffix !=NULL && n<be->be_suffixcount) {
  219. sdn = be->be_suffix[n];
  220. }
  221. PR_Unlock(be->be_suffixlock);
  222. }
  223. return sdn;
  224. }
  225. const char *
  226. slapi_be_gettype(Slapi_Backend *be)
  227. {
  228. const char *r= NULL;
  229. if (be->be_state != BE_STATE_DELETED)
  230. {
  231. r= be->be_type;
  232. }
  233. return r;
  234. }
  235. Slapi_DN *
  236. be_getconfigdn(Slapi_Backend *be, Slapi_DN *dn)
  237. {
  238. if (be->be_state == BE_STATE_DELETED)
  239. {
  240. slapi_sdn_set_ndn_byref(dn,NULL);
  241. }
  242. else
  243. {
  244. slapi_sdn_set_ndn_byref(dn,be->be_configdn);
  245. }
  246. return dn;
  247. }
  248. Slapi_DN *
  249. be_getmonitordn(Slapi_Backend *be, Slapi_DN *dn)
  250. {
  251. if (be->be_state == BE_STATE_DELETED)
  252. {
  253. slapi_sdn_set_ndn_byref(dn,NULL);
  254. }
  255. else
  256. {
  257. slapi_sdn_set_ndn_byref(dn,be->be_monitordn);
  258. }
  259. return dn;
  260. }
  261. int
  262. be_writeconfig ( Slapi_Backend *be )
  263. {
  264. Slapi_PBlock *newpb;
  265. if (be->be_state == BE_STATE_DELETED || be->be_private ||
  266. (be->be_writeconfig == NULL) ) {
  267. return -1;
  268. }
  269. else {
  270. newpb = slapi_pblock_new();
  271. slapi_pblock_set ( newpb, SLAPI_PLUGIN, (void *) be->be_database );
  272. slapi_pblock_set ( newpb, SLAPI_BACKEND, (void *) be );
  273. (be->be_writeconfig)(newpb);
  274. slapi_pblock_destroy ( newpb );
  275. return 1;
  276. }
  277. }
  278. /*
  279. * Find out if changes made to entries in this backend
  280. * should be recorded in the changelog.
  281. */
  282. int
  283. slapi_be_logchanges(Slapi_Backend *be)
  284. {
  285. if (be->be_state == BE_STATE_DELETED)
  286. return 0;
  287. return be->be_logchanges;
  288. }
  289. int
  290. slapi_be_private ( Slapi_Backend *be )
  291. {
  292. if ( be!=NULL )
  293. {
  294. return (be->be_private);
  295. }
  296. return 0;
  297. }
  298. void *
  299. slapi_be_get_instance_info(Slapi_Backend * be)
  300. {
  301. PR_ASSERT(NULL != be);
  302. return be->be_instance_info;
  303. }
  304. void
  305. slapi_be_set_instance_info(Slapi_Backend * be, void * data)
  306. {
  307. PR_ASSERT(NULL != be);
  308. be->be_instance_info=data;
  309. }
  310. int
  311. slapi_be_getentrypoint(Slapi_Backend *be, int entrypoint, void **ret_fnptr, Slapi_PBlock *pb)
  312. {
  313. PR_ASSERT(NULL != be);
  314. /* this is something needed for most of the entry points */
  315. if (pb)
  316. {
  317. slapi_pblock_set( pb, SLAPI_PLUGIN, be->be_database );
  318. slapi_pblock_set( pb, SLAPI_BACKEND, be );
  319. }
  320. switch (entrypoint) {
  321. case SLAPI_PLUGIN_DB_BIND_FN:
  322. *ret_fnptr = (void*)be->be_bind;
  323. break;
  324. case SLAPI_PLUGIN_DB_UNBIND_FN:
  325. *ret_fnptr = (void*)be->be_unbind;
  326. break;
  327. case SLAPI_PLUGIN_DB_SEARCH_FN:
  328. *ret_fnptr = (void*)be->be_search;
  329. break;
  330. case SLAPI_PLUGIN_DB_COMPARE_FN:
  331. *ret_fnptr = (void*)be->be_compare;
  332. break;
  333. case SLAPI_PLUGIN_DB_MODIFY_FN:
  334. *ret_fnptr = (void*)be->be_modify;
  335. break;
  336. case SLAPI_PLUGIN_DB_MODRDN_FN:
  337. *ret_fnptr = (void*)be->be_modrdn;
  338. break;
  339. case SLAPI_PLUGIN_DB_ADD_FN:
  340. *ret_fnptr = (void*)be->be_add;
  341. break;
  342. case SLAPI_PLUGIN_DB_DELETE_FN:
  343. *ret_fnptr = (void*)be->be_delete;
  344. break;
  345. case SLAPI_PLUGIN_DB_ABANDON_FN:
  346. *ret_fnptr = (void*)be->be_abandon;
  347. break;
  348. case SLAPI_PLUGIN_DB_CONFIG_FN:
  349. *ret_fnptr = (void*)be->be_config;
  350. break;
  351. case SLAPI_PLUGIN_CLOSE_FN:
  352. *ret_fnptr = (void*)be->be_close;
  353. break;
  354. case SLAPI_PLUGIN_DB_FLUSH_FN:
  355. *ret_fnptr = (void*)be->be_flush;
  356. break;
  357. case SLAPI_PLUGIN_START_FN:
  358. *ret_fnptr = (void*)be->be_start;
  359. break;
  360. case SLAPI_PLUGIN_DB_RESULT_FN:
  361. *ret_fnptr = (void*)be->be_result;
  362. break;
  363. case SLAPI_PLUGIN_DB_LDIF2DB_FN:
  364. *ret_fnptr = (void*)be->be_ldif2db;
  365. break;
  366. case SLAPI_PLUGIN_DB_DB2LDIF_FN:
  367. *ret_fnptr = (void*)be->be_db2ldif;
  368. break;
  369. case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
  370. *ret_fnptr = (void*)be->be_archive2db;
  371. break;
  372. case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
  373. *ret_fnptr = (void*)be->be_db2archive;
  374. break;
  375. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
  376. *ret_fnptr = (void*)be->be_next_search_entry;
  377. break;
  378. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN:
  379. *ret_fnptr = (void*)be->be_next_search_entry_ext;
  380. break;
  381. case SLAPI_PLUGIN_DB_ENTRY_RELEASE_FN:
  382. *ret_fnptr = (void*)be->be_entry_release;
  383. break;
  384. case SLAPI_PLUGIN_DB_SEARCH_RESULTS_RELEASE_FN:
  385. *ret_fnptr = (void*)be->be_search_results_release;
  386. break;
  387. case SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN:
  388. *ret_fnptr = be->be_prev_search_results;
  389. break;
  390. case SLAPI_PLUGIN_DB_SIZE_FN:
  391. *ret_fnptr = (void*)be->be_dbsize;
  392. break;
  393. case SLAPI_PLUGIN_DB_TEST_FN:
  394. *ret_fnptr = (void*)be->be_dbtest;
  395. break;
  396. case SLAPI_PLUGIN_DB_RMDB_FN:
  397. *ret_fnptr = (void*)be->be_rmdb;
  398. break;
  399. case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:
  400. *ret_fnptr = (void*)be->be_init_instance;
  401. break;
  402. case SLAPI_PLUGIN_DB_SEQ_FN:
  403. *ret_fnptr = (void*)be->be_seq;
  404. break;
  405. case SLAPI_PLUGIN_DB_DB2INDEX_FN:
  406. *ret_fnptr = (void*)be->be_db2index;
  407. break;
  408. case SLAPI_PLUGIN_CLEANUP_FN:
  409. *ret_fnptr = (void*)be->be_cleanup;
  410. break;
  411. default:
  412. slapi_log_error(SLAPI_LOG_FATAL, NULL,
  413. "slapi_be_getentrypoint: unknown entry point %d\n", entrypoint);
  414. return -1;
  415. }
  416. return 0;
  417. }
  418. int
  419. slapi_be_setentrypoint(Slapi_Backend *be, int entrypoint, void *ret_fnptr, Slapi_PBlock *pb)
  420. {
  421. PR_ASSERT(NULL != be);
  422. /* this is something needed for most of the entry points */
  423. if (pb)
  424. {
  425. be->be_database=pb->pb_plugin;
  426. return 0;
  427. }
  428. switch (entrypoint) {
  429. case SLAPI_PLUGIN_DB_BIND_FN:
  430. be->be_bind=(IFP)ret_fnptr;
  431. break;
  432. case SLAPI_PLUGIN_DB_UNBIND_FN:
  433. be->be_unbind=(IFP)ret_fnptr;
  434. break;
  435. case SLAPI_PLUGIN_DB_SEARCH_FN:
  436. be->be_search=(IFP)ret_fnptr;
  437. break;
  438. case SLAPI_PLUGIN_DB_COMPARE_FN:
  439. be->be_compare=(IFP)ret_fnptr;
  440. break;
  441. case SLAPI_PLUGIN_DB_MODIFY_FN:
  442. be->be_modify=(IFP)ret_fnptr;
  443. break;
  444. case SLAPI_PLUGIN_DB_MODRDN_FN:
  445. be->be_modrdn=(IFP)ret_fnptr;
  446. break;
  447. case SLAPI_PLUGIN_DB_ADD_FN:
  448. be->be_add=(IFP)ret_fnptr;
  449. break;
  450. case SLAPI_PLUGIN_DB_DELETE_FN:
  451. be->be_delete=(IFP)ret_fnptr;
  452. break;
  453. case SLAPI_PLUGIN_DB_ABANDON_FN:
  454. be->be_abandon=(IFP)ret_fnptr;
  455. break;
  456. case SLAPI_PLUGIN_DB_CONFIG_FN:
  457. be->be_config=(IFP)ret_fnptr;
  458. break;
  459. case SLAPI_PLUGIN_CLOSE_FN:
  460. be->be_close=(IFP)ret_fnptr;
  461. break;
  462. case SLAPI_PLUGIN_DB_FLUSH_FN:
  463. be->be_flush=(IFP)ret_fnptr;
  464. break;
  465. case SLAPI_PLUGIN_START_FN:
  466. be->be_start=(IFP)ret_fnptr;
  467. break;
  468. case SLAPI_PLUGIN_DB_RESULT_FN:
  469. be->be_result=(IFP)ret_fnptr;
  470. break;
  471. case SLAPI_PLUGIN_DB_LDIF2DB_FN:
  472. be->be_ldif2db=(IFP)ret_fnptr;
  473. break;
  474. case SLAPI_PLUGIN_DB_DB2LDIF_FN:
  475. be->be_db2ldif=(IFP) ret_fnptr;
  476. break;
  477. case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
  478. be->be_archive2db=(IFP) ret_fnptr;
  479. break;
  480. case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
  481. be->be_db2archive=(IFP) ret_fnptr;
  482. break;
  483. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
  484. be->be_next_search_entry=(IFP) ret_fnptr;
  485. break;
  486. case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN:
  487. be->be_next_search_entry_ext=(IFP) ret_fnptr;
  488. break;
  489. case SLAPI_PLUGIN_DB_ENTRY_RELEASE_FN:
  490. be->be_entry_release=(IFP) ret_fnptr;
  491. break;
  492. case SLAPI_PLUGIN_DB_SEARCH_RESULTS_RELEASE_FN:
  493. be->be_search_results_release=(VFPP) ret_fnptr;
  494. break;
  495. case SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN:
  496. be->be_prev_search_results = (VFP) ret_fnptr;
  497. break;
  498. case SLAPI_PLUGIN_DB_SIZE_FN:
  499. be->be_dbsize=(IFP) ret_fnptr;
  500. break;
  501. case SLAPI_PLUGIN_DB_TEST_FN:
  502. be->be_dbtest=(IFP)ret_fnptr;
  503. break;
  504. case SLAPI_PLUGIN_DB_RMDB_FN:
  505. be->be_rmdb=(IFP)ret_fnptr;
  506. break;
  507. case SLAPI_PLUGIN_DB_INIT_INSTANCE_FN:
  508. be->be_init_instance=(IFP)ret_fnptr;
  509. break;
  510. case SLAPI_PLUGIN_DB_SEQ_FN:
  511. be->be_seq=(IFP)ret_fnptr;
  512. break;
  513. case SLAPI_PLUGIN_DB_DB2INDEX_FN:
  514. be->be_db2index=(IFP)ret_fnptr;
  515. break;
  516. case SLAPI_PLUGIN_CLEANUP_FN:
  517. be->be_cleanup=(IFP)ret_fnptr;
  518. break;
  519. default:
  520. slapi_log_error(SLAPI_LOG_FATAL, NULL,
  521. "slapi_be_setentrypoint: unknown entry point %d\n", entrypoint);
  522. return -1;
  523. }
  524. return 0;
  525. }
  526. int slapi_be_is_flag_set(Slapi_Backend * be, int flag)
  527. {
  528. return be->be_flags & flag;
  529. }
  530. void slapi_be_set_flag(Slapi_Backend * be, int flag)
  531. {
  532. be->be_flags|= flag;
  533. }
  534. char * slapi_be_get_name(Slapi_Backend * be)
  535. {
  536. return be->be_name;
  537. }
  538. void be_set_sizelimit(Slapi_Backend * be, int sizelimit)
  539. {
  540. be->be_sizelimit = sizelimit;
  541. }
  542. void be_set_timelimit(Slapi_Backend * be, int timelimit)
  543. {
  544. be->be_timelimit = timelimit;
  545. }
  546. int
  547. slapi_back_get_info(Slapi_Backend *be, int cmd, void **info)
  548. {
  549. int rc = -1;
  550. if (!be || !be->be_get_info || !info) {
  551. return rc;
  552. }
  553. rc = (*be->be_get_info)(be, cmd, info);
  554. return rc;
  555. }
  556. int
  557. slapi_back_set_info(Slapi_Backend *be, int cmd, void *info)
  558. {
  559. int rc = -1;
  560. if (!be || !be->be_set_info || !info) {
  561. return rc;
  562. }
  563. rc = (*be->be_set_info)(be, cmd, info);
  564. return rc;
  565. }
  566. int
  567. slapi_back_ctrl_info(Slapi_Backend *be, int cmd, void *info)
  568. {
  569. int rc = -1;
  570. if (!be || !be->be_ctrl_info || !info) {
  571. return rc;
  572. }
  573. rc = (*be->be_ctrl_info)(be, cmd, info);
  574. return rc;
  575. }