[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Problems coding password handling in PERL
I've read through just about every post about PERL and passwords and have gotten the majority of the steps required to handle
passwords in OpenLDAP using PERL, but I'm missing something that is preventing me from authenticating. Here is where I am at:
I have Openldap running with
password-hash {SHA}
in the slapd.conf
I create a user from an HTML form using the Mozilla::LDAP (PERLDAP) libraries as such:
my $ctx = Digest::SHA1->new;
$ctx->add($params->{'password'});
$userEntry->addValue(userpassword, $ctx->digest);
The user creation works and the account is created:
dn: uid=testing1,ou=people,dc=chesternet,dc=net
userPassword:: iwdMwvy4wuTFW/oPB5CPpHvRoCc=
(cleartext was 123happy)
When I try to login as the user:
my $ret = $self->{'connection'}->simpleAuth($uid, $passwd);
if ($ret) {
Utils::write_log ("LDAP: Did LDAP bind as \"$uid\".");
} else {
Utils::write_log ("LDAP: Couldn't do LDAP bind as \"$uid\", \"$passwd\".");
}
return $ret
I get a failure:
LDAP: Couldn't do LDAP bind as "testing1", "123happy".
01-Jun-2001 07:10:49 logon testing1: handle_logon: Wrong password for user "testing1".
I feel like I'm missing something in the creating of the account, do I have to set the password to "'{SHA}'.$ctx->digest" before
adding the value to the userEntry? Do I have to rehash the password before trying to do the simpleAuth? Am I supposed to be using
simpleAuth? Am I supposed to be digesting the password period(ie the db will do it for me)?
Any help would be greatly appreciated.
__________________________________________________________
Daniel Chester Chief Technology Officer
RentPayment.Com http://www.RentPayment.com
27521 Laurell Lane, N. Olmsted, OH 44070
v. (440) 734-4014 f. (801) 730-2097
BEGIN:VCARD
VERSION:2.1
N:Chester;Daniel;E;Mr.
FN:Daniel E Chester
NICKNAME:Dan
ORG:RentPayment.Com
TITLE:Director of Web Operations
TEL;WORK;VOICE:440-734-4014
TEL;CELL;VOICE:440-567-3459
TEL;WORK;FAX:801-730-2097
ADR;WORK:;;27521 Laurell Lane;North Olmsted;OH;44070-2775;USA
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:27521 Laurell Lane=0D=0ANorth Olmsted, OH 44070-2775=0D=0AUSA
EMAIL;PREF;INTERNET:Daniel.Chester@RentPayment.Com
REV:20010326T224205Z
END:VCARD