1 /* config.c - tcl backend configuration file routine
3 * $Id: tcl_config.c,v 1.4 1999/02/18 01:18:39 bcollins 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.
20 struct i_info *global_i;
31 struct tclinfo *ti = (struct tclinfo *) bd->be_private;
32 int script_loaded = 0;
36 "%s: line %d: tcl backend info is null!\n", fname,
40 if (ti->ti_ii == NULL) {
45 if (strcasecmp (argv[0], "scriptpath") == 0) {
47 Debug (LDAP_DEBUG_ANY,
48 "%s: line %d: missing script in \"scriptpath <script>\" line\n",
52 ti->script_path = (char *) ch_strdup (argv[1]);
54 /* use local interpreter */
55 } else if (strcasecmp (argv[0], "tclrealm") == 0) {
59 Debug (LDAP_DEBUG_ANY,
60 "%s: line %d: missing script in \"tclrealm <name>\" line\n",
67 /* Try to see if it already exists */
69 if (ii != NULL && !strcasecmp (ii->name, argv[1]))
73 } while (ii->next != NULL);
75 if (ti->ti_ii == NULL) { /* we need to make a new one */
76 ii->next = (struct i_info *) ch_malloc
77 (sizeof (struct i_info));
80 ii->next->name = (char *) ch_strdup (argv[1]);
81 ii->next->interp = NULL;
82 ii->next->next = NULL;
87 } else if (strcasecmp (argv[0], "bind") == 0) {
89 Debug (LDAP_DEBUG_ANY,
90 "%s: line %d: missing proc in \"bind <proc>\" line\n",
94 ti->ti_bind = (char *) ch_strdup (argv[1]);
96 /* proc for unbinds */
97 } else if (strcasecmp (argv[0], "unbind") == 0) {
99 Debug (LDAP_DEBUG_ANY,
100 "%s: line %d: missing proc in \"unbind <proc>\" line\n",
104 ti->ti_unbind = (char *) ch_strdup (argv[1]);
106 /* proc for search */
107 } else if (strcasecmp (argv[0], "search") == 0) {
109 Debug (LDAP_DEBUG_ANY,
110 "%s: line %d: missing proc in \"search <proc>\" line\n",
114 ti->ti_search = (char *) ch_strdup (argv[1]);
116 /* proc for compares */
117 } else if (strcasecmp (argv[0], "compare") == 0) {
119 Debug (LDAP_DEBUG_ANY,
120 "%s: line %d: missing proc in \"compare <proc>\" line\n",
124 ti->ti_compare = (char *) ch_strdup (argv[1]);
126 /* proc for modify */
127 } else if (strcasecmp (argv[0], "modify") == 0) {
129 Debug (LDAP_DEBUG_ANY,
130 "%s: line %d: missing proc in \"modify <proc>\" line\n",
134 ti->ti_modify = (char *) ch_strdup (argv[1]);
136 /* proc for modrdn */
137 } else if (strcasecmp (argv[0], "modrdn") == 0) {
139 Debug (LDAP_DEBUG_ANY,
140 "%s: line %d: missing proc in \"modrdn <proc>\" line\n",
144 ti->ti_modrdn = (char *) ch_strdup (argv[1]);
147 } else if (strcasecmp (argv[0], "add") == 0) {
149 Debug (LDAP_DEBUG_ANY,
150 "%s: line %d: missing proc in \"add <proc>\" line\n",
154 ti->ti_add = (char *) ch_strdup (argv[1]);
156 /* proc for delete */
157 } else if (strcasecmp (argv[0], "delete") == 0) {
159 Debug (LDAP_DEBUG_ANY,
160 "%s: line %d: missing proc in \"delete <proc>\" line\n",
164 ti->ti_delete = (char *) ch_strdup (argv[1]);
166 /* proc for abandon */
167 } else if (strcasecmp (argv[0], "abandon") == 0) {
169 Debug (LDAP_DEBUG_ANY,
170 "%s: line %d: missing proc in \"abandon <proc>\" line\n",
174 ti->ti_search = (char *) ch_strdup (argv[1]);
177 Debug (LDAP_DEBUG_ANY,
178 "Unknown tcl backend config: %s\n", argv[0], 0, 0);