You are here

README.developers.txt in Lightweight Directory Access Protocol (LDAP) 7

Same filename and directory in other branches
  1. 8.2 README.developers.txt
  2. 7.2 README.developers.txt

--------------------------------------------------------
Case Sensitivity and Character Escaping in LDAP Modules
--------------------------------------------------------

The function ldap_server_massage_text() should be used for dealing with case sensitivity
and character escaping consistently.

The general rule is codified in ldap_server_massage_text() which is:
- escape filter values and attribute values when querying ldap
- use unescaped, lower case attribute names when storing attribute names in arrays (as keys or values), databases, or object properties.
- use unescaped, mixed case attribute values when storing attribute values in arrays (as keys or values), databases, or object properties.

So a filter might be built as follows:

  $username = ldap_server_massage_text($username, 'attr_value', LDAP_SERVER_MASSAGE_QUERY_LDAP)
  $objectclass = ldap_server_massage_text($objectclass, 'attr_value', LDAP_SERVER_MASSAGE_QUERY_LDAP)
  $filter = "(&(cn=$username)(objectClass=$objectclass))";


The following functions are also available:
ldap_pear_escape_dn_value()
ldap_pear_unescape_dn_value()
ldap_pear_unescape_filter_value()
ldap_pear_unescape_filter_value()

File

README.developers.txt
View source
  1. --------------------------------------------------------
  2. Case Sensitivity and Character Escaping in LDAP Modules
  3. --------------------------------------------------------
  4. The function ldap_server_massage_text() should be used for dealing with case sensitivity
  5. and character escaping consistently.
  6. The general rule is codified in ldap_server_massage_text() which is:
  7. - escape filter values and attribute values when querying ldap
  8. - use unescaped, lower case attribute names when storing attribute names in arrays (as keys or values), databases, or object properties.
  9. - use unescaped, mixed case attribute values when storing attribute values in arrays (as keys or values), databases, or object properties.
  10. So a filter might be built as follows:
  11. $username = ldap_server_massage_text($username, 'attr_value', LDAP_SERVER_MASSAGE_QUERY_LDAP)
  12. $objectclass = ldap_server_massage_text($objectclass, 'attr_value', LDAP_SERVER_MASSAGE_QUERY_LDAP)
  13. $filter = "(&(cn=$username)(objectClass=$objectclass))";
  14. The following functions are also available:
  15. ldap_pear_escape_dn_value()
  16. ldap_pear_unescape_dn_value()
  17. ldap_pear_unescape_filter_value()
  18. ldap_pear_unescape_filter_value()