Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: ldapsearch equivalent with Net::LDAP: msg#00022

lang.perl.macosx

Subject: Re: ldapsearch equivalent with Net::LDAP

My previous (albeit limited) attempts to debug dlap calls in perl have been facilitated by:
1) pulling down a copy of the ldif file.
2) phpldapbrowser.php

Not all ldif files are made the same... custom fields and non-standard field content can sometimes make it look like your code is wrong when, in fact, it's doing exactly what you thought it should.

YMMV.

--Shelly (on US Mountain time)

On Nov 27, 2007, at 6:55 AM, Dennis Putnam wrote:

I should have guessed. No one in their right mind would be up this early. :-)

I tried Dumper and sure enough there was something in 'errorMessage' (I wonder why it didn't give me an error return?). It said "Bad Filter" so now I have something to work with. Thanks.

On Nov 27, 2007, at 7:46 AM, Jeremiah Foster wrote:

Heh, I am in Stockholm, Central European Time. :)

-----Original Message-----
From: Dennis Putnam [mailto:dennis.putnam@xxxxxxxxxxxx]
Sent: den 27 november 2007 13:42
To: macosx@xxxxxxxx
Cc: Jeremiah Foster
Subject: Re: ldapsearch equivalent with Net::LDAP

Thanks again. I see you are an early riser too. No, I am not
familiar with that (I'm not a Perl expert either). I'll look
it up and see what it can give me.

On Nov 27, 2007, at 7:17 AM, Jeremiah Foster wrote:

Did you try using Data::Dumper? It is a built-in module and is
incredibly useful. You can use it to dump out the contents of $mesg
for example.

-----Original Message-----
From: Dennis Putnam [mailto:dennis.putnam@xxxxxxxxxxxx]
Sent: den 27 november 2007 13:16
To: macosx@xxxxxxxx
Cc: Jeremiah Foster
Subject: Re: ldapsearch equivalent with Net::LDAP

Thanks for the reply. I'm not an LDAP expert either but
this issue is
more of a Perl Net::LDAP user than an LDAP expert per se.
Unfortunately there are no real world working script
examples readily
available. The samples that are, show the syntax but not
the context,
making them pretty much useless to the novice.

The script is not 'die'ing so it never really gets to that point.
Whether I use '$!' or '$@' won't matter until I actually
get an error
condition. It appears that everything is working except the search
returns zero entries. Since 'ldapsearch'
works it is clearly not a server problem. That leaves only
the way I
am trying to use Net::LDAP. There does not appear to be any way to
cause Net::LDAP to generate informational messages about
the dialog
that occurs between it and the LDAP server. I don't see any way to
debug this.

On Nov 27, 2007, at 3:20 AM, Jeremiah Foster wrote:



-----Original Message-----
From: Jeremiah Foster
Sent: den 27 november 2007 09:20
To: 'Dennis Putnam'
Subject: RE: ldapsearch equivalent with Net::LDAP



I am trying to do the equivalent of this search:

ldapsearch -x -LLL -b "dc=ldaphost,dc=mydomain,dc=com" uid

Caveat Emptor: I am no LDAP genius.

Here is one of the many variations I tried:

use strict;
use Net::LDAP;

my $ldap=Net::LDAP->new("ldaphost.mydomain.com") or
die "$@";

Try replacing $@ with $!. You are using $@ which is the
eval error
message, but I don't see where you are using eval. $!
will tell you
what went wrong since it is the sys/libcall error message.

my $mesg=$ldap->bind();

if ($#ARGV<0) {
$mesg=$ldap->search(
base=>"dc=ldaphost,dc=mydomain,dc=com",
attrs=>["uid"]
);
print $mesg->entries(),"\n";
}
else {
}
$ldap->unbind();


I am just starting so my code is incomplete but it should
be enough
to

get something. However, I get nothing, not even an error.
Can someone
see what I am doing wrong? TIA.

See what your code spits out now and diagnose from there.
Hopefully
that is a start.

Jeremiah









<><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Correspondence from Shelly Spearing • shellys@xxxxxxxx
Team Leader
HPC-1 Scientific Software Engineering Group
Los Alamos National Laboratory
MS B295, Los Alamos, NM 87545
03-132-345 505 664 0667 • FAX: 505 665 5402
<><><><><><><><><><><><><><><><><><><><><><><><><><><><>






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qplus.devel/200...    network.jabber....    debian.qa-packa...    encryption.gpg....    python.dabo.dev...    uclinux.devel/2...    science.mathema...    recreation.pesc...    kernel.ck/2004-...    mozilla.devel.e...    tex.latex.prosp...    ietf.multi6/200...    bbc.cvs/2002-11...    xfree86.newbie/...    jakarta.taglibs...    altlinux.hardwa...    comedi/2002-05/...    horde.bugs/2004...    games.diplomacy...    finance.e-gold....    web.dom.test-su...    lang.ruby.rails...    os.netbsd.devel...    video.gstreamer...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation