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.
26 char *command, *results;
27 struct berval suf_tcl;
29 struct tclinfo *ti = (struct tclinfo *) be->be_private;
31 if (ti->ti_unbind.bv_len == 0) {
35 if (tcl_merge_bvlist (be->be_suffix, &suf_tcl) == NULL) {
39 command = (char *) ch_malloc (ti->ti_unbind.bv_len + suf_tcl.bv_len
40 + conn->c_dn.bv_len + 84);
41 sprintf (command, "%s UNBIND {%ld/%ld} {%s} {%s}",
42 ti->ti_unbind.bv_val, op->o_connid, (long) op->o_msgid,
43 suf_tcl.bv_val, conn->c_dn.bv_val ? conn->c_dn.bv_val : "");
44 Tcl_Free (suf_tcl.bv_val);
46 ldap_pvt_thread_mutex_lock (&tcl_interpreter_mutex);
47 code = Tcl_GlobalEval (ti->ti_ii->interp, command);
48 results = (char *) ch_strdup (ti->ti_ii->interp->result);
49 ldap_pvt_thread_mutex_unlock (&tcl_interpreter_mutex);
53 Debug (LDAP_DEBUG_SHELL, "tcl_unbind_error: %s\n", results,