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 ldap_error_text);
-
use Authen::SASL qw(Perl);
-
-
my $ldap = Net::LDAP->new("1.1.1.1",port => 389,version => 3);
-
my $sasl = Authen::SASL->new(
-
mechanism => "DIGEST-MD5",
-
callback =>{
-
pass => "***",
-
user => "***\@test.com"
-
}
-
);
-
my $bind = $ldap->bind(sasl => $sasl);
-
if($bind->code)
-
{
-
LDAPerror("Binding",$bind);
-
}
-
else
-
{
-
print "ok!\n";
-
}
-
###---Add for ERROR display--####
-
sub LDAPerror
-
{
-
my ($from,$mesg) = @_;
-
print "Return code: ",$mesg->code ;
-
print "\tMessage: ", ldap_error_name($mesg->code);
-
print " :", ldap_error_text($mesg->code);
-
print "MessageID: ",$mesg->mesg_id;
-
print "\tDN: ",$mesg->dn."\n";
-
}
-
-
###--Add End---###
-
-
if($ldap)
-
{
-
$ldap->unbind;
-
}
-
exit;
After running the script the result is:
Return code: 49 Message: LDAP_INVALID_CR EDENTIALS :The wrong password was supplied or the SASL credentials could not be processed
MessageID: 2 DN:
For "pass" and "user" match each other well, so the error may cauesd by SASL credentials, but i don't know the TRUE reason.
I appreciate Any advice, thanks.
1 8357
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 ldap_error_text);
-
use Authen::SASL qw(Perl);
-
-
my $ldap = Net::LDAP->new("1.1.1.1",port => 389,version => 3);
-
my $sasl = Authen::SASL->new(
-
mechanism => "DIGEST-MD5",
-
callback =>{
-
pass => "***",
-
user => "***\@test.com"
-
}
-
);
-
my $bind = $ldap->bind(sasl => $sasl);
-
if($bind->code)
-
{
-
LDAPerror("Binding",$bind);
-
}
-
else
-
{
-
print "ok!\n";
-
}
-
###---Add for ERROR display--####
-
sub LDAPerror
-
{
-
my ($from,$mesg) = @_;
-
print "Return code: ",$mesg->code ;
-
print "\tMessage: ", ldap_error_name($mesg->code);
-
print " :", ldap_error_text($mesg->code);
-
print "MessageID: ",$mesg->mesg_id;
-
print "\tDN: ",$mesg->dn."\n";
-
}
-
-
###--Add End---###
-
-
if($ldap)
-
{
-
$ldap->unbind;
-
}
-
exit;
After running the script the result is:
Return code: 49 Message: LDAP_INVALID_CR EDENTIALS :The wrong password was supplied or the SASL credentials could not be processed
MessageID: 2 DN:
For "pass" and "user" match each other well, so the error may cauesd by SASL credentials, but i don't know the TRUE reason.
I appreciate Any advice, thanks.
The error certainly points out that credentials provided were wrong. May be you forgot to escape some special characters in username/password!
It is always preferable to use single-quotes over double-quotes, when you are passing literal string (without any substitutions). You can also avoid escaping all those special meaning characters. -
callback =>{
-
pass => 'password' ,
-
user => 'user@domain.com' ,
-
}
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: John Kinson |
last post by:
Hi,
I'm trying to get the wxPython demo to run on a Debian sarge testing
installation, but encounter the following error when I run the demo script:
# ./demo.py
Traceback (most recent call last):
File "./demo.py", line 4, in ?
Main.main()
File "/root/Python/wxPython-2.5.1.5/demo/Main.py", line 946, in main
|
by: Mike |
last post by:
I'm using ASP and CDO to lookup free busy time on an e2k
server. The E2K is locally installed on the IIS server and
I'm having no problems accessing resources like public
folders, mailboxes, etc. When I check Free Busy you have
to access the Active Directory with LDAP. The Domain
Controller is on another server. I am getting error
80005000 whenever I query LDAP. The following code works
perfectly on a server that is a DC, but my...
|
by: microsoft |
last post by:
Hi People, when I try to modify an active directory user programatically, I
receive the following exception:
The server is unwilling to process the request
Reading the microsoft web site, I found this article:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;248717 that says the
following:
..........................
|
by: Patrick |
last post by:
I have an ASP.NET page that searches for someone in the corporate Active
Directory.
It had been working fine until recently when I changed from Basic
Authentication on IIS6 back to Integrated Windows authentication. The error
occurs on the FindAll method. The exceptions are as follows. anyway of
getting the code working with Integrated Windows authentication (too annoying
for user to enter user-name/password). Note I do need to use...
|
by: sbartz |
last post by:
Greetings,
My ldap application relies on user input for a ldap server uri, so I am looking for a way to use the ldap api to determine whether the ldap server is up or not.
All the docs have to say is this:
initialize(uri)
Opens a new connection with an LDAP server, and return an LDAP object (see 1.1.4) used to perform operations on that server. Parameter uri has to be a valid LDAP URL.
server = "ldap://666.222.111.333"
| |
by: aydeejay |
last post by:
I'm trying to troubleshoot an issue where users are not able to bind
with LDAP via "GetObject" through our ASP Classic Intranet if they
stay logged in overnight (beyond their allowed login hours). The
problem does not occur when performing the same bindings using a logon
script.
So, the user logs in, is able to perform queries all day, and then
fails to log out at the end of the day. We'd prefer that they did log
out nightly, but it...
|
by: choukse |
last post by:
Hi All,
I am trying to bind to ADAM instance with a windows user through JNDI and it keeps failing. My ADAM and AD is running on same Windows 2k3 server.
But, through LDP I am able to bind with the same windows user successfully and browse through the entire tree successfully.
The error is as below
|
by: rbukkara |
last post by:
Hi,
I have got the following error while trying to add a user in the LDAP Directory.
javax.naming.NameNotFoundException: ; remaining name 'uid=vassila,ou=People,dc=cs,dc=uno,dc=edu'
I have given all the attributes which are needed, for the user, in the code and also the proper path where the user has to be added. Please have a look at my code
CODE]
// This is a class file which stores all the info required for the user
|
by: theiviaxx |
last post by:
Thanks for the help guys, it works! I used the
ldap.set_option(ldap.OPT_REFERRALS, 0) from http://peeved.org/blog/2007/11/20/
immedialtey after import, then did the initialize trace_level=2 and
did the simple_bind_s. I was able to search and get the results.
That trace_level thing is nice, i'm sure i will be debugging this more
as i move forward :)
Not sure if this is an AD thing or just something i needed to do with
our particular...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |