[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.14 Accessing via LDAP

Procedures for accessing via LDAP.

Function: bind-ldap-service hostname dc password

binds the LDAP server.
hostname is a hostname, dc is a dc of a LDAP manager and password is a password.

An example is shown as follows.

(define ldap-connection
  (bind-ldap-service
     "hostname"  ; hostname
     "cn=Manager,dc=example,dc=com"  ; dc
     "secret"))  ; password
Function: select-ldap-service ldap-connection dn cond level

gets information from the LDAP server.
ldap-connection is a LDAP connection create by bind-ldap-service and dn is a dn to search.

The syntax of cond is shown as follows.

cond-expression
: (= attr value) ; equals
| (~= attr value) ; nearly equals
| (<= attr value) ; less than
| (>= attr value) ; grater than
| (and cond-expression …)
| (or cond-expression …)
| (not cond-expression)

level is the symbol shown as follows.

objectuntil the object
1leveluntil one level
subtreeuntil subtree

An example is shown as follows.

(select-ldap-service
  ldap-connection  ; bound LDAP connection
  "ou=User,dc=example,dc=com"  ; dn to search
  '(or (= "cn" "User*")
       (= "sn" "aaa*"))  ; searching condition
  'subtree)  ; object, 1level, subtree
Function: insert-ldap-service! ldap-connection dn value

inserts information to the LDAP server.
ldap-connection is a LDAP connection create by bind-ldap-service and dn is a dn to insert.

value is a list whose format is shown as follows. (("attr" "value1" …)
("attr" "value2" …)
...)

An example is shown as follows.

(insert-ldap-service!
  ldap-connection  ; bound LDAP connection
  "cn=User0001,ou=User,dc=example,dc=com"
  '(("cn" "User0001")
    ("sn" "aaaaa")
    ("objectclass" "top" "person" "organizationalPerson")))
Function: update-ldap-service! ldap-connection dn value

updates information of the LDAP server.
ldap-connection is a LDAP connection create by bind-ldap-service and dn is a dn to update.

value is a list whose format is shown as follows. ((replace "attr" "value1" …) ; update
(add "attr" "value2" …) ; add
(remove "attr") ; remove
...)

An example is shown as follows.

(update-ldap-service!
  ldap-connection  ; bound LDAP connection
  "cn=User0001,ou=User,dc=example,dc=com"
  '((replace "sn" "bbbb")
    (add     "description" "A description")
    (remove "mail")))
Function: delete-ldap-service! ldap-connection dn

deletes information of the LDAP server.
ldap-connection is a LDAP connection create by bind-ldap-service and dn is a dn to delete.

An example is shown as follows.

(delete-ldap-service!
  ldap-connection  ; bound LDAP connection
  "cn=User0001,ou=User,dc=example,dc=com")

[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on August 9, 2012 using texi2html 5.0.