Durairaj

Find below a working script that access Active Directory(AD) and Critical Path ldap directories. If as I believe you are attempting to access AD I believe your problem is with the DN you are using to do the bind. Hope this helps you!

Steve

use strict;
use Net::LDAP;


#======================== AD LDAP SETUP ======================#
my $host = "d1dal101.mydomain.com";
my $port = 389;
my $dn = "[EMAIL PROTECTED]";
my $scope = "subtree";
my $LogFileName="C:\\Temp\\EmpNumCln.txt"; # Where all the files are located
my $debug = 1;
#======================== IDS LDAP SETUP
my $IDShost = "cpldap.abc.com";
my $IDSdn = "cn=manager";
my $IDSentry_dn = "ou=People,dc=MetaDir,dc=ABC,dc=com";
my $IDSbase = ",ou=People,dc=MetaDir,dc=ABC,dc=com";



#======================== END OF CUSTOMIZABLE SECTION
print "Enter AD Password\n";
my $passwd = <STDIN>;
print "Enter IDS Password\n";
my $IDSpasswd = <STDIN>;
chomp $passwd;
# AD Connext & Bind
my $ldap = Net::LDAP->new($host) || die();
print LOGFILE "Past connect\n" if ($debug);
my $bind = $ldap->bind($dn, password=>$passwd)|| die();
print LOGFILE "Past bind\n" if ($debug);
#IDS Connect & Bind
my $IDSldap = Net::LDAP->new($IDShost) || die();
print LOGFILE "Past connect IDS\n" if ($debug);
my $ISDbind = $IDSldap->bind($IDSdn, password=>$IDSpasswd)|| die();
print LOGFILE "Past bind IDS\n" if ($debug);
# Sample input line from file AD-DN | IDS RDN
# CN=Hoang\\, Tran TN T,OU=Users&Groups,DC=mydomain,DC=com|uniqueIdentifier=c05096
while (<>) {
chomp;
s/\\\\/\\/;
/(.*)\|(.*)/;
my $ADentry_dn = $1 ;
print "AD = $ADentry_dn\n";
$IDSentry_dn = ($2.$IDSbase);
print "IDS = $IDSentry_dn\n";
# AD
$ldap->modify( $ADentry_dn,
changes => [
delete => [ initials => []],
] );
# IDS
$IDSldap->modify( $IDSentry_dn,
changes => [
delete => [ initials => []],
] );



}



From: "Durairaj K. Avasi" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: issue on Net::LDAP sasl issue on windows 2000.
Date: Fri,  9 Apr 2004 12:04:39 -0400

From: [EMAIL PROTECTED]

Here is a simple script ... i have very hard time here...

This is my program

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 " the server name is $server\n";
        my $ldap = Net::LDAP->new($server, port=> 389, version => 3);
        print "=== The error is $@ <====\n";
        return($ldap);
}

my $ldap = &lConnect('111.11.11.1');
my $sasl = Authen::SASL->new(mechanism => 'DIGEST-MD5', password =>'xyzabc');
my $isBinded = $ldap->bind ('cn=durairaj avasi,ou=itdev,dc=cow,dc=net', sasl =>
$sasl, version => 3);#
print "ERROR detected: -> ", ldap_error_name($isBinded->code), " ",
ldap_error_text($isBinded->code);


the above program returns the following::

ERROR detected: -> LDAP_INVALID_CREDENTIALS The wrong password was supplied or
the SASL credentials could not be processed


if do a normal bind like

$ldab->bind($mydn, password=>$password, version => 3);

( NOTE without SASL )

i am getting the following error

ERROR detected: -> LDAP_STRONG_AUTH_REQUIRED The server requires authentication
be performed with a SASL mechanism



Tested with windows 2000 and windows xp getting the same error msg. I have installed 8xx-builds on Windows 2000 and windows xp and tested on both ... i am facing same issue with both the application.

what i am doing wrong here.... some say that i should install perl-cyrus-sasl-
0.02... but i am unable to find that module for 8xx environment


--
======================
Catch the mars if you can!!!
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_________________________________________________________________
Watch LIVE baseball games on your computer with MLB.TV, included with MSN Premium! http://join.msn.com/?page=features/mlb&pgmarket=en-us/go/onm00200439ave/direct/01/


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to