r14931: Fix #1374: can't join an OU with name that contains '#'
authorJim McDonough <jmcd@samba.org>
Thu, 6 Apr 2006 01:46:01 +0000 (01:46 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:54 +0000 (11:15 -0500)
I had to eliminate "\" as an OU path separator, because it is the escape
char in LDAP.  We still accept "/", but using the escape char is just
not a good choice.

source/libads/ldap.c

index e1cea533a0e39b027f2de6663462ffe395e19db4..c2ebf14d2f93ff55badfdd2d07bd3a1ca99ab531 100644 (file)
@@ -1083,7 +1083,8 @@ ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn)
 /**
  * Build an org unit string
  *  if org unit is Computers or blank then assume a container, otherwise
- *  assume a \ separated list of organisational units
+ *  assume a / separated list of organisational units.
+ * jmcd: '\' is now used for escapes so certain chars can be in the ou (e.g. #)
  * @param ads connection to ads server
  * @param org_unit Organizational unit
  * @return org unit string - caller must free
@@ -1104,7 +1105,10 @@ char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit)
                return SMB_STRDUP("cn=Computers");
        }
 
-       return ads_build_path(org_unit, "\\/", "ou=", 1);
+       /* jmcd: removed "\\" from the separation chars, because it is
+          needed as an escape for chars like '#' which are valid in an
+          OU name */
+       return ads_build_path(org_unit, "/", "ou=", 1);
 }
 
 /**