From: Chris R. <chr...@me...> - 2002-03-06 15:55:41
|
Sean Eckton <Sea...@by...> wrote: > First, let me say I'm not a very good perl programmer so my code may > look like a hack, but I have a project that I'm working on that I can't > quite figure out. I'm trying to make a web page where people can set > their Active Directory password. I am using a Linux box to run my perl > script on. I've tried using Net::LDAPS but every time it gets to that > line in the script (the one where I do $ldaps = new Net::LDAPS etc), it > says file not found. This doesn't make any sense to me because LDAPS.pm > is in the same place as LDAP.pm and it works fine. Here is the code > I've been trying: > > #!/usr/bin/perl -w > local $^W = 0; > no strict; > require Net::SSLeay; > Net::SSLeay::randomize('/dev/urandom'); > require Net::LDAPS; > > $ldap = new Net::LDAPS('ldapserver', > verify => 'require', > certpath => '/home/sean/mycert.cer', > port => 636) or die $!; > > The only thing I can find is that LDAP.pm is in two places: > > /usr/lib/perl5/site_perl/5.005/Net/LDAP.pm > /usr/lib/perl5/site_perl/5.005/Bundle/Net/LDAP.pm > > While LDAPS.pm is only in one: > > /usr/lib/perl5/site_perl/5.005/Net/LDAPS.pm > > I doubt this is the problem, though, because if I change it from > Net::LDAPS to Net::LDPS (just to see) it gives me a different error. > Also, I exported the certificate from the Win2K server and I'm pointed > to it in the code above. Is that the right thing to do? Do I need to > do that at all? > > I've used Net::LDAP quite a bit, but never Net::LDAPS. Can anyone help > me? > > Sean Eckton > Brigham Young University > > > The stuff from 'local $^W = 0;' to 'require Net::LDAPS;' is only needed to avoid some annoying bugs in old versions of Net::SSLeay. Nowadays, you should just be able to say 'use Net::LDAPS;'. In fact, your 'local $^W = 0;' line is turning off warnings in the entire script, which probably isn't helpful. The "file not found" error might be referring to your certificate - it may be in the wrong format or something. Try commenting out the two lines: verify => 'require', certpath => '/home/sean/mycert.cer', and see if that makes a difference. It will mean that the connection won't be as secure (because you're not verifying the server you're talking to) but it'll give us more clues about what's failing. What's the exact error message that gets reported? Cheers, Chris |