2 /* config.c - tcl backend configuration file routine
4 * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
19 struct i_info *global_i;
30 struct tclinfo *ti = (struct tclinfo *) bd->be_private;
31 int script_loaded = 0;
35 "%s: line %d: tcl backend info is null!\n", fname,
39 if (ti->ti_ii == NULL) {
44 if (strcasecmp (argv[0], "scriptpath") == 0) {
46 Debug (LDAP_DEBUG_CONFIG,
47 "%s: line %d: missing script in \"scriptpath <script>\" line\n",
51 ti->script_path = (char *) ch_strdup (argv[1]);
53 /* use local interpreter */
54 } else if (strcasecmp (argv[0], "tclrealm") == 0) {
58 Debug (LDAP_DEBUG_CONFIG,
59 "%s: line %d: missing script in \"tclrealm <name>\" line\n",
66 /* Try to see if it already exists */
68 if (ii != NULL && !strcasecmp (ii->name, argv[1]))
72 } while (ii->next != NULL);
74 if (ti->ti_ii == NULL) { /* we need to make a new one */
75 ii->next = (struct i_info *) ch_malloc
76 (sizeof (struct i_info));
79 ii->next->name = (char *) ch_strdup (argv[1]);
80 ii->next->interp = NULL;
81 ii->next->next = NULL;
86 } else if (strcasecmp (argv[0], "bind") == 0) {
88 Debug (LDAP_DEBUG_CONFIG,
89 "%s: line %d: missing proc in \"bind <proc>\" line\n",
93 ti->ti_bind = (char *) ch_strdup (argv[1]);
95 /* proc for unbinds */
96 } else if (strcasecmp (argv[0], "unbind") == 0) {
98 Debug (LDAP_DEBUG_CONFIG,
99 "%s: line %d: missing proc in \"unbind <proc>\" line\n",
103 ti->ti_unbind = (char *) ch_strdup (argv[1]);
105 /* proc for search */
106 } else if (strcasecmp (argv[0], "search") == 0) {
108 Debug (LDAP_DEBUG_CONFIG,
109 "%s: line %d: missing proc in \"search <proc>\" line\n",
113 ti->ti_search = (char *) ch_strdup (argv[1]);
115 /* proc for compares */
116 } else if (strcasecmp (argv[0], "compare") == 0) {
118 Debug (LDAP_DEBUG_CONFIG,
119 "%s: line %d: missing proc in \"compare <proc>\" line\n",
123 ti->ti_compare = (char *) ch_strdup (argv[1]);
125 /* proc for modify */
126 } else if (strcasecmp (argv[0], "modify") == 0) {
128 Debug (LDAP_DEBUG_CONFIG,
129 "%s: line %d: missing proc in \"modify <proc>\" line\n",
133 ti->ti_modify = (char *) ch_strdup (argv[1]);
135 /* proc for modrdn */
136 } else if (strcasecmp (argv[0], "modrdn") == 0) {
138 Debug (LDAP_DEBUG_CONFIG,
139 "%s: line %d: missing proc in \"modrdn <proc>\" line\n",
143 ti->ti_modrdn = (char *) ch_strdup (argv[1]);
146 } else if (strcasecmp (argv[0], "add") == 0) {
148 Debug (LDAP_DEBUG_CONFIG,
149 "%s: line %d: missing proc in \"add <proc>\" line\n",
153 ti->ti_add = (char *) ch_strdup (argv[1]);
155 /* proc for delete */
156 } else if (strcasecmp (argv[0], "delete") == 0) {
158 Debug (LDAP_DEBUG_CONFIG,
159 "%s: line %d: missing proc in \"delete <proc>\" line\n",
163 ti->ti_delete = (char *) ch_strdup (argv[1]);
165 /* proc for abandon */
166 } else if (strcasecmp (argv[0], "abandon") == 0) {
168 Debug (LDAP_DEBUG_CONFIG,
169 "%s: line %d: missing proc in \"abandon <proc>\" line\n",
173 ti->ti_search = (char *) ch_strdup (argv[1]);
176 Debug (LDAP_DEBUG_CONFIG,
177 "Unknown tcl backend config: %s\n", argv[0], 0, 0);