]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-tcl/tcl_util.c
Don't use 'shtool mkln' as ln(1) replacement.
[openldap] / servers / slapd / back-tcl / tcl_util.c
index 342e75c5f8bb00c63485cc2e35365c5437e1dfdc..85f156aabbaa3cfb5c039e6966af138d23120d0c 100644 (file)
@@ -1,6 +1,5 @@
+/* $OpenLDAP$ */
 /* result.c - tcl backend utility functions
- *
- * $Id: tcl_util.c,v 1.2 1999/02/17 01:05:28 bcollins Exp $
  *
  * Copyright 1999, Ben Collins <bcollins@debian.org>, All rights reserved.
  *
@@ -27,7 +26,7 @@ interp_send_results (
        Connection * conn,
        Operation * op,
        char *result,
-       char **attrs,
+       AttributeName *attrs,
        int attrsonly
 )
 {
@@ -47,7 +46,7 @@ interp_send_results (
        if (code != TCL_OK) {
                argcPtr = 0;
                send_ldap_result (conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
-                       "internal backend error");
+                       "internal backend error", NULL, NULL );
                return -1;
        }
        for (i = 0; i < argcPtr; i++) {
@@ -75,12 +74,12 @@ interp_send_results (
                                break;
                        }
                        if ((e = str2entry (buf)) == NULL) {
-                               Debug (LDAP_DEBUG_ANY,
+                               Debug (LDAP_DEBUG_SHELL,
                                        "str2entry(%s) failed\n",
                                        buf, 0, 0);
                        } else {
                                send_search_entry (be, conn, op, e, attrs,
-                                       attrsonly);
+                                       attrsonly, NULL );
                                entry_free (e);
                        }
 
@@ -94,7 +93,7 @@ interp_send_results (
         * otherwise, front end will send this result 
         */
        if (err != 0 || op->o_tag != LDAP_REQ_BIND) {
-               send_ldap_result (conn, op, err, matched, info);
+               send_ldap_result (conn, op, err, matched, info, NULL, NULL );
        }
 
        free (buf);
@@ -110,9 +109,8 @@ tcl_clean_entry (
        char *entrystr, *mark1, *mark2, *buf, *bp, *dup;
        int len, bsize;
 
-       pthread_mutex_lock (&entry2str_mutex);
-       entrystr = entry2str (e, &len, 0);
-       pthread_mutex_unlock (&entry2str_mutex);
+       ldap_pvt_thread_mutex_lock(&entry2str_mutex);
+       entrystr = entry2str (e, &len);
 
        buf = (char *) ch_malloc (BUFSIZ);
        buf[0] = '\0';
@@ -125,7 +123,7 @@ tcl_clean_entry (
                if (mark1[0] == '\n') {
                        mark1++;
                }
-               dup = (char *) strdup (mark1);
+               dup = (char *) ch_strdup (mark1);
                if (dup[0] != '\0') {
                        if ((mark2 = (char *) strchr (dup, '\n')) != NULL) {
                                mark2[0] = '\0';
@@ -147,6 +145,8 @@ tcl_clean_entry (
                }
                free (dup);
        } while ((mark1 = (char *) strchr (mark1, '\n')) != NULL);
+
+       ldap_pvt_thread_mutex_unlock (&entry2str_mutex);
        return buf;
 }
 
@@ -159,7 +159,7 @@ tcl_ldap_debug (
 )
 {
        if (argv[1] != NULL) {
-               Debug (LDAP_DEBUG_ANY, "tcl_debug: %s\n", argv[1], 0, 0);
+               Debug (LDAP_DEBUG_SHELL, "tcl_debug: %s\n", argv[1], 0, 0);
        }
        return TCL_OK;
 }
@@ -174,16 +174,16 @@ readtclscript (
 
        f = fopen (script, "r");
        if (f == NULL) {
-               Debug (LDAP_DEBUG_ANY, "Could not open scriptpath %s\n", script,
+               Debug (LDAP_DEBUG_SHELL, "Could not open scriptpath %s\n", script,
                        0, 0);
                return;
        }
        fclose (f);
        code = Tcl_EvalFile (my_tcl, script);
        if (code != TCL_OK) {
-               Debug (LDAP_DEBUG_ANY, "%s: %s\n", script,
+               Debug (LDAP_DEBUG_SHELL, "%s: %s\n", script,
                        Tcl_GetVar (my_tcl, "errorInfo", TCL_GLOBAL_ONLY), 0);
-               Debug (LDAP_DEBUG_ANY, "%s: error at line\n", script,
+               Debug (LDAP_DEBUG_SHELL, "%s: error at line\n", script,
                        my_tcl->errorLine, 0);
                return;
        }