1 /* init.c - initialize shell backend */
4 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/socket.h>
13 #include <ac/unistd.h>
18 #ifdef SLAPD_SHELL_DYNAMIC
20 int back_shell_LTX_init_module(int argc, char *argv[]) {
23 memset( &bi, '\0', sizeof(bi) );
25 bi.bi_init = shell_back_initialize;
31 #endif /* SLAPD_SHELL_DYNAMIC */
34 shell_back_initialize(
41 bi->bi_destroy = shell_back_destroy;
43 bi->bi_db_init = shell_back_db_init;
44 bi->bi_db_config = shell_back_db_config;
47 bi->bi_db_destroy = shell_back_db_destroy;
49 bi->bi_op_bind = shell_back_bind;
50 bi->bi_op_unbind = shell_back_unbind;
51 bi->bi_op_search = shell_back_search;
52 bi->bi_op_compare = shell_back_compare;
53 bi->bi_op_modify = shell_back_modify;
54 bi->bi_op_modrdn = shell_back_modrdn;
55 bi->bi_op_add = shell_back_add;
56 bi->bi_op_delete = shell_back_delete;
57 bi->bi_op_abandon = shell_back_abandon;
62 bi->bi_acl_attribute = 0;
63 bi->bi_chk_referrals = 0;
65 bi->bi_connection_init = 0;
66 bi->bi_connection_destroy = 0;
68 #ifdef SHELL_SURROGATE_PARENT
69 ldap_pvt_thread_mutex_init( &shell_surrogate_index_mutex );
70 ldap_pvt_thread_mutex_init( &shell_surrogate_fd_mutex[0] );
71 ldap_pvt_thread_mutex_init( &shell_surrogate_fd_mutex[1] );
82 #ifdef SHELL_SURROGATE_PARENT
83 ldap_pvt_thread_mutex_destroy( &shell_surrogate_index_mutex );
84 ldap_pvt_thread_mutex_destroy( &shell_surrogate_fd_mutex[0] );
85 ldap_pvt_thread_mutex_destroy( &shell_surrogate_fd_mutex[1] );
86 if ( shell_surrogate_fd[0] >= 0 ) {
87 close( shell_surrogate_fd[0] );
88 close( shell_surrogate_fd[1] );
90 if ( shell_surrogate_pid >= 0 )
91 kill( shell_surrogate_pid, SIGTERM );
102 struct shellinfo *si;
104 #ifdef SHELL_SURROGATE_PARENT
105 if ( shell_surrogate_fd[0] < 0 )
106 make_surrogate_parent();
109 si = (struct shellinfo *) ch_calloc( 1, sizeof(struct shellinfo) );
117 shell_back_db_destroy(
121 free( be->be_private );