Nasty OU names - patch to ldap.c

Ken Cross kcross at nssolutions.com
Mon Feb 24 17:59:24 GMT 2003


In reply to myself:

That's not a very general solution.  You run into the same problem if
the OU string contains "/".

I see two possibilities: supply the full OU string (yuck), or provide
some means to escape characters.

Any better ideas?

Ken
________________________________

Ken Cross

Network Storage Solutions
Phone 865.675.4070 ext 31
kcross at nssolutions.com 

> -----Original Message-----
> From: 
> samba-technical-bounces+kcross=nssolutions.com at lists.samba.org
>  
> [mailto:samba-technical-bounces+kcross=nssolutions.com at lists.s
> amba.org] On Behalf Of Ken Cross
> Sent: Monday, February 24, 2003 12:30 PM
> To: 'Multiple recipients of list SAMBA-TECHNICAL'
> Subject: Nasty OU names - patch to ldap.c
> 
> 
> Samba-folk:
> 
> 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
> ________________________________
> 
> Ken Cross
> 
> Network Storage Solutions
> Phone 865.675.4070 ext 31
> kcross at nssolutions.com 
> 
> 
> 
> 
> Index: ldap.c
> ===================================================================
> RCS file: /cvsroot/samba/source/libads/ldap.c,v
> retrieving revision 1.55.2.22
> diff -p -u -r1.55.2.22 ldap.c
> --- ldap.c      24 Feb 2003 03:43:49 -0000      1.55.2.22
> +++ 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