[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Windows SDK LDAP APIs..



Hi François,

In my system ldap_sslinit ( ) APIs is doing fine .. but the APIs
ldap_set_option ( ) giving exception ... and the exception is Access
violation ....  i've given the code below...

LDAP           *pLdap = NULL;

 pLdap = ldap_sslinit("192.168.1.167", 389, 0);
 if (pLdap == NULL)
 {
      printf("Error in connection to the server: (%d)\n",
LdapGetLastError());
      return;

 }// if

 //ULONG dwRet;
 int version = LDAP_VERSION3;
 dwRet = ldap_set_option(pLdap, LDAP_OPT_PROTOCOL_VERSION, &version);
 if (dwRet != LDAP_SUCCESS)
 {
      printf("Error while getting the option: (%x), %s\n", dwRet,
ldap_err2string(dwRet));
      return;

 }// if

Please find the error and let me know ..

Regards,
Sanjay


----- Original Message -----
From: "François Beretti" <francois.beretti@enatel.com>
To: "sanjay" <sanjay.a@lifetreeindia.com>
Cc: <openldap-software@OpenLDAP.org>
Sent: Tuesday, February 03, 2004 3:13 PM
Subject: Re: Windows SDK LDAP APIs..


> Hi,
>
> Here is a piece of code that works at home :
>
>
>     ULONG rc;
>
>     CString szServer  = _T("10.10.9.3");
>     CString szBindDN  =
> _T("uid=francois,ou=people,ou=test,dc=domain,dc=local");
>     CString szBindPwd = _T("francois");
>
>     // init
>     LDAP * ld = ldap_sslinit((LPTSTR)(LPCTSTR)szServer,LDAP_PORT,0);
>
>     // ldapv3
>     int version = LDAP_VERSION3;
>     rc = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version);
>
>     // bind
>     rc = ldap_simple_bind_s(ld, (LPTSTR)(LPCTSTR)szBindDN,
> (LPTSTR)(LPCTSTR)szBindPwd);
>
> I use sslinit with '0' as the last argument, which means it will not use
ssl
>
>
> François
>
>
> sanjay a écrit :
>
> >Hi François,
> >
> >So My problem is when i'm trying to connect to the LDAP server using
> >ldap_open ( ) APIs i'm able to connect to the server, where as if i'm
trying
> >to connect, using ldap_init ( ) APIs and after that ldap_connect ( ) APIs
my
> >application is crashing .. why is it so ??
> >
> >actually bydefault the ldap_init ( ) creates a ldap object for LDAP v2
but i
> >have to connect to the LDAP v3 so i'm trying to use ldap_init ( ) and
then i
> >will change the version to V3 and then i will connect to the LDAP server
..
> >
> >Please tell me how can i connect to the LDAP server V3 using Windows SDK
> >APIs..
> >
> >Regards,
> >Sanjay
> >
> >
> >
> >----- Original Message -----
> >From: "François Beretti" <francois.beretti@enatel.com>
> >To: "sanjay" <sanjay.a@lifetreeindia.com>
> >Cc: <openldap-software@OpenLDAP.org>
> >Sent: Tuesday, February 03, 2004 2:55 PM
> >Subject: Re: Windows SDK LDAP APIs..
> >
> >
> >
> >
> >>Hi,
> >>
> >>I am trying to do that. Maybe I can solve your problem, if you post it
> >>
> >>François
> >>
> >>sanjay a écrit :
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>Has any one ever used Windows SDK LDAP APIs to connect to the Redhat
> >>>Linux 9 LDAP server ??
> >>>
> >>>Please let me know as its really *URGENT...i'm facing problem in
> >>>
> >>>
> >that...*
> >
> >
> >>>**
> >>>Regards,
> >>>Sanjay
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> >
> >
>
>