2002-05-03 00:35:16 +08:00
|
|
|
.TH SLAPD-TCL 5 "2 May 2002" "OpenLDAP LDVERSION"
|
2002-04-30 04:24:29 +08:00
|
|
|
.\" $OpenLDAP$
|
|
|
|
.SH NAME
|
|
|
|
slapd-tcl \- Tcl backend to slapd
|
|
|
|
.SH SYNOPSIS
|
|
|
|
ETCDIR/slapd.conf
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The Tcl backend to
|
|
|
|
.BR slapd (8)
|
|
|
|
works by embedding a
|
|
|
|
.BR Tcl (3tcl)
|
|
|
|
interpreter into
|
|
|
|
.BR slapd (8).
|
|
|
|
Any tcl database section of the configuration file
|
|
|
|
.BR slapd.conf (5)
|
|
|
|
must then specify what Tcl script to use.
|
2002-05-09 10:11:39 +08:00
|
|
|
.SH WARNING
|
|
|
|
.B "This backend's calling conventions have changed since OpenLDAP 2.0."
|
|
|
|
Previously, the 2nd argument to the procs was a message ID.
|
|
|
|
Now they are an "operation ID" string.
|
|
|
|
Also, proc abandon now gets a new
|
|
|
|
.B abandonid
|
|
|
|
argument.
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH CONFIGURATION
|
2002-05-02 00:38:30 +08:00
|
|
|
These
|
|
|
|
.B slapd.conf
|
|
|
|
options apply to the TCL backend database.
|
2002-04-30 04:24:29 +08:00
|
|
|
That is, they must follow a "database tcl" line and come before any
|
|
|
|
subsequent "backend" or "database" lines.
|
|
|
|
Other database options are described in the
|
|
|
|
.BR slapd.conf (5)
|
|
|
|
manual page.
|
|
|
|
.TP
|
|
|
|
.B scriptpath <filename.tcl>
|
2002-05-02 00:38:30 +08:00
|
|
|
The full path to the tcl script used for this database.
|
|
|
|
.LP
|
2002-04-30 04:24:29 +08:00
|
|
|
.B search <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B add <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B delete <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B modify <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B bind <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B unbind <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B modrdn <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B compare <proc>
|
2002-05-02 00:38:30 +08:00
|
|
|
.br
|
2002-04-30 04:24:29 +08:00
|
|
|
.B abandon <proc>
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
The procs for each ldap function.
|
2002-05-03 00:35:16 +08:00
|
|
|
They refer to the tcl procs in the `scriptpath' script that handles them.
|
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
|
|
|
.B tclrealm <interpreter name>
|
|
|
|
This is one of the biggest pluses of using the tcl backend.
|
|
|
|
The realm lets you group several databases to the same interpreter.
|
|
|
|
This basically means they share the same global variables and proc space.
|
|
|
|
So global variables, as well as all the procs, are callable between databases.
|
|
|
|
If no tclrealm is specified, it is put into the "default" realm.
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH Variables passed to the procs
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B abandon { action opid suffix abandonid }
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-09 10:11:39 +08:00
|
|
|
action - Always equal to ABANDON.
|
|
|
|
opid - The opid of this ldap operation.
|
|
|
|
suffix - List of suffix(es) associated with the
|
|
|
|
call. Each one is an entry in a tcl
|
|
|
|
formatted list (surrounded by {}'s).
|
|
|
|
abandonid - The opid of the operation to abandon.
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B add "{ action opid suffix entry }"
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to ADD.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
entry - Full entry to add. Each "type: val" is
|
|
|
|
an element in a tcl formatted list.
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B bind "{ action opid suffix dn method cred_len cred }"
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to BIND.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
dn - DN being bound to.
|
|
|
|
method - One of the ldap authentication methods.
|
|
|
|
cred_len - Length of cred.
|
|
|
|
cred - Credentials being used to authenticate,
|
|
|
|
according to RFC. If this value is empty,
|
|
|
|
then it should be considered an anonymous
|
|
|
|
bind (??)
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B compare "{ action opid suffix dn ava_type ava_value }"
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to COMPARE.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
dn - DN for compare.
|
|
|
|
ava_type - Type for comparison.
|
|
|
|
ava_value - Value to compare.
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B delete "{ action opid suffix dn }"
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to DELETE.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
dn - DN to delete.
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B modify "{ action opid suffix dn mods }"
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to MODIFY.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
dn - DN to modify.
|
|
|
|
mods - Tcl list of modifications.
|
|
|
|
The list is formatted in this way:
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
{
|
|
|
|
{ {op: type} {type: val} }
|
|
|
|
{ {op: type} {type: val} {type: val} }
|
|
|
|
...
|
|
|
|
}
|
2002-04-30 04:24:29 +08:00
|
|
|
|
2002-05-03 00:35:16 +08:00
|
|
|
Newlines are not present in the actual var,
|
|
|
|
they are present here for clarification.
|
|
|
|
"op" is the type of modification
|
|
|
|
(ADD, DELETE, REPLACE).
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B modrdn "{ action opid suffix dn newrdn deleteoldrdn }"
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to MODRDN.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
dn - DN whose RDN is being renamed.
|
|
|
|
newrdn - New RDN.
|
|
|
|
deleteoldrdn - Boolean stating whether or not the
|
|
|
|
old RDN should be removed after being renamed.
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
.B
|
2002-05-09 10:11:39 +08:00
|
|
|
search { action opid suffix base scope deref \
|
2002-05-02 00:38:30 +08:00
|
|
|
sizelimit timelimit filterstr attrsonly attrlist }
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to SEARCH.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
base - Base for this search.
|
|
|
|
scope - Scope of search, ( 0 | 1 | 2 ).
|
|
|
|
deref - Alias dereferencing ( 0 | 1 | 2 | 3 ).
|
|
|
|
sizelimit - Maximum number of entries to return.
|
|
|
|
timelimit - Time limit for search.
|
|
|
|
filterstr - Filter string as sent by the requester.
|
|
|
|
attrsonly - Boolean for whether to list only the
|
|
|
|
attributes, and not values as well.
|
|
|
|
attrlist - Tcl list if to retrieve.
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.TP
|
2002-05-09 10:11:39 +08:00
|
|
|
.B unbind "{ action opid suffix dn }"
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
action - Always equal to UNBIND.
|
2002-05-09 10:11:39 +08:00
|
|
|
opid - The opid of this ldap operation.
|
2002-05-03 00:35:16 +08:00
|
|
|
suffix - List of suffix(es), as above.
|
|
|
|
dn - DN to unbind.
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
|
|
|
.LP
|
2002-05-09 10:11:39 +08:00
|
|
|
An
|
|
|
|
.I opid
|
|
|
|
(operation ID) is a "connection ID/message ID" string identifying an
|
|
|
|
operation.
|
|
|
|
.LP
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH Return Method and Syntax
|
2002-04-30 04:24:29 +08:00
|
|
|
There are only 2 return types.
|
|
|
|
All procs must return a result to show status of the operation.
|
|
|
|
The result is in this form:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
{ RESULT {code: <integer>} {matched: <partialdn>}
|
|
|
|
{info: <string>} {} }
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
This is best accomplished with this type of tcl code
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
|
|
|
lappend ret_val "RESULT"
|
|
|
|
lappend ret_val "code: 0"
|
|
|
|
lappend ret_val ""
|
|
|
|
return $ret_val
|
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
The final empty string (item in list) is necessary to point to the end
|
|
|
|
of list.
|
|
|
|
The `code', `matched', and `info' values are not necessary, and
|
|
|
|
default values are given if not specified.
|
|
|
|
The `code' value is usually an LDAP error in decimal notation from
|
|
|
|
ldap.h.
|
|
|
|
The `info', may be sent back to the client, depending on the
|
|
|
|
function.
|
|
|
|
In the bind proc, LDAP uses the value of `code' to indicate whether or
|
|
|
|
not the authentication is acceptable.
|
|
|
|
.LP
|
|
|
|
The other type of return is for searches.
|
|
|
|
It is similar format to the shell backend return (as is most of the
|
|
|
|
syntax here).
|
|
|
|
Its format follows:
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
{dn: o=Company, c=US} {attr: val} {objectclass: val} {}
|
|
|
|
{dn: o=CompanyB, c=US} {attr: val} {objectclass: val} {}
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
Again, newlines are for visual purposes here.
|
|
|
|
Also note the {} marking the end of the entry (same effect as a
|
|
|
|
newline in ldif format).
|
|
|
|
Here is some example code again, showing a full search proc example.
|
|
|
|
.LP
|
2002-05-03 00:35:16 +08:00
|
|
|
.RS
|
2002-04-30 04:24:29 +08:00
|
|
|
.nf
|
2002-05-03 00:35:16 +08:00
|
|
|
# Note that `args' lets you lump all possible args
|
|
|
|
# into one var, used here for simplicity of example
|
|
|
|
proc ldap:search { args } {
|
|
|
|
# ...perform some operations...
|
|
|
|
|
|
|
|
lappend ret_val "dn: $rdn,$base"
|
|
|
|
lappend ret_val "objectclass: $objcl"
|
|
|
|
lappend ret_val "sn: $rdn"
|
|
|
|
lappend ret_val "mail: $email"
|
|
|
|
lappend ret_val ""
|
|
|
|
# Now setup the result
|
|
|
|
lappend ret_val "RESULT"
|
|
|
|
lappend ret_val "code: 0"
|
|
|
|
lappend ret_val ""
|
|
|
|
return $ret_val
|
|
|
|
}
|
2002-04-30 04:24:29 +08:00
|
|
|
.fi
|
2002-05-03 00:35:16 +08:00
|
|
|
.RE
|
2002-04-30 04:24:29 +08:00
|
|
|
.LP
|
|
|
|
NOTE: Newlines in the return value is acceptable in search entries
|
|
|
|
(i.e. when returning base64 encoded binary entries).
|
|
|
|
.LP
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH Builtin Commands and Variables
|
2002-04-30 04:24:29 +08:00
|
|
|
.TP
|
|
|
|
.B ldap:debug <msg>
|
|
|
|
Allows you to send debug messages through OpenLDAP's native debugging
|
|
|
|
system, this is sent as a LDAP_DEBUG_ANY and will be logged.
|
|
|
|
Useful for debugging scripts or logging bind failures.
|
2002-05-02 00:38:30 +08:00
|
|
|
.SH FILES
|
2002-05-09 10:07:41 +08:00
|
|
|
.TP
|
2002-05-02 00:38:30 +08:00
|
|
|
ETCDIR/slapd.conf
|
2002-05-09 10:07:41 +08:00
|
|
|
default slapd configuration file
|
2002-04-30 04:24:29 +08:00
|
|
|
.SH SEE ALSO
|
|
|
|
.BR slapd.conf (5),
|
|
|
|
.BR slapd (8),
|
|
|
|
.BR Tcl (3tcl).
|