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;
34 "%s: line %d: tcl backend info is null!\n", fname,
38 if (ti->ti_ii == NULL) {
43 if (strcasecmp (argv[0], "scriptpath") == 0) {
45 Debug (LDAP_DEBUG_CONFIG,
46 "%s: line %d: missing script in \"scriptpath <script>\" line\n",
50 ber_str2bv( argv[1], 0, 1, &ti->ti_script_path );
52 /* use local interpreter */
53 } else if (strcasecmp (argv[0], "tclrealm") == 0) {
57 Debug (LDAP_DEBUG_CONFIG,
58 "%s: line %d: missing script in \"tclrealm <name>\" line\n",
65 /* Try to see if it already exists */
67 if (ii != NULL && !strcasecmp (ii->name, argv[1]))
71 } while (ii->next != NULL);
73 if (ti->ti_ii == NULL) { /* we need to make a new one */
74 ii->next = (struct i_info *) ch_malloc
75 (sizeof (struct i_info));
78 ii->next->name = (char *) ch_strdup (argv[1]);
79 ii->next->interp = NULL;
80 ii->next->next = NULL;
85 } else if (strcasecmp (argv[0], "bind") == 0) {
87 Debug (LDAP_DEBUG_CONFIG,
88 "%s: line %d: missing proc in \"bind <proc>\" line\n",
92 ber_str2bv( argv[1], 0, 1, &ti->ti_bind );
94 /* proc for unbinds */
95 } else if (strcasecmp (argv[0], "unbind") == 0) {
97 Debug (LDAP_DEBUG_CONFIG,
98 "%s: line %d: missing proc in \"unbind <proc>\" line\n",
102 ber_str2bv( argv[1], 0, 1, &ti->ti_unbind );
104 /* proc for search */
105 } else if (strcasecmp (argv[0], "search") == 0) {
107 Debug (LDAP_DEBUG_CONFIG,
108 "%s: line %d: missing proc in \"search <proc>\" line\n",
112 ber_str2bv( argv[1], 0, 1, &ti->ti_search );
114 /* proc for compares */
115 } else if (strcasecmp (argv[0], "compare") == 0) {
117 Debug (LDAP_DEBUG_CONFIG,
118 "%s: line %d: missing proc in \"compare <proc>\" line\n",
122 ber_str2bv( argv[1], 0, 1, &ti->ti_compare );
124 /* proc for modify */
125 } else if (strcasecmp (argv[0], "modify") == 0) {
127 Debug (LDAP_DEBUG_CONFIG,
128 "%s: line %d: missing proc in \"modify <proc>\" line\n",
132 ber_str2bv( argv[1], 0, 1, &ti->ti_modify );
134 /* proc for modrdn */
135 } else if (strcasecmp (argv[0], "modrdn") == 0) {
137 Debug (LDAP_DEBUG_CONFIG,
138 "%s: line %d: missing proc in \"modrdn <proc>\" line\n",
142 ber_str2bv( argv[1], 0, 1, &ti->ti_modrdn );
145 } else if (strcasecmp (argv[0], "add") == 0) {
147 Debug (LDAP_DEBUG_CONFIG,
148 "%s: line %d: missing proc in \"add <proc>\" line\n",
152 ber_str2bv( argv[1], 0, 1, &ti->ti_add );
154 /* proc for delete */
155 } else if (strcasecmp (argv[0], "delete") == 0) {
157 Debug (LDAP_DEBUG_CONFIG,
158 "%s: line %d: missing proc in \"delete <proc>\" line\n",
162 ber_str2bv( argv[1], 0, 1, &ti->ti_delete );
164 /* proc for abandon */
165 } else if (strcasecmp (argv[0], "abandon") == 0) {
167 Debug (LDAP_DEBUG_CONFIG,
168 "%s: line %d: missing proc in \"abandon <proc>\" line\n",
172 ber_str2bv( argv[1], 0, 1, &ti->ti_abandon );
175 Debug (LDAP_DEBUG_CONFIG,
176 "Unknown tcl backend config: %s\n", argv[0], 0, 0);