SPUG: Calling all LDAP gurus

Alyssa Harding axhard2 at uswest.com
Tue May 23 18:31:30 CDT 2000


Okay, I figured out the problem :)
I had the base wrong in the search parameters.  It should have been 

base => 'o=uswest.com'

Thanks anyway!

A.

Alyssa Harding wrote:
> 
> I'm having a problem doing a search on our company's corporate LDAP
> and I need some help!
> 
> My goal is this.  I have a fairly large table from an existing
> database and I need to verify some of the entries against those in
> the corporate LDAP.  I have no problems with DBI, getting the
> records from the existing database out, the problem is the LDAP
> search.
> 
> Here's some code - $LDAP_host and $LDAP_port are defined correctly,
> I'll just skip that part:
> ...
> use Net::LDAP;
> use strict;
> 
> my $ldap = Net::LDAP->new( $LDAP_host, port => $LDAP_port) or
>   print "Couldn't create LDAP connection $!<BR>\n";
> 
> $ldap->bind or print "Couldn't bind successfully $!<BR>\n";
> 
> my $mesg = $ldap->search( base => 'c=uswest.com,ou=People',
>                           filter => '(uid=axhard2)',
>                           attrs => [ 'cn', 'mail', 'st' ]
>                         ) or print "Problem with search $!<BR>";
> 
> ...
> 
> Okay, now I know that when the search comes back, it's a
> Net::LDAP::Search object.  I also know that, were the search
> successful, I would be able to get entries out of the object using
> entry() and be able to find out how many entries there are using
> count().
> 
> I have verified that the uid value above (my own uid) works
> correctly when I query the corporate LDAP through the web server
> they have set up, and the three attributes do indeed exist for all
> records (not just mine).
> 
> The problem is, I don't get any results back.  The search object
> returned looks like this after the $ldap->search() above:
> 
> $VAR1 = bless( {
>                  'matchedDN' => '',
>                  'mesgid' => 2,
>                  'resultCode' => 32,
>                  'parent' => bless( {
>                                       'net_ldap_resp' => {},
>                                       'net_ldap_mesg' => {},
>                                       'net_ldap_async' => '0',
>                                       'net_ldap_version' => 2,
>                                       'net_ldap_host' =>
> 'ldap.uswc.uswest.com',
>                                       'net_ldap_debug' => '0',
>                                       'net_ldap_socket' => bless(
> \*Symbol::GEN0, 'IO::Socket::INET' )
>                                     }, 'Net::LDAP' ),
>                  'callback' => undef,
>                  'errorMessage' => ''
>                }, 'Net::LDAP::Search' );
> 
> No entries, no error messages, nothin' :(
> 
> Can someone please help?
> 
> A.
> --
> Alyssa W. Harding
> Web Programmer
> U S WEST Creative Services
> phon: (206) 345-4073
> cell: (206) 769-8735
> -------------------------------------------------------------------
> He had a unique stride: it looked as though his body was being
> dragged
> forward and his legs had to flail around underneath it, landing
> wherever
> they could find room. It wasn't so much a walk as a collapse,
> indefinitely
> postponed.
>         -- (Terry Pratchett, Maskerade)
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
>  For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address

-- 
Alyssa W. Harding 
Web Programmer
U S WEST Creative Services
phon: (206) 345-4073
cell: (206) 769-8735
-------------------------------------------------------------------
"Luck is my middle name," said Rincewind, indistinctly. "Mind you,
my first
name is Bad."
        -- (Terry Pratchett, Interesting Times)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address





More information about the spug-list mailing list