EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElLDAPSClient.Bind throws ArgumentException

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#28113
Posted: 01/24/2014 03:08:38
by Dmitry Kurkin (Basic support level)
Joined: 01/24/2014
Posts: 7

Hello,

I'm trying to evaluate the library but almost the first line of code throws an exception. I need to bind to an Active Directory, here is the code:

SBUtils.Unit.SetLicenseKey(theEvaluationKey);

var client = new TElLDAPSClient();

client.Address = "myDomain.com";
client.Port = 389;

client.LDAPDN = "someDomain\\someUserName";
client.Password = "somePassword";

client.Bind();


The last call throws a System.ArgumentException with the next stack trace:
in System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
in SBUtils.__Global.Move(Array Src, Int32 SrcOffset, Array Dst, Int32 DstOffset, Int32 Size)
in SBSimpleSSL.TElCustomSimpleSSLClient.ReceiveData(Byte[] Buffer, Int32 StartIndex, Int32 Count, Boolean ReadAll)
in SBLDAPSClient.TElLDAPSClient.GetResponse(TElLDAPResponse& Resp)
in SBLDAPSClient.TElLDAPSClient.BindSimple()
in SBLDAPSClient.TElLDAPSClient.Bind()
in Client.Program.Main()

The message says "Offset and length are out of array bounds or the count is too large"

Could anybody help me with this?

Thanks,
Dmitry.
#28114
Posted: 01/24/2014 03:21:28
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Despite the fact that the exception is thrown I'd like to ask you first how are you going to use TElLDAPSClient? You should know that its not a general purpose LDAP client and its used internally by our componets mainly to retrieve CRLs.
#28115
Posted: 01/24/2014 03:51:23
by Dmitry Kurkin (Basic support level)
Joined: 01/24/2014
Posts: 7

Hello,

I'd like to be able to authenticate (in an Active Directory) users on a WinCE device (Compact Framework 3.9). Your LDAP client seems to have the ability to use SSL: that is what we are looking for.

Thanks,
Dmitry.
#28116
Posted: 01/24/2014 04:06:38
by Vsevolod Ievgiienko (EldoS Corp.)

Yes our LDAP client supports SSL/TLS. Do you get an exception of desktop or mobile device?

If you need SSL you should use 636 port and implement TElLDAPSClient.OnCertificateValidate event handler. Currently you are trying to connect to non-SSL port.

Another thing is that LDAPDN is not a username. Its an distinguished name in form like "CN=Administrator,CN=Users,DC=serv,DC=test,DC=local".

Please try to use correct DN and check if the same problem occurs.
#28117
Posted: 01/24/2014 04:33:28
by Dmitry Kurkin (Basic support level)
Joined: 01/24/2014
Posts: 7

Hello,

Here are some details.

Do you get an exception of desktop or mobile device?
The exception is thrown on the Desktop side.

If you need SSL you should use 636 port
I'd like to try to authenticate there without SSL first.

Please try to use correct DN and check if the same problem occurs.
I changed the code like this:
client.AuthType = TSBLDAPAuthenticationType.autSimple;
client.Address = "*****.org";
client.Port = 389;
client.LDAPDN = @"CN=******\, ******,OU=***,OU=********,OU=**************,OU=*****,OU=***,OU=*******,DC=*****,DC=org";
client.Password = "********************";

The Bind call throws the same exception.

PS: the DN was taken from the Active Directory Explorer, so it is valid

Thanks,
Dmitry.
#28119
Posted: 01/24/2014 06:06:04
by Vsevolod Ievgiienko (EldoS Corp.)

Unfortunatelly I was not able to reproduce the exception. Authentication works on my Windows Server 2008 test system.

Do you use the latest SecureBlackbox build? What Windows version is on server side?
#28120
Posted: 01/24/2014 07:33:08
by Dmitry Kurkin (Basic support level)
Joined: 01/24/2014
Posts: 7

Hmmm...
There should be the same OS on our server (but I'm not 100% sure).
I'm using the latest library version that was downloaded from your site just recently.

Does the evaluation key have anything to do with the library behavior? I mean does using a wrong key affect the library?

PS: could you post here the code snippet use use?

Thanks,
Dmitry.
#28121
Posted: 01/24/2014 07:39:34
by Vsevolod Ievgiienko (EldoS Corp.)

Quote
Does the evaluation key have anything to do with the library behavior? I mean does using a wrong key affect the library?

If the key is incorrect you'll get another exception. Most likelly the reason is in some server side settings.

My code is very simple:

Code
using System;
using System.Collections.Generic;
using System.Text;
using SBLDAPSClient;
using SBLDAPSCore;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            SBUtils.Unit.SetLicenseKey("evaluation_key");

            TElLDAPSClient c = new TElLDAPSClient();
            c.Address = "ip";
            c.Port = 389;

            c.LDAPDN = "...";
            c.Password = "...";

            c.Bind();
            c.Unbind();
        }
    }
}
#28123
Posted: 01/24/2014 08:05:34
by Dmitry Kurkin (Basic support level)
Joined: 01/24/2014
Posts: 7

Obviously, it's not working...

Can I send you my project so you can try to run it on your side? I'll need your email,if you don't mind.

Thanks,
Dmitry.
#28124
Posted: 01/24/2014 08:07:52
by Dmitry Kurkin (Basic support level)
Joined: 01/24/2014
Posts: 7

Actually, that was a bad idea(( Anyways, the code is the same. Any ideas on how to debug this?

Thanks,
Dmitry.
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 1315 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!