Nasty OU names - patch to ldap.c

Ken Cross kcross at
Mon Feb 24 17:30:19 GMT 2003


I've run into a problem using "net ads join OU", where OU is an
Organizational Unit.  

An OU can have virtually any name, e.g., "Planes, Trains, &
Automobiles".  When returned from the Active Directory, it's in the form
"Planes\, Trains\, & Automobiles".  That's the only form that it will
accept when specifying the OU.

When passed to net in this form, ads_ou_string uses "\" as a separator.
I'm not sure of the reason for this, but it makes it impossible to
specify the OU above.

A simple patch (shown below for SAMBA_3_0) removes this, but leaves the
"/" separator.  Now this OU works.

Anybody know if this will break something?


Ken Cross

Network Storage Solutions
Phone 865.675.4070 ext 31
kcross at 

Index: ldap.c
RCS file: /cvsroot/samba/source/libads/ldap.c,v
retrieving revision
diff -p -u -r1.55.2.22 ldap.c
--- ldap.c      24 Feb 2003 03:43:49 -0000
+++ ldap.c      24 Feb 2003 17:21:15 -0000
@@ -1015,7 +1015,7 @@ char *ads_ou_string(const char *org_unit
                return strdup("cn=Computers");
-       return ads_build_path(org_unit, "\\/", "ou=", 1);
+       return ads_build_path(org_unit, "/", "ou=", 1); /* KJC - removed
\\ from separators */

More information about the samba-technical mailing list