Quantcast
Viewing all articles
Browse latest Browse all 31638

Accessing Active Directory using C

I tried the following code after a few modifications in the code from http://www-archive.mozilla.org/directory/csdk-docs/example.htm

# include "ldap.h"

int main( int argc, char **argv )

{

LDAP *ld;

int rc;

/* Get a handle to an LDAP connection. */

if ( (ld = ldap_init( "ipaddr", port )) == NULL ) {

perror( "ldap_init" );

return( 1 );

}

/* Bind anonymously to the LDAP server. */

rc = ldap_simple_bind_s( ld, "user@mydomain.com", "***" );

if ( rc != LDAP_SUCCESS ) {

fprintf(stderr, "ldap_simple_bind_s: %s\n", ldap_err2string(rc));

return( 1 );

}

else {

printf("Successful authentication");

}

}

I dont have the ldap.h header file. I tried to download a package from openldap (v2.4.35) and unzipped to a folder which contained headers. I included this folder during execution and found two files missing lber_types.h and ldap_features.h. I explored the package and found lber_types.hin and ldap_features.hin files. I also found an information from the Internet that lber_types and ldap_features header files are automatically generated by configure command in Linux. I am working in Windows and what should I do now ? Is there any other package to execute the code ? 
I also found winldap.h from http://msdn.microsoft.com/en-us/library/windows/desktop/aa366113(v=vs.85).aspx. But I want to do it using C.  I tried using that header in my code and included folders containing the dependencies of the header for execution, but get a long error running across my cmd prompt. A sample error is like : C:\xxxxx\winldap.h:384:0: error : unknown type name 'ULONG_PTR'. What can I do now ? Any help ?



Viewing all articles
Browse latest Browse all 31638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>