1 /* operation.c - routines to deal with pending ldap operations */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/string.h>
13 #include <ac/socket.h>
23 slap_op_free( Operation *op )
25 assert( LDAP_STAILQ_NEXT(op, o_next) == NULL );
27 if ( op->o_ber != NULL ) {
28 ber_free( op->o_ber, 1 );
30 if ( op->o_dn.bv_val != NULL ) {
31 free( op->o_dn.bv_val );
33 if ( op->o_ndn.bv_val != NULL ) {
34 free( op->o_ndn.bv_val );
36 if ( op->o_authmech.bv_val != NULL ) {
37 free( op->o_authmech.bv_val );
39 if ( op->o_ctrls != NULL ) {
40 ldap_controls_free( op->o_ctrls );
43 #ifdef LDAP_CONNECTIONLESS
44 if ( op->o_res_ber != NULL ) {
45 ber_free( op->o_res_ber, 1 );
48 #ifdef LDAP_CLIENT_UPDATE
49 if ( op->o_clientupdate_state.bv_val != NULL ) {
50 free( op->o_clientupdate_state.bv_val );
54 if ( op->o_sync_state.bv_val != NULL ) {
55 free( op->o_sync_state.bv_val );
59 #if defined( LDAP_SLAPI )
60 if ( op->o_pb != NULL ) {
61 slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
63 #endif /* defined( LDAP_SLAPI ) */
78 op = (Operation *) ch_calloc( 1, sizeof(Operation) );
84 op->o_time = slap_get_time();
86 #ifdef LDAP_CONNECTIONLESS
90 #if defined( LDAP_SLAPI )
91 op->o_pb = slapi_pblock_new();
92 #endif /* defined( LDAP_SLAPI ) */