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>
20 slap_op_free( Operation *op )
22 assert( LDAP_STAILQ_NEXT(op, o_next) == NULL );
24 if ( op->o_ber != NULL ) {
25 ber_free( op->o_ber, 1 );
27 if ( op->o_dn.bv_val != NULL ) {
28 free( op->o_dn.bv_val );
30 if ( op->o_ndn.bv_val != NULL ) {
31 free( op->o_ndn.bv_val );
33 if ( op->o_authmech.bv_val != NULL ) {
34 free( op->o_authmech.bv_val );
36 if ( op->o_ctrls != NULL ) {
37 ldap_controls_free( op->o_ctrls );
40 #ifdef LDAP_CONNECTIONLESS
41 if ( op->o_res_ber != NULL ) {
42 ber_free( op->o_res_ber, 1 );
45 #ifdef LDAP_CLIENT_UPDATE
46 if ( op->o_clientupdate_state.bv_val != NULL ) {
47 free( op->o_clientupdate_state.bv_val );
51 if ( op->o_sync_state.bv_val != NULL ) {
52 free( op->o_sync_state.bv_val );
56 #if defined( LDAP_SLAPI )
57 if ( op->o_pb != NULL ) {
58 slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
60 #endif /* defined( LDAP_SLAPI ) */
75 op = (Operation *) ch_calloc( 1, sizeof(Operation) );
81 op->o_time = slap_get_time();
83 #ifdef LDAP_CONNECTIONLESS
87 #if defined( LDAP_SLAPI )
88 op->o_pb = slapi_pblock_new();
89 #endif /* defined( LDAP_SLAPI ) */