ldap-ffi:   a Racket LDAP client built on top of libldap C API
ldap%
new
set-option
bind
modify
add
delete
search
search*
compare
get-data
count-entries
set-password
rename-dn
unbind
clear
exn:  fail:  ldap
7.7

ldap-ffi: a Racket LDAP client built on top of libldap C API

Dmitry Bulaev <dmitryhertz@gmail.com>

 (require ldap-ffi) package: ldap-ffi

This package provides an FFI binding to the libldap: the Lightweight Directory Access Protocol (LDAP) client library which is used for access to X.500 directory services.

class

ldap% : class?

  superclass: object%

constructor

(new ldap%    
    [host host]    
    [[version version]    
    [root-dn root-dn]    
    [password password]])  (is-a?/c ldap%)
  host : string?
  version : (or/c 2 3) = 3
  root-dn : (or/c string? #f) = #f
  password : (or/c string? #f) = #f
Constructs a new ldap object, initializes libldap and set the version (LDAPv3 is default version).

method

(send a-ldap set-option key value)  #t

  key : positive?
  value : positive?
Set LDAP related options.

If the set-option fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap bind [mechanism])  #t

  mechanism : (or/c 0 1 2) = 0
Authenticate to the directory server.

If the bind fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap modify user-dn mod-list)  #t

  user-dn : string?
  mod-list : (listof (list/c number? string? (listof string?)))
Modify an entry.

If the modify fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap add user-dn mod-list)  #t

  user-dn : string?
  mod-list : (listof (list/c number? string? (listof string?)))
Add a new entry.

If the add fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap delete dn)  #t

  dn : string?
Delete an entry.

If the delete fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap search base-dn fltr scope)  #t

  base-dn : string?
  fltr : string?
  scope : (or/c 0 1 2)
Search for the LDAP directory entries and write retrieved data to the internal box storage.

If the search fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap search* base-dn fltr scope)  (listof list?)

  base-dn : string?
  fltr : string?
  scope : (or/c 0 1 2)
Equivalent to search but returs (listof list?) (instead of #t) then clears the object’s internal ldap-message storage.

If the search* fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap compare dn attr value)  boolean?

  dn : string?
  attr : string?
  value : string?
Check whether or not an entry contains the same attribute value as given.

If the compare fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap get-data)  (listof list?)

Return retrieved data from the internal box storage. It doesn’t make a request to the LDAP server.

method

(send a-ldap count-entries)  (or/c zero? positive?)

Return the number of retrieved entries or 0 otherwise.

method

(send a-ldap set-password user oldpw newpw)  boolean?

  user : string?
  oldpw : string?
  newpw : string?
Set a new password.

If the set-password fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap rename-dn dn    
  newrdn    
  new-superior    
  delete-old-rdn)  #t
  dn : string?
  newrdn : string?
  new-superior : string?
  delete-old-rdn : (or/c 0 1)
Rename the DN of an LDAP entry or move it from one superior to another.

If the rename-dn fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap unbind)  #t

Close the connection to the directory server.

If the unbind fails, then an instance of exn:fail:libldap is raised.

method

(send a-ldap clear)  void?

Clear the object’s internal box storage where the latest returned ldap-message storages itself.

struct

(struct exn:fail:ldap exn:fail:user ()
    #:extra-constructor-name make-exn:fail:ldap)
An exception structure type for reporting errors from the underlying libldap library.