r21606: Implement escaping function for ldap RDN values
authorSimo Sorce <idra@samba.org>
Thu, 1 Mar 2007 00:49:28 +0000 (00:49 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:18:16 +0000 (12:18 -0500)
commit5b4838f62ab1a92bfe02626ef40d7f94c2598322
tree1e5ef0d077032b2c3379a85d13da053eef101968
parent5ed61d5af6fe56e22135406256f5d1f7ccd6a376
r21606: Implement escaping function for ldap RDN values
Fix escaping of DN components and filters around the code
Add some notes to commandline help messages about how to pass DNs

revert jra's "concistency" commit to nsswitch/winbindd_ads.c, as it was
incorrect.
The 2 functions use DNs in different ways.

- lookup_usergroups_member() uses the DN in a search filter,
and must use the filter escaping function to escape it
Escaping filters that include escaped DNs ("\," becomes "\5c,") is the
correct way to do it (tested against W2k3).

- lookup_usergroups_memberof() instead uses the DN ultimately as a base dn.
Both functions do NOT need any DN escaping function as DNs can't be reliably
escaped when in a string form, intead each single RDN value must be escaped
separately.

DNs coming from other ldap calls (like ads_get_dn()), do not need escaping as
they come already escaped on the wire and passed as is by the ldap libraries

DN filtering has been tested.
For example now it is possible to do something like:
'net ads add user joe#5' as now the '#' character is correctly escaped when
building the DN, previously such a call failed with Invalid DN Syntax.

Simo.
source/lib/ldap_escape.c
source/lib/smbldap_util.c
source/libads/ldap.c
source/libads/ldap_user.c
source/nsswitch/winbindd_ads.c
source/passdb/pdb_ldap.c
source/printing/nt_printing.c
source/utils/net_ads.c
source/utils/net_ads_gpo.c