0
votes

I am trying to connect a LDAP server. Customer sent following 3 info to me:

  1. IP address of LDAP server
  2. username
  3. password

I am using following code:

my $ldap = Net::LDAP->new ($ip_address) or die "$@"; 

my $mesg = $ldap->bind ( $username,
                         password => $password,
                                  ) or die $@;

my $result = $ldap->search(
        base   => $base,
        filter => $filter
        attrs  => \@attributes,
        );

die $result->error if $result->code;

$result->error value is :

'000004DC: LdapErr: DSID-0C090728, comment: In order to perform this operation a successful bind must be completed on the connection.,

According to message, bind is not successful. But it should die if it was unsuccessful. I changed password, wrote wrong value, it again did not die.

I dumped $mesg which is return value of bind and saw following message:

'80090308: LdapErr: DSID-0C0903C5, comment: AcceptSecurityContext error

But it is same with the correct username and password too. Username is 'itservice'. I am using as follow:

my $mesg = $ldap->bind ( 'itservice',
                         password => $password,
                         ) or die $@;

I tried as follow but result is same

my $mesg = $ldap->bind ( 'cn=itservice',
                          password => $password,
                             ) or die $@;

Is there any other format of using username or password?

1
You may need to specify the correct port.xxfelixxx
Are you able to run a ldapsearch query from the command line?xxfelixxx
I am trying following: ldapsearch -x -LLL -h host -D username -w password Result is : ldap_bind: Invalid credentials (49) additional info: 80090308: LdapErr: DSID-0C0903C5, comment: AcceptSecurityContext error, data 52e, v2580 Is my format correct?kadir_beyazli
ldapwiki.com/wiki/Common%20Active%20Directory%20Bind%20Errors search for 52e. Maybe your credentials are wrong...ask your client to validate the credentials and give you an example ldapsearch that should work.xxfelixxx

1 Answers

0
votes

The LDAP Bind request requires a valid DN for the user and not just a user name. Usually, applications first do a search on userName to retrieve the user DN and then bind as the user.