]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-tcl/tcl_config.c
#include <ac/string.h> to get strcasecmp().
[openldap] / servers / slapd / back-tcl / tcl_config.c
index 6b7ab1f269ff8bce42c16376f1fa40cff83e895b..f7ceed9a661fbf2a49c4d642f4a92fdbc114f5a1 100644 (file)
@@ -1,6 +1,5 @@
+/* $OpenLDAP$ */
 /* config.c - tcl backend configuration file routine
- *
- * $Id: tcl_config.c,v 1.4 1999/02/18 01:18:39 bcollins Exp $
  *
  * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
  *
@@ -22,14 +21,13 @@ struct i_info *global_i;
 int
 tcl_back_db_config (
        BackendDB * bd,
-       char *fname,
+       const char *fname,
        int lineno,
        int argc,
        char **argv
 )
 {
        struct tclinfo *ti = (struct tclinfo *) bd->be_private;
-       int script_loaded = 0;
 
        if (ti == NULL) {
                fprintf (stderr,
@@ -44,19 +42,19 @@ tcl_back_db_config (
        /* Script to load */
        if (strcasecmp (argv[0], "scriptpath") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing script in \"scriptpath <script>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->script_path = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_script_path );
 
                /* use local interpreter */
        } else if (strcasecmp (argv[0], "tclrealm") == 0) {
                struct i_info *ii;
 
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing script in \"tclrealm <name>\" line\n",
                                fname, lineno, 0);
                        return (1);
@@ -86,95 +84,95 @@ tcl_back_db_config (
                /* proc for binds */
        } else if (strcasecmp (argv[0], "bind") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"bind <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_bind = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_bind );
 
                /* proc for unbinds */
        } else if (strcasecmp (argv[0], "unbind") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"unbind <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_unbind = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_unbind );
 
                /* proc for search */
        } else if (strcasecmp (argv[0], "search") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"search <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_search = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_search );
 
                /* proc for compares */
        } else if (strcasecmp (argv[0], "compare") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"compare <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_compare = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_compare );
 
                /* proc for modify */
        } else if (strcasecmp (argv[0], "modify") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"modify <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_modify = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_modify );
 
                /* proc for modrdn */
        } else if (strcasecmp (argv[0], "modrdn") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"modrdn <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_modrdn = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_modrdn );
 
                /* proc for add */
        } else if (strcasecmp (argv[0], "add") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"add <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_add = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_add );
 
                /* proc for delete */
        } else if (strcasecmp (argv[0], "delete") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"delete <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_delete = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_delete );
 
                /* proc for abandon */
        } else if (strcasecmp (argv[0], "abandon") == 0) {
                if (argc < 2) {
-                       Debug (LDAP_DEBUG_ANY,
+                       Debug (LDAP_DEBUG_CONFIG,
                                "%s: line %d: missing proc in \"abandon <proc>\" line\n",
                                fname, lineno, 0);
                        return (1);
                }
-               ti->ti_search = (char *) ch_strdup (argv[1]);
+               ber_str2bv( argv[1], 0, 1, &ti->ti_abandon );
 
        } else {
-               Debug (LDAP_DEBUG_ANY,
+               Debug (LDAP_DEBUG_CONFIG,
                        "Unknown tcl backend config: %s\n", argv[0], 0, 0);
                return (1);
        }