Hi,

On Tuesday 29 March 2005 04:53, giriraj wrote:
> We are using Iplanet Ldap Directory server on hp-UX 11i.
> I have a problem here with the attribute values.There is a space (a blank
> space) for few attributes across the directory server.
>
> They seem to be normal when lokked through the ldap console. But when
> retrieving data through ldapsearch utility they appear as Junk character.
>
> The only solution for this may be find and delete those attributes and add
> new one's.
>
> eg: telephoneNumber :: RASWD== ( when the attribute has one space
> value,nothing else)

These are no junk characters but Base64 encoded attribute values
according to the LDIF RFC. This is done when the attribute values cannot
bestored in an LDIF file without loss of information
A close look reveals that there are two colons between the attribute name and 
its value. This is the indication that the attribute is Base64-encoded.
To decode those values
1) make sure that the attribute values are not folded in the LDIF file using
    perl -i -p -0040 -e 's/\n //' FILENAME.ldif
2) Decode the values in the LDIF file
     perl -MMIME::Base64 -i -p \
           -e 's/^([\w-]+)::\s*(\S+)/"$1: ".decode_base64($2)/e FILENAME.ldif

This should replace all occurences of base64 encoded attributes in your
LDIF file to non-Base64-encoded ones.
Plese note: the result is not a legal LDIF file anymore.

> My issue is iam not able to trace the attributes through perl ldap scripts.
I guess you already searched using filters like "(telephoneNumber= *)".
Depending on the LDAP server you use this might not produce the expected 
results since blanks may be ignored when comparing phone numbers.

As far as I can see the only soultion is to write a script that walks through 
all entries, fetches the telephonenumber (or any other attibute with leading
or trailing spaces), check if the attributee has leading or trailing spaces
and if it does, delete those spcaes and write back the attribute to the
entry.
Might not seem very elegant, but does the trick.

Peter
-- 
Peter Marschall
eMail: [EMAIL PROTECTED]

Reply via email to