473,377 Members | 1,153 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,377 software developers and data experts.

Got message 49 error when bind to LDAP server

1
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_CREDENTIALS :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 8270
nithinpes
410 Expert 256MB
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_CREDENTIALS :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
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...
0
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....
0
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...
9
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...
0
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...
3
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). ...
0
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...
0
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...
2
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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 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.