From: Nguyen T. P. <Pho...@sd...> - 2000-07-17 08:21:29
|
Hi Mark, Thank you for your instruction. I now have the following RPM packages installed on my machine. perl-Convert-ASN1-0.07-1 perl-MIME-Base64-2.11-2 perl-MD5-1.7-2 perl-URI-1.02-2 perl-Net-LDAP-0.19-1 perl-5.00503-6 The perl-MD5 might be not correct because I don't see any Digest module, but I guest I still be able to perform a simple LDAP search. However when I did a simple LDAP search, I got error 89 (Bad filter?). I'm newbie to Perl so maybe I'm missing something. Please provide me with some help. Thanks. #!/usr/bin/perl #LDAP Headers use Getopt::Std; # To parse command line arguments. use Net::LDAP; # LULU, utilities. use Net::LDAP::Util; # LULU, utilities. use strict; no strict "vars"; $serverLDAP = "LDAP.sgn.vn"; $portLDAP = "389"; $base = 'o=sgn,c=vn'; $conn = Net::LDAP->new ($serverLDAP, port => $portLDAP) or die "$@"; $conn->debug(3); #$conn->bind (dn => 'cn=administrator, o=sgn, c=vn', passwd => 'secret') or die "$@"; $conn->bind () || die "$@"; $search = $conn->search($base, filter => '(uid=*)'); $code = $search->code; printf "Search code: %s, %s\n", $code, $search->error; warn "Search object: $search\n" if $code && die "$@"; $count = $search->count; print "Number of entries: $count\n"; $entry = $search->pop_entry; print "Entry object: $entry\n"; @entries = $search->entries(); print "@entries\n"; $conn->unbind(); ----- Original Message ----- From: Mark Wilcox <mew...@un...> To: Nguyen Thanh Phong <Pho...@sd...> Cc: <per...@ma...> Sent: Friday, July 14, 2000 9:04 PM Subject: Re: PerlLDAP with openLDAP > Yes you can connect with any LDAP compliant server. As per the > instructions at perl-ldap.sourceforge.net, you'll need Convert::ASN1 and > Net::LDAP. You'll need to install Mime::Base64 first if you don't already > have it. > > OPtionally you'll need Digest::MD5 and URI if you want to do CRAM-MD5 SASL > and parse LDAP urls. > > If you have the CPAN module installed on your machine you should be able > to do this: > perl -MCPAN -e 'install Net::LDAP' > > and that should install all of the necessary modules for you. > > > Mark > > > On Fri, 14 Jul 2000, Nguyen Thanh Phong wrote: > > > Hi, > > > > Can I use PerlLDAP to connect to openLDAP database? What packages I have to > > download to have this functionality? > > > > Nguyen Thanh Phong > > Saigon Software Development Company > > Email: pho...@sd... > > WWW: http://www.sdcgrp.com > > > > > > > > > > > > |