2 /* unbind.c - tcl unbind routines
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.
25 char *command, *results;
26 struct berval suf_tcl;
28 struct tclinfo *ti = (struct tclinfo *) op->o_bd->be_private;
30 if (ti->ti_unbind.bv_len == 0) {
34 if (tcl_merge_bvlist (op->o_bd->be_suffix, &suf_tcl) == NULL) {
38 command = (char *) ch_malloc (ti->ti_unbind.bv_len + suf_tcl.bv_len
39 + op->o_conn->c_dn.bv_len + 84);
40 sprintf (command, "%s UNBIND {%ld/%ld} {%s} {%s}",
41 ti->ti_unbind.bv_val, op->o_connid, (long) op->o_msgid,
42 suf_tcl.bv_val, op->o_conn->c_dn.bv_val ? op->o_conn->c_dn.bv_val : "");
43 Tcl_Free (suf_tcl.bv_val);
45 ldap_pvt_thread_mutex_lock (&tcl_interpreter_mutex);
46 code = Tcl_GlobalEval (ti->ti_ii->interp, command);
47 results = (char *) ch_strdup (ti->ti_ii->interp->result);
48 ldap_pvt_thread_mutex_unlock (&tcl_interpreter_mutex);
52 Debug (LDAP_DEBUG_SHELL, "tcl_unbind_error: %s\n", results,