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 );
49 #endif /* LDAP_CLIENT_UPDATE */
51 #if defined( LDAP_SLAPI )
52 if ( op->o_pb != NULL ) {
53 slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
55 #endif /* defined( LDAP_SLAPI ) */
70 op = (Operation *) ch_calloc( 1, sizeof(Operation) );
76 op->o_time = slap_get_time();
78 #ifdef LDAP_CONNECTIONLESS
82 #if defined( LDAP_SLAPI )
83 op->o_pb = slapi_pblock_new();
84 #endif /* defined( LDAP_SLAPI ) */