1 /* tcl_init.c - tcl backend initialization
3 * $Id: tcl_init.c,v 1.6 1999/03/03 16:02:10 hallvard Exp $
5 * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
7 * Redistribution and use in source and binary forms are permitted only
8 * as authorized by the OpenLDAP Public License. A copy of this
9 * license is available at http://www.OpenLDAP.org/license.html or
10 * in file LICENSE in the top-level directory of the distribution.
17 #include <ac/socket.h>
22 ldap_pvt_thread_mutex_t tcl_interpreter_mutex;
29 /* Initialize the global interpreter array */
30 global_i = (struct i_info *) ch_malloc (sizeof (struct i_info));
33 global_i->name = "default";
34 global_i->next = NULL;
35 global_i->interp = Tcl_CreateInterp ();
36 Tcl_Init (global_i->interp);
38 /* Initialize the global interpreter lock */
39 ldap_pvt_thread_mutex_init (&tcl_interpreter_mutex);
41 bi->bi_open = tcl_back_open;
43 bi->bi_close = tcl_back_close;
44 bi->bi_destroy = tcl_back_destroy;
46 bi->bi_db_init = tcl_back_db_init;
47 bi->bi_db_config = tcl_back_db_config;
48 bi->bi_db_open = tcl_back_db_open;
49 bi->bi_db_close = tcl_back_db_close;
50 bi->bi_db_destroy = tcl_back_db_destroy;
52 bi->bi_op_bind = tcl_back_bind;
53 bi->bi_op_unbind = tcl_back_unbind;
54 bi->bi_op_search = tcl_back_search;
55 bi->bi_op_compare = tcl_back_compare;
56 bi->bi_op_modify = tcl_back_modify;
57 bi->bi_op_modrdn = tcl_back_modrdn;
58 bi->bi_op_add = tcl_back_add;
59 bi->bi_op_delete = tcl_back_delete;
60 bi->bi_op_abandon = tcl_back_abandon;
62 #ifdef SLAPD_ACLGROUPS
66 bi->bi_connection_init = 0;
67 bi->bi_connection_destroy = 0;
77 /* Initialize the global interpreter array */
78 global_i = (struct i_info *) ch_malloc (sizeof (struct i_info));
81 global_i->name = "default";
82 global_i->next = NULL;
83 global_i->interp = Tcl_CreateInterp ();
84 Tcl_Init (global_i->interp);
86 /* Initialize the global interpreter lock */
87 ldap_pvt_thread_mutex_init (&tcl_interpreter_mutex);
99 ti = (struct tclinfo *) ch_calloc (1, sizeof (struct tclinfo));
102 * For some reason this causes problems
103 * specifically set to NULL
106 ti->ti_unbind = NULL;
107 ti->ti_search = NULL;
108 ti->ti_compare = NULL;
109 ti->ti_modify = NULL;
110 ti->ti_modrdn = NULL;
112 ti->ti_delete = NULL;
113 ti->ti_abandon = NULL;
125 struct tclinfo *ti = (struct tclinfo *) bd->be_private;
127 if (ti->ti_ii->interp == NULL) { /* we need to make a new one */
128 ti->ti_ii->interp = Tcl_CreateInterp ();
129 Tcl_Init (ti->ti_ii->interp);
132 /* raise that count for the interpreter */
135 /* now let's (try to) load the script */
136 readtclscript (ti->script_path, ti->ti_ii->interp);
138 /* Intall the debug command */
139 Tcl_CreateCommand (ti->ti_ii->interp, "ldap:debug", &tcl_ldap_debug,