Directory Client API
simple.c
This is an example of doing a simple bind, that is, a bind with a DN and a password.
To compile this example on Unix:
cc -I /opt/isode/include -c simple.c
To compile this example on Windows:
cl /nologo /I C:\Progra~1\Isode\include /c simple.c
To link this example on Unix:
cc -o simple simple.o -L/opt/isode/lib \ -ldua -lisode -libase -lldap -llber \ -lisode_ssl -lisode_crypto -lpthread
To link this example on Windows:
cl /nologo /o simple.exe simple.obj \ C:\Progra~1\Isode\bin\libdua.lib
/*
* Copyright (c) 2005-2009, Isode Limited, London, England.
* All rights reserved.
*
* Acquisition and use of this software and related materials for any
* purpose requires a written licence agreement from Isode Limited,
* or a written licence from an organisation licenced by Isode Limited
* to grant such a licence.
*/
#include <stdio.h>
#include <isode/ds/dsapi/dsapi.h>
int main ( void )
{
DS_Session *ds = NULL;
DS_Indication *di = NULL;
DS_ErrorType t;
DS_DN *dn = NULL;
DS_Status status;
status = DS_Initialize( );
fprintf( stderr, "Initialization failed\n" );
return 1;
}
if ( status != DS_E_NOERROR ) {
fprintf( stderr, "Bad DN\n" );
return 1;
}
if ( status != DS_E_NOERROR ) {
fprintf( stderr, "Failed to create session\n" );
return 1;
}
t != DS_E_SUCCESS )
status = DS_E_DSOPFAILED;
DS_Indication_Delete( di );
DS_DN_Delete( dn );
if ( status != DS_E_NOERROR ) {
fprintf( stderr, "Bind failed\n" );
return 1;
}
DS_UnbindSync( &ds );
return 0;
}