From: Graham B. <gb...@po...> - 2001-03-08 11:12:17
|
On Thu, Mar 08, 2001 at 11:04:06AM -0000, Chris Ridd wrote: > Graham Barr <gb...@po...> wrote: > > On Thu, Mar 08, 2001 at 09:50:45AM -0000, Chris Ridd wrote: > >> Graham Barr <gb...@po...> wrote: > >> > I don't think the DN should be base64 encoded, it should be encoded > >> > using rules from rfc2253, which should result in a printable string > >> > and avoid the need for base64 encoding > >> So we need an extra bit of code to backslashify a DN. > >> > >> my $dn = $entry->dn; > >> $dn =~ s/([\x00-\x1f:<\x7f-\xff])/sprintf("\\%02x",ord($1))/ge; > >> > > We could just do the above, or we could call the cannonify sub in ::Util > > if /[\x00-\x1f\x7f-\xff]/ or is that too much is it could change the > > way a DN looks > > Let's see, what canonicalisation does canonical_dn do.. > > * it lowercases values that are # followed by hex, > * it lowercases types that start with an OID, > * it backslashifies RFC 2253-magic characters, > * it backslash and hex encodes 0x00-0x1f and 0x7f-0xff characters, > * it surrounds values with leading/trailing/multiple spaces with quotes. > > (Actually, that last part is not permitted by RFC 2253. You should replace > those spaces with "\20" or "\ ". I suspect "\20" would be safer especially > at the end of a string, to avoid someone simply ripping trailing spaces off > and leaving the string ending with a dangling slash.) Hm, bust have been a leftover from the original implementation which followed 1779, I will change it to use \20 > Those canonicalisations look OK to me. Have I missed any others? I don't think so. So do you agree that we should do this for LDIF ? And should we always call cannonify or only if there is a special character in the DN ? Graham. |