473,799 Members | 3,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Got message 49 error when bind to LDAP server

1 New Member
I am trying to bind to a LDAP server, but failed.
Code as follow:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5. use Net::LDAP;
  6. use Data::Dumper;
  7. use Net::LDAP::Util qw(ldap_error_name  ldap_error_text);
  8. use Authen::SASL qw(Perl);
  9.  
  10. my $ldap = Net::LDAP->new("1.1.1.1",port => 389,version => 3);
  11. my $sasl = Authen::SASL->new(
  12.               mechanism => "DIGEST-MD5",
  13.               callback =>{
  14.                 pass => "***",
  15.                 user => "***\@test.com"
  16.               }
  17.              );
  18. my $bind = $ldap->bind(sasl => $sasl);
  19. if($bind->code)
  20. {
  21.     LDAPerror("Binding",$bind);    
  22. }
  23. else
  24. {
  25.     print "ok!\n";    
  26. }
  27. ###---Add for ERROR display--####
  28. sub LDAPerror
  29. {    
  30.       my ($from,$mesg) = @_;
  31.     print "Return code: ",$mesg->code ;
  32.       print "\tMessage: ", ldap_error_name($mesg->code);
  33.       print " :",        ldap_error_text($mesg->code);
  34.       print "MessageID: ",$mesg->mesg_id;
  35.       print "\tDN: ",$mesg->dn."\n";
  36. }
  37.  
  38. ###--Add End---###
  39.  
  40. if($ldap)
  41. {
  42.     $ldap->unbind;    
  43. }
  44. 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.
Mar 19 '08 #1
1 8357
nithinpes
410 Recognized Expert Contributor
I am trying to bind to a LDAP server, but failed.
Code as follow:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5. use Net::LDAP;
  6. use Data::Dumper;
  7. use Net::LDAP::Util qw(ldap_error_name  ldap_error_text);
  8. use Authen::SASL qw(Perl);
  9.  
  10. my $ldap = Net::LDAP->new("1.1.1.1",port => 389,version => 3);
  11. my $sasl = Authen::SASL->new(
  12.               mechanism => "DIGEST-MD5",
  13.               callback =>{
  14.                 pass => "***",
  15.                 user => "***\@test.com"
  16.               }
  17.              );
  18. my $bind = $ldap->bind(sasl => $sasl);
  19. if($bind->code)
  20. {
  21.     LDAPerror("Binding",$bind);    
  22. }
  23. else
  24. {
  25.     print "ok!\n";    
  26. }
  27. ###---Add for ERROR display--####
  28. sub LDAPerror
  29. {    
  30.       my ($from,$mesg) = @_;
  31.     print "Return code: ",$mesg->code ;
  32.       print "\tMessage: ", ldap_error_name($mesg->code);
  33.       print " :",        ldap_error_text($mesg->code);
  34.       print "MessageID: ",$mesg->mesg_id;
  35.       print "\tDN: ",$mesg->dn."\n";
  36. }
  37.  
  38. ###--Add End---###
  39.  
  40. if($ldap)
  41. {
  42.     $ldap->unbind;    
  43. }
  44. 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.

Expand|Select|Wrap|Line Numbers
  1. callback =>{
  2.                 pass => 'password' ,
  3.                 user => 'user@domain.com' ,
  4.               }
  5.  
  6.  
Mar 20 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2111
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
0
6181
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...
0
2785
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: ..........................
9
3181
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...
0
1726
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"
3
5864
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...
0
2044
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
0
3235
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
2
2284
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...
0
9686
marktang
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...
0
9540
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,...
0
10475
Oralloy
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...
0
10250
jinu1996
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...
0
10026
tracyyun
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...
0
9068
agi2029
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...
1
7564
isladogs
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...
0
6805
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();...
1
4139
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.