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_CONNECTIONLESS
42 if ( op->o_res_ber != NULL ) {
43 ber_free( op->o_res_ber, 1 );
46 #ifdef LDAP_CLIENT_UPDATE
47 if ( op->o_clientupdate_state.bv_val != NULL ) {
48 free( op->o_clientupdate_state.bv_val );
50 #endif /* LDAP_CLIENT_UPDATE */
52 #if defined( LDAP_SLAPI )
53 if ( op->o_pb != NULL ) {
54 slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
56 #endif /* defined( LDAP_SLAPI ) */
71 op = (Operation *) ch_calloc( 1, sizeof(Operation) );
77 op->o_time = slap_get_time();
79 #ifdef LDAP_CONNECTIONLESS
83 #if defined( LDAP_SLAPI )
84 op->o_pb = slapi_pblock_new();
85 #endif /* defined( LDAP_SLAPI ) */