Thanks again Quanah, but snip, it doesn't work, i've put:

replace=>{'userPassword'=>"{MD5}foo"}

But in the database i get:

userPassword:: e01ENX1mb28=

...that again is: 

perl -MMIME::Base64 -e 'print decode_base64 ("e01ENX1mb28="), "\n"; '

{MD5}foo

No matter what i give, it always get base64 encoded, it seems that Net::LDAP 
doesn't respect the "header of the password: {MD5} in this case," that gives 
the encoding.

Hans

On Thu, 09 Nov 2006 15:03:08 -0800, Quanah Gibson-Mount wrote
> --On Thursday, November 09, 2006 7:59 PM -0400 Hans Poo 
> <[EMAIL PROTECTED]> wrote:
> 
> > Hi, thank your response:
> >
> > I prepare the password:
> >
> > my $digest = md5_base64("foo");
> >
> > my $result = $ldap->modify(dn=>$dn,
> > replace=>{'userPassword'=>"{MD5}$digest"});
> >
> > The expected result is to have {MD5}rL0Y20zC+Fzt72VPzMSk2A as the value
> > for  the userPassword field, but instead i get:
> >
> > userPassword:: e01ENX1yTDBZMjB6QytGenQ3MlZQek1TazJB
> >
> > If i base64 decode this password:
> >
> > perl -MMIME::Base64 -e 'print decode_base64
> > ("e01ENX1yTDBZMjB6QytGenQ3MlZQek1TazJB"), "\n"; '
> >
> > I get {MD5}rL0Y20zC+Fzt72VPzMSk2A. For instance the password is encoded
> > twice to base64.
> >
> > Sorry if i'am not seeing something obvious ?, i've been the whole day
> > looking in google.
> 
> Why are you base64 encoding the value yourself?  There is no need 
> for you to do that.  It'll happen automatically when added to the 
> LDAP server.
> 
> Basically, you are base64 encoding the word "foo", then then 
> sticking {MD5} in front of that.  Then the LDAP server is base 64 
> encoding that string value.
> 
> Just remove the
> 
> my $digest = md5_base64("foo");
> 
> line.
> 
> Chance replace to be:
> 
> replace=>{'userPassword'=>"{MD5}foo"});
> 
> --Quanah
> 
> --
> Quanah Gibson-Mount
> Principal Software Developer
> ITS/Shared Application Services
> Stanford University
> GnuPG Public Key: http://www.stanford.edu/~quanah/pgp.html


Hans Christian Poo Rocco, Gerente General WeLinux.S.A. 
Of: 672.93.18, Cel: 09-319.93.05, [EMAIL PROTECTED], http://www.welinux.cl
Nataniel Cox # 210 Of 56, Santiago de Chile

Reply via email to