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
9 #include "slapi_common.h"
13 #include <ac/string.h>
14 #include <ac/socket.h>
21 slap_op_free( Operation *op )
23 assert( LDAP_STAILQ_NEXT(op, o_next) == NULL );
25 if ( op->o_ber != NULL ) {
26 ber_free( op->o_ber, 1 );
28 if ( op->o_dn.bv_val != NULL ) {
29 free( op->o_dn.bv_val );
31 if ( op->o_ndn.bv_val != NULL ) {
32 free( op->o_ndn.bv_val );
34 if ( op->o_authmech.bv_val != NULL ) {
35 free( op->o_authmech.bv_val );
37 if ( op->o_ctrls != NULL ) {
38 ldap_controls_free( op->o_ctrls );
41 #ifdef LDAP_CLIENT_UPDATE
42 if ( op->o_clientupdate_state.bv_val != NULL ) {
43 free( op->o_clientupdate_state.bv_val );
45 #endif /* LDAP_CLIENT_UPDATE */
47 #if defined( LDAP_SLAPI )
48 if ( op->o_pb != NULL ) {
49 slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
51 #endif /* defined( LDAP_SLAPI ) */
66 op = (Operation *) ch_calloc( 1, sizeof(Operation) );
72 op->o_time = slap_get_time();
75 #if defined( LDAP_SLAPI )
76 op->o_pb = slapi_pblock_new();
77 #endif /* defined( LDAP_SLAPI ) */