anonymous.c
This is an example of doing an anonymous bind.
To compile this example on Unix:
cc -I /opt/isode/include -c anonymous.c
To compile this example on Windows:
cl /nologo /I C:\Progra~1\Isode\include /c anonymous.c
To link this example on Unix:
cc -o anonymous anonymous.o -L/opt/isode/lib \ -ldua -lisode -libase -lldap -llber -lssl \ -lcrypto -lpthread
To link this example on Windows:
cl /nologo /o anonymous.exe anonymous.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_Status status;
DS_ErrorType t;
status = DS_Initialize( );
fprintf( stderr, "Initialization failed\n" );
return 1;
}
if ( status != DS_E_NOERROR ) {
fprintf( stderr, "Failed to create session\n" );
return 1;
}
status = DS_BindAnonymousSync( ds, NULL, &di );
t != DS_E_SUCCESS )
status = DS_E_DSOPFAILED;
DS_Indication_Delete( di );
if ( status != DS_E_NOERROR) {
DS_UnbindSync( &ds );
fprintf( stderr, "Failed to bind\n" );
return 1;
}
DS_UnbindSync( &ds );
return 0;
}
DS_Status DS_Indication_GetErrorCodes(DS_Indication *indication, DS_ErrorType *type_p, DS_ErrorValue *value_p)
Get the directory (operation) error type and value codes.
DS_Status DS_Session_New(const char *address, int force_tls, DS_Session **session_p)
Create an unbound directory session, validating the specified address.
Methods for session management and invoking directory operations.
DS_Status DS_BindAnonymousSync(DS_Session *session, DS_CommonArgs *common_args, DS_Indication **indication_p)
Perform an anonymous synchronous directory bind.
void DS_Indication_Delete(DS_Indication *indication)
Free a DS_Indication structure.