Library
Module
Module type
Parameter
Class
Class type
This class abstracts a connection to an LDAP server (or servers), an instance will be connected to the server you specify and can be used to perform operations on that server.
new ldapcon ~connect_timeout:5 ~version:3
["ldap://first.ldap.server";"ldap://second.ldap.server"]
.
In addition to specifying multiple urls, if DNS names are given, and those names are bound to multiple addresses, then all possible addresses will be tried.
new ldapcon ["ldaps://rrldap.csun.edu"]
is equivelant to
new ldapcon ["ldap://130.166.1.30";"ldap://130.166.1.31";"ldap://130.166.1.32"]
This means that if any host in the rr fails, the ldapcon will transparently move on to the next host, and you will never know the difference.
method bind : ?cred:string -> ?meth:Ldap_funclient.authmethod -> string -> unit
bind to the database using dn.
Simple Bind Example
ldap#bind ~cred:"password" "cn=foo,ou=people,ou=auth,o=bar"
To bind anonymously, omit ~cred, and leave dn blank eg.
Example
ldap#bind ""
method search : ?scope:Ldap_types.search_scope ->
?attrs:string list ->
?attrsonly:bool ->
?base:string ->
?sizelimit:Int32.t ->
?timelimit:Int32.t ->
string ->
ldapentry list
Search the directory syncronously for an entry which matches the search criteria.
Example
ldap#search ~base:"dc=foo,dc=bar" ~attrs:["cn"] "uid=*"
method search_a : ?scope:Ldap_types.search_scope ->
?attrs:string list ->
?attrsonly:bool ->
?base:string ->
?sizelimit:Int32.t ->
?timelimit:Int32.t ->
string ->
?abandon:bool ->
unit ->
ldapentry
Search the directory asyncronously, otherwise the same as search.
method rawschema : ldapentry
Fetch the raw (unparsed) schema from the directory using the standard mechanism (requires protocol version 3)
method schema : Ldap_schemaparser.schema
Fetch and parse the schema from the directory via the standard mechanism (requires version 3). Return a structured representation of the schema indexed by canonical name, and oid.
method add : ldapentry -> unit
add an entry to the database
method modify : string ->
(Ldap_types.modify_optype * string * string list) list ->
unit
Modify the entry named by dn, applying mods
Example
ldap#modify "uid=foo,ou=people,dc=bar,dc=baz" [(`DELETE, "cn", ["foo";"bar"])]
method update_entry : ldapentry -> unit
Syncronize changes made locally to an ldapentry with the directory.
Modify the rdn of the object named by dn, if the protocol version is 3 you may additionally change the superior, the rdn will be changed to the attribute represented (as a string) by newrdn,
Example With New Superior
ldap#modrdn ~newsup:(Some "o=csun") "cn=bob,ou=people,o=org" "uid=bperson"
After this example "cn=bob,ou=people,o=org" will end up as "uid=bperson,o=csun".