cb.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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. #ifndef CBHFILE
  42. #define CBHFILE
  43. /*** #define CB_YIELD ***/
  44. #include <stdio.h>
  45. #include <string.h>
  46. #include <prlock.h>
  47. #include <prcvar.h>
  48. #include "slapi-plugin.h"
  49. #include "slapi-private.h"
  50. #include "portable.h"
  51. /* Constants */
  52. #define CB_DIRECTORY_MANAGER_DN "cn=directory manager"
  53. #define CB_CHAINING_BACKEND_TYPE "chaining database"
  54. #define CB_PLUGIN_NAME "chaining database"
  55. #define CB_PLUGIN_SUBSYSTEM "chaining database"
  56. #define CB_PLUGIN_DESCRIPTION "LDAP chaining backend database plugin"
  57. #define CB_LDAP_SECURE_PORT 636
  58. #define CB_BUFSIZE 2048
  59. /* Macros */
  60. #define CB_LDAP_CONN_ERROR( err ) ( (err) == LDAP_SERVER_DOWN || \
  61. (err) == LDAP_CONNECT_ERROR )
  62. #define CB_ASSERT( expr ) PR_ASSERT( expr )
  63. /* Innosoft chaining extension for loop detection */
  64. #define CB_LDAP_CONTROL_CHAIN_SERVER "1.3.6.1.4.1.1466.29539.12"
  65. /* Chaining backend configuration attributes */
  66. /* Monitor entry */
  67. #define CB_MONITOR_EXTENSIBLEOCL "extensibleObject"
  68. #define CB_MONITOR_INSTNAME "cn"
  69. #define CB_MONITOR_ADDCOUNT "nsAddCount"
  70. #define CB_MONITOR_DELETECOUNT "nsDeleteCount"
  71. #define CB_MONITOR_MODIFYCOUNT "nsModifyCount"
  72. #define CB_MONITOR_MODRDNCOUNT "nsRenameCount"
  73. #define CB_MONITOR_SEARCHBASECOUNT "nsSearchBaseCount"
  74. #define CB_MONITOR_SEARCHONELEVELCOUNT "nsSearchOneLevelCount"
  75. #define CB_MONITOR_SEARCHSUBTREECOUNT "nsSearchSubtreeCount"
  76. #define CB_MONITOR_ABANDONCOUNT "nsAbandonCount"
  77. #define CB_MONITOR_BINDCOUNT "nsBindCount"
  78. #define CB_MONITOR_UNBINDCOUNT "nsUnbindCount"
  79. #define CB_MONITOR_COMPARECOUNT "nsCompareCount"
  80. #define CB_MONITOR_OUTGOINGCONN "nsOpenOpConnectionCount"
  81. #define CB_MONITOR_OUTGOINGBINDCOUNT "nsOpenBindConnectionCount"
  82. /* Global configuration */
  83. #define CB_CONFIG_GLOBAL_FORWARD_CTRLS "nsTransmittedControls"
  84. #define CB_CONFIG_GLOBAL_CHAINING_COMPONENTS "nsActiveChainingComponents"
  85. #define CB_CONFIG_GLOBAL_CHAINABLE_COMPONENTS "nsPossibleChainingComponents"
  86. /* not documented */
  87. #define CB_CONFIG_GLOBAL_DEBUG "nsDebug"
  88. /* Instance-specific configuration */
  89. #define CB_CONFIG_CHAINING_COMPONENTS CB_CONFIG_GLOBAL_CHAINING_COMPONENTS
  90. #define CB_CONFIG_EXTENSIBLEOCL "extensibleObject"
  91. /* XXXSD to be changed */
  92. #define CB_CONFIG_INSTANCE_FILTER "(objectclass=nsBackendInstance)"
  93. #define CB_CONFIG_INSTNAME "cn"
  94. #define CB_CONFIG_SUFFIX "nsslapd-suffix"
  95. #define CB_CONFIG_SIZELIMIT "nsslapd-sizelimit"
  96. #define CB_CONFIG_TIMELIMIT "nsslapd-timelimit"
  97. #define CB_CONFIG_HOSTURL "nsFarmServerURL"
  98. #define CB_CONFIG_STARTTLS "nsUseStartTLS"
  99. #define CB_CONFIG_BINDUSER "nsMultiplexorBindDn"
  100. #define CB_CONFIG_BINDMECH "nsBindMechanism"
  101. #define CB_CONFIG_USERPASSWORD "nsMultiplexorCredentials"
  102. #define CB_CONFIG_MAXBINDCONNECTIONS "nsBindConnectionsLimit"
  103. #define CB_CONFIG_MAXCONNECTIONS "nsOperationConnectionsLimit"
  104. #define CB_CONFIG_MAXCONCURRENCY "nsConcurrentOperationsLimit"
  105. #define CB_CONFIG_MAXBINDCONCURRENCY "nsConcurrentBindLimit"
  106. #define CB_CONFIG_IMPERSONATION "nsProxiedAuthorization"
  107. #define CB_CONFIG_BINDTIMEOUT "nsBindTimeout"
  108. #define CB_CONFIG_TIMEOUT "nsOperationTimeout"
  109. #define CB_CONFIG_MAX_IDLE_TIME "nsMaxResponseDelay"
  110. #define CB_CONFIG_MAX_TEST_TIME "nsMaxTestResponseDelay"
  111. #define CB_CONFIG_REFERRAL "nsReferralOnScopedSearch"
  112. #define CB_CONFIG_CONNLIFETIME "nsConnectionLife"
  113. #define CB_CONFIG_ABANDONTIMEOUT "nsAbandonedSearchCheckInterval "
  114. #define CB_CONFIG_BINDRETRY "nsBindRetryLimit"
  115. #define CB_CONFIG_LOCALACL "nsCheckLocalACI"
  116. #define CB_CONFIG_HOPLIMIT "nsHopLimit"
  117. /* not documented */
  118. #define CB_CONFIG_ILLEGAL_ATTRS "nsServerDefinedAttributes"
  119. /* Default configuration values (as string) */
  120. /*
  121. * CB_DEF_MAXCONNECTIONS and CB_DEF_MAXCONCURRENCY used to be 10.
  122. * Reduced CB_DEF_MAXCONCURRENCY to 2 to workaround bug 623793 -
  123. * err=1 in accesslogs and ber parsing errors in errors logs.
  124. */
  125. #define CB_DEF_MAXCONNECTIONS "20" /* CB_CONFIG_MAXCONNECTIONS */
  126. #define CB_DEF_MAXCONCURRENCY "2" /* CB_CONFIG_MAXCONCURRENCY */
  127. #define CB_DEF_BIND_MAXCONNECTIONS "3" /* CB_CONFIG_MAXBINDCONNECTIONS */
  128. #define CB_DEF_BIND_MAXCONCURRENCY "10" /* CB_CONFIG_MAXBINDCONCURRENCY */
  129. #define CB_DEF_BINDTIMEOUT "15" /* CB_CONFIG_BINDTIMEOUT */
  130. #define CB_DEF_CONNLIFETIME "0" /* CB_CONFIG_CONNLIFETIME */
  131. #define CB_DEF_IMPERSONATION "on" /* CB_CONFIG_IMPERSONATION */
  132. #define CB_DEF_SEARCHREFERRAL "off" /* CB_CONFIG_REFERRAL */
  133. #define CB_DEF_ABANDON_TIMEOUT "1" /* CB_CONFIG_ABANDONTIMEOUT */
  134. #define CB_DEF_BINDRETRY "3" /* CB_CONFIG_BINDRETRY */
  135. #define CB_DEF_LOCALACL "off" /* CB_CONFIG_LOCALACL */
  136. #define CB_DEF_TIMELIMIT "3600"
  137. #define CB_DEF_SIZELIMIT "2000"
  138. #define CB_DEF_HOPLIMIT "10" /* CB_CONFIG_HOPLIMIT */
  139. #define CB_DEF_MAX_IDLE_TIME "60" /* CB_CONFIG_MAX_IDLE_TIME */
  140. #define CB_DEF_MAX_TEST_TIME "15" /* CB_CONFIG_MAX_TEST_TIME */
  141. #define CB_DEF_STARTTLS "off" /* CB_CONFIG_STARTTLS */
  142. #define CB_DEF_BINDMECH LDAP_SASL_SIMPLE /* CB_CONFIG_BINDMECH */
  143. #define CB_SIMPLE_BINDMECH "SIMPLE" /* will be translated to LDAP_SASL_SIMPLE */
  144. typedef void *cb_config_get_fn_t(void *arg);
  145. typedef int cb_config_set_fn_t(void *arg, void *value, char *errorbuf, int phase, int apply);
  146. typedef struct _cb_instance_config_info {
  147. char *config_name;
  148. int config_type;
  149. char *config_default_value;
  150. cb_config_get_fn_t *config_get_fn;
  151. cb_config_set_fn_t *config_set_fn;
  152. int config_flags;
  153. } cb_instance_config_info;
  154. #define CB_CONFIG_TYPE_ONOFF 1 /* val = (int) value */
  155. #define CB_CONFIG_TYPE_STRING 2 /* val = (char *) value - The get functions
  156. * for this type must return alloced memory
  157. * that should be freed by the caller. */
  158. #define CB_CONFIG_TYPE_INT 3 /* val = (int) value */
  159. #define CB_CONFIG_TYPE_LONG 4 /* val = (long) value */
  160. #define CB_CONFIG_TYPE_INT_OCTAL 5 /* Same as CONFIG_TYPE_INT, but shown in octal*/
  161. #define CB_PREVIOUSLY_SET 1
  162. #define CB_ALWAYS_SHOW 2
  163. #define CB_CONFIG_PHASE_INITIALIZATION 1
  164. #define CB_CONFIG_PHASE_STARTUP 2
  165. #define CB_CONFIG_PHASE_RUNNING 3
  166. #define CB_CONFIG_PHASE_INTERNAL 4
  167. /*jarnou: default amount of time in seconds during wich the chaining backend will be unavailable */
  168. #define CB_UNAVAILABLE_PERIOD 30 /* CB_CONFIG_UNAVAILABLE_PERIOD */
  169. #define CB_INFINITE_TIME 360000 /* must be enough ... */
  170. /*jarnou: default number of connections failed from which the farm is declared unavailable */
  171. #define CB_NUM_CONN_BEFORE_UNAVAILABILITY 1
  172. #define FARMSERVER_UNAVAILABLE 1
  173. #define FARMSERVER_AVAILABLE 0
  174. /* Internal data structures */
  175. /* cb_backend represents the chaining backend type. */
  176. /* Only one instance is created when the plugin is */
  177. /* loaded. Contain global conf */
  178. typedef struct _cb_backend {
  179. /*
  180. ** keep track of plugin identity.
  181. ** Used for internal operations
  182. */
  183. void *identity;
  184. char * pluginDN;
  185. char * configDN;
  186. /*
  187. ** There are times when we need a pointer to the chaining database
  188. ** plugin, so we will store a pointer to it here. Examples of
  189. ** when we need it are when we create a new instance and when
  190. ** we need the name of the plugin to do internal ops.
  191. */
  192. struct slapdplugin *plugin;
  193. /*
  194. ** Global config. shared by all chaining db instances
  195. */
  196. struct {
  197. char ** forward_ctrls; /* List of forwardable controls */
  198. char ** chaining_components; /* List of plugins that chains */
  199. char ** chainable_components; /* List of plugins allowed to chain*/
  200. /* internal operations. */
  201. Slapi_RWLock *rwl_config_lock; /* Protect the global config */
  202. } config;
  203. int started; /* TRUE when started */
  204. } cb_backend;
  205. /* Connection management */
  206. /* states */
  207. #define CB_CONNSTATUS_OK 1 /* Open */
  208. #define CB_CONNSTATUS_DOWN 2 /* Down */
  209. #define CB_CONNSTATUS_STALE 3
  210. #define ENABLE_MULTITHREAD_PER_CONN 1 /* to allow multiple threads to perform LDAP operations on a connection */
  211. #define DISABLE_MULTITHREAD_PER_CONN 0 /* to allow only one thread to perform LDAP operations on a connection */
  212. /************** WARNING: Be careful if you want to change this constant. It is used in hexadecimal in cb_conn_stateless.c in the function PR_ThreadSelf() ************/
  213. #define MAX_CONN_ARRAY 2048 /* we suppose the number of threads in the server not to exceed this limit*/
  214. /**********************************************************************************************************/
  215. typedef struct _cb_outgoing_conn{
  216. LDAP *ld;
  217. unsigned long refcount;
  218. struct _cb_outgoing_conn *next;
  219. time_t opentime;
  220. int status;
  221. int ThreadId ; /* usefull to identify the thread when SSL is enabled */
  222. } cb_outgoing_conn;
  223. typedef struct {
  224. char *hostname; /* Farm server name */
  225. char *url;
  226. unsigned int port;
  227. int secure;
  228. char *binddn; /* normalized */
  229. char *binddn2; /* not normalized, value returned to the client */
  230. char *password;
  231. int bindit; /* If true, open AND bind */
  232. char ** waste_basket; /* stale char * */
  233. struct {
  234. unsigned int maxconnections;
  235. unsigned int maxconcurrency;
  236. unsigned int connlifetime;
  237. struct timeval op_timeout;
  238. struct timeval bind_timeout;
  239. Slapi_Mutex *conn_list_mutex;
  240. Slapi_CondVar *conn_list_cv;
  241. cb_outgoing_conn *conn_list;
  242. unsigned int conn_list_count;
  243. } conn;
  244. cb_outgoing_conn *connarray[MAX_CONN_ARRAY]; /* array of secure connections */
  245. /* To protect the config set by LDAP */
  246. Slapi_RWLock * rwl_config_lock;
  247. int starttls; /* use starttls with connection */
  248. char *mech; /* plain, external, or a sasl mech */
  249. } cb_conn_pool;
  250. /* _cb_backend_instance represents a instance of the chaining */
  251. /* backend. */
  252. typedef struct _cb_backend_instance {
  253. char *inst_name; /* Unique name */
  254. Slapi_Backend *inst_be; /* Slapi_Bakedn associated with it */
  255. cb_backend *backend_type; /* pointer to the backend type */
  256. /* configuration */
  257. Slapi_RWLock *rwl_config_lock; /* protect the config */
  258. char *configDn; /* config entry dn */
  259. char *monitorDn; /* monitor entry dn */
  260. int local_acl; /* True if local acl evaluation */
  261. /* sometimes a chaining backend may be associated with a local backend
  262. 1) The chaining backend is the backend of a sub suffix, and the
  263. parent suffix has a local backend
  264. 2) Entry distribution is being used to distribute write operations to
  265. a chaining backend and other operations to a local backend
  266. (e.g. a replication hub or consumer)
  267. If the associated local backend is being initialized (import), it will be
  268. disabled, and it will be impossible to evaluate local acls. In this case,
  269. we still want to be able to chain operations to a farm server or another
  270. database chain. But the current code will not allow cascading without
  271. local acl evaluation (cb_controls.c). The following variable allows us to relax that
  272. restriction while the associated backend is disabled
  273. */
  274. int associated_be_is_disabled; /* true if associated backend is disabled */
  275. int isconfigured; /* True when valid config entry */
  276. int impersonate; /* TRUE to impersonate users */
  277. int searchreferral; /* TRUE to return referral for scoped searches */
  278. int bind_retry;
  279. struct timeval abandon_timeout; /* check for abandoned op periodically */
  280. struct timeval op_timeout;
  281. char **url_array; /* list of urls to farm servers */
  282. char **chaining_components; /* List of plugins using chaining */
  283. char **illegal_attributes; /* Attributes not forwarded */
  284. char **every_attribute; /* attr list to get every attr, including op attrs */
  285. int sizelimit;
  286. int timelimit;
  287. int hoplimit;
  288. int max_idle_time; /* how long we wait before pinging the farm server */
  289. int max_test_time; /* how long we wait during ping */
  290. cb_conn_pool *pool; /* Operation cnx pool */
  291. cb_conn_pool *bind_pool; /* Bind cnx pool */
  292. Slapi_Eq_Context eq_ctx; /* Use to identify the function put in the queue */
  293. /* Monitoring */
  294. struct {
  295. Slapi_Mutex *mutex;
  296. unsigned long addcount;
  297. unsigned long deletecount;
  298. unsigned long modifycount;
  299. unsigned long modrdncount;
  300. unsigned long searchbasecount;
  301. unsigned long searchonelevelcount;
  302. unsigned long searchsubtreecount;
  303. unsigned long abandoncount;
  304. unsigned long bindcount;
  305. unsigned long unbindcount;
  306. unsigned long comparecount;
  307. } monitor;
  308. /* Monitoring the chaining BE availability */
  309. /* Principle: as soon as we detect an abnormal pb with an ldap operation, and we close the connection
  310. or if we can't open a connection, we increment a counter (cpt). This counter represents the number of
  311. continuously pbs we can notice. Before forwarding an LDAP operation, wether the farmserver is available or not,
  312. through the value of the counter. If the farmserver is not available, we just return an error msg to the client */
  313. struct {
  314. int unavailable_period ; /* how long we wait as soon as the farm is declared unavailable */
  315. int max_num_conn_failed ; /* max number of consecutive failed/aborted connections before we declared the farm as unreachable */
  316. time_t unavailableTimeLimit ; /* time from which the chaining BE becomes available */
  317. int farmserver_state ; /* FARMSERVER_AVAILABLE if the chaining is available, FARMSERVER_UNAVAILABLE else */
  318. int cpt ; /* count the number of consecutive failed/aborted connexions */
  319. Slapi_Mutex *cpt_lock ; /* lock to protect the counter cpt */
  320. Slapi_Mutex *lock_timeLimit ; /* lock to protect the unavailableTimeLimit variable*/
  321. } monitor_availability;
  322. } cb_backend_instance;
  323. /* Data structure for the search operation to carry candidates */
  324. #define CB_SEARCHCONTEXT_ENTRY 2
  325. typedef struct _cb_searchContext {
  326. int type;
  327. void *data;
  328. int msgid;
  329. LDAP *ld;
  330. cb_outgoing_conn *cnx;
  331. Slapi_Entry *tobefreed;
  332. LDAPMessage *pending_result;
  333. int pending_result_type;
  334. Slapi_Entry *readahead;
  335. } cb_searchContext;
  336. #define CB_REOPEN_CONN -1968 /* Different from any LDAP_XXX errors */
  337. /* Forward declarations */
  338. /* for ctrl_flags on cb_update_controls */
  339. #define CB_UPDATE_CONTROLS_ADDAUTH 1
  340. #define CB_UPDATE_CONTROLS_ISABANDON 2
  341. int cb_get_connection(cb_conn_pool * pool, LDAP ** ld, cb_outgoing_conn ** cnx, struct timeval * tmax, char **errmsg);
  342. int cb_config(cb_backend_instance * cb, int argc, char ** argv );
  343. int cb_update_controls( Slapi_PBlock *pb, LDAP * ld, LDAPControl *** controls, int ctrl_flags);
  344. int cb_is_control_forwardable(cb_backend * cb, char *controloid);
  345. int cb_access_allowed (Slapi_PBlock *pb,Slapi_Entry *e,char *type,struct berval * bval, int op, char ** buf);
  346. int cb_forward_operation(Slapi_PBlock * op);
  347. int cb_parse_instance_config_entry(cb_backend * cb, Slapi_Entry * e);
  348. int cb_abandon_connection(cb_backend_instance * cb, Slapi_PBlock * pb, LDAP ** ld);
  349. int cb_atoi(char *str);
  350. int cb_check_forward_abandon(cb_backend_instance * cb,Slapi_PBlock * pb, LDAP * ld, int msgid );
  351. int cb_search_monitor_callback(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *e2, int *ret, char *t,void *a);
  352. int cb_config_load_dse_info(Slapi_PBlock * pb);
  353. int cb_config_add_dse_entries(cb_backend *cb, char **entries, char *string1, char *string2, char *string3);
  354. int cb_add_suffix(cb_backend_instance *inst, struct berval **bvals, int apply_mod, char *returntext);
  355. int cb_create_default_backend_instance_config(cb_backend * cb);
  356. int cb_build_backend_instance_config(cb_backend_instance *inst, Slapi_Entry * conf,int apply);
  357. int cb_instance_delete_config_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* e2,
  358. int *returncode, char *returntext, void *arg);
  359. int cb_instance_search_config_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e,
  360. int *returncode, char *returntext, void *arg);
  361. int cb_instance_add_config_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* e2,
  362. int *returncode, char *returntext, void *arg);
  363. int cb_instance_modify_config_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e,
  364. int *returncode, char *returntext, void *arg);
  365. int cb_dont_allow_that(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e,
  366. int *returncode, char *returntext, void *arg);
  367. int cb_config_search_callback(Slapi_PBlock *pb, Slapi_Entry* e1, Slapi_Entry* e2, int *returncode,
  368. char *returntext, void *arg);
  369. int cb_config_add_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
  370. int cb_config_delete_instance_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
  371. int cb_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
  372. int cb_config_add_instance_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
  373. int cb_delete_monitor_callback(Slapi_PBlock * pb, Slapi_Entry * e, Slapi_Entry * entryAfter, int * returnCode, char * returnText, void * arg);
  374. int cb_config_add_check_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* e2, int *returncode,
  375. char *returntext, void *arg);
  376. int cb_instance_add_config_check_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* e2,
  377. int *returncode, char *returntext, void *arg);
  378. int cb_config_modify_check_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode,
  379. char *returntext, void *arg);
  380. void cb_eliminate_illegal_attributes(cb_backend_instance * inst, Slapi_Entry * e);
  381. void cb_release_op_connection(cb_conn_pool * pool, LDAP *ldd, int dispose);
  382. void cb_register_supported_control( cb_backend * cb, char *controloid, unsigned long controlops );
  383. void cb_unregister_all_supported_control( cb_backend * cb );
  384. void cb_register_supported_control( cb_backend * cb, char *controloid, unsigned long controlops );
  385. void cb_unregister_supported_control( cb_backend * cb, char *controloid, unsigned long controlops );
  386. void cb_set_acl_policy(Slapi_PBlock *pb);
  387. void cb_close_conn_pool(cb_conn_pool * pool);
  388. void cb_update_monitor_info(Slapi_PBlock * pb, cb_backend_instance * inst,int op);
  389. void cb_send_ldap_result(Slapi_PBlock *pb, int err, char *m,char *t, int ne, struct berval **urls );
  390. void cb_stale_all_connections( cb_backend_instance * be);
  391. int
  392. cb_config_add_instance_check_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e,
  393. int *returncode, char *returntext, void *arg);
  394. int chaining_back_add ( Slapi_PBlock *pb );
  395. int chaining_back_delete ( Slapi_PBlock *pb );
  396. int chaining_back_compare ( Slapi_PBlock *pb );
  397. int chaining_back_modify ( Slapi_PBlock *pb );
  398. int chaining_back_modrdn ( Slapi_PBlock *pb );
  399. int chaining_back_abandon ( Slapi_PBlock *pb );
  400. int chaining_back_entry_release ( Slapi_PBlock *pb );
  401. int chainingdb_next_search_entry( Slapi_PBlock *pb );
  402. int chainingdb_build_candidate_list ( Slapi_PBlock *pb );
  403. int chainingdb_start (Slapi_PBlock *pb );
  404. int chainingdb_bind (Slapi_PBlock *pb );
  405. int cb_db_size (Slapi_PBlock *pb );
  406. int cb_back_close (Slapi_PBlock *pb );
  407. int cb_back_cleanup (Slapi_PBlock *pb );
  408. void chaining_back_search_results_release( void **sr );
  409. void chainingdb_prev_search_results ( Slapi_PBlock *pb );
  410. long cb_atol(char *str);
  411. Slapi_Entry * cb_LDAPMessage2Entry(LDAP * ctx, LDAPMessage * msg, int attrsonly);
  412. char * cb_get_rootdn();
  413. struct berval ** referrals2berval(char ** referrals);
  414. cb_backend_instance * cb_get_instance(Slapi_Backend * be);
  415. cb_backend * cb_get_backend_type();
  416. int cb_debug_on();
  417. void cb_set_debug(int on);
  418. int cb_ping_farm(cb_backend_instance *cb,cb_outgoing_conn * cnx,time_t end);
  419. void cb_update_failed_conn_cpt ( cb_backend_instance *cb ) ;
  420. void cb_reset_conn_cpt( cb_backend_instance *cb ) ;
  421. int cb_check_availability( cb_backend_instance *cb, Slapi_PBlock *pb ) ;
  422. time_t current_time();
  423. char* get_localhost_DNS();
  424. /* this function is called when state of a backend changes */
  425. void cb_be_state_change (void *handle, char *be_name, int old_be_state, int new_be_state);
  426. #define ENDUSERMSG "database configuration error - please contact the system administrator"
  427. #endif