hi,
Please see my code as given below: - #!c:/perl/bin/perl
-
use strict;
-
use warnings;
-
use CGI qw(:all); #use for all code
-
use Net::LDAP;
-
use Net::LDAP::Util qw(ldap_error_name
-
ldap_error_text); #use for Error Handling
-
print "Content-type: text/html\n\n";
-
print "<body bgcolor=\"#ffcccc\">";
-
-
-
my $entry;
-
my @uids;
-
-
my $serverlogin='administrator';
-
my $serverpassword='xxxxx';
-
my $LDAP_SERVER="localhost";
-
my $LDAP_PORT="389";
-
-
my $LDAP_BASE="ou=student,dc=ac,dc=in";
-
-
#INITIALIZING
-
my $ldap=Net::LDAP->new($LDAP_SERVER,port=>$LDAP_PORT) or die "Unable to connect to LDAP server $LDAP_SERVER: $@\n";
-
-
-
-
-
#BINDING
-
-
my $studentlogin='CE34';
-
my $studentpassword='c6';
-
-
my $binddn = "uid=$studentlogin, ou=student, dc=ac,dc=in";
-
my $result = $ldap->bind(uid => $binddn, password => $studentpassword,version=>3);
-
die $result ->error() if $result ->code();
-
-
my $mesg= $ldap->search(filter=>"(&(uid=$studentlogin)(objectClass=student))",
-
base=>$LDAP_BASE);
-
-
-
if ($mesg->count()>0)
-
{
-
print $mesg->count(),"entries returned.\n";
-
foreach $entry($mesg->all_entries())
-
{
-
$entry->dump();
-
}
-
}
-
print "</body>";
-
print "</html>";
-
and then try to get the dn (since nothing is returned, I'm guessing this is something that net::ldap doesn't return). My ldap search() is not returning any results. I don't know, whether my program is correct or not. Please help me out.Thanks in advance
2 2455
Bear with me as I have never played with this module, but in the example from the CPAN module page, it shows the "base=>" before the "filter=>". When specifying parameters there are a lot of functions that have specific order. Have you tried reversing these?
Regards,
Jeff
yes, i have tried the same one. what you have told me? Please check my coding, i don't know, what mistake did i made? Please check my BINDING?
What is meant by an anonymous bind? In my code, i am not using an anonymous bind ?
What is the 'cn', the 'uid' and the 'dn'? What we should use in binding? In my below coding, i have used 'uid'(It means, the students loginname getting from the textbox)
What is the purpose of 'cn'? How can i check my binding its correct or not ? - my $binddn = "uid=$studentlogin, ou=student, dc=ac,dc=in";
-
my $result = $ldap->bind(uid => $binddn, password => $studentpassword,version=>3);
-
die $result ->error() if $result ->code();
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dirk Hagemann |
last post by:
Hi!
I asked here a few weeks ago the same question but the answer of Tim
Golden didn't really help yet.
I'd like to know how to set up a query for all computer-accounts in a
special part of...
|
by: Durairaj Avasi |
last post by:
Here is my prg::::
use Net::LDAP qw(LDAP_SUCCESS LDAP_PROTOCOL_ERROR);
use Authen::SASL;
use Net::LDAP::Util qw(ldap_error_name ldap_error_text);
sub lConnect {
my $server = shift;
print "...
|
by: |
last post by:
I have the following code to show all members of a domain
global group that is selected from a drop down list. I
can display the property "member" just fine which shows a
listing like:
...
|
by: Big E |
last post by:
I'm using ASP.net, LDAP, and SQL Server.
We are using forms security for most of the ASP.Net internet site. So it
uses the generic ASPuser account but then uses forms security to check SQL
Server...
|
by: Dennis Dobslaf |
last post by:
I try to do some authentication with LDAP. But it's a bit different to
the sample in msdn.
I wrote a class LdapAuthentication with a method
public bool IsAuthenticated(String domain, String...
|
by: MDS |
last post by:
Hey,
First of all Best Wishes for 2004
I'm a system admin and I want to write a framework for our Helpdesk to do
some daily stuff like creating mailboxes (not user related), (des)enabling
SIP,...
|
by: Rosanne Rohana |
last post by:
I'm trying for return user info (first name, last name, etc.) from a
Netscape 4.16 LDAP server using the System.DirectoryServices. I'm able to
get authenticated successfully, but when I attempt to...
|
by: Jean-Marie Vaneskahian |
last post by:
Reading - Parsing Records From An LDAP LDIF File In .Net?
I am in need of a .Net class that will allow for the parsing of a LDAP
LDIF file. An LDIF file is the standard format for representing...
|
by: jjeanj1 |
last post by:
Hi,
all i am writing a perl script to do a a bulk add of users from a file and load it to LDAP
$ldap = Net::LDAP->new("test.domain.com", port=>3394) or die "Can not
connected to LDAP \n"; ...
|
by: sowing |
last post by:
I am trying to bind to a LDAP server, but failed.
Code as follow:
#!/usr/bin/perl
use strict;
use warnings;
use Net::LDAP;
use Data::Dumper;
use Net::LDAP::Util qw(ldap_error_name ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |