* given to IBM Corporation. This software is provided ``as is''
* without express or implied warranty.
*/
+/*
+ * Portions (C) Copyright PADL Software Pty Ltd. 2003
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is
+ * given to PADL Software Pty Ltd. This software is provided ``as is''
+ * without express or implied warranty.
+ */
#include "portable.h"
-//#include "../../../libraries/liblber/lber-int.h"
#include <slap.h>
#include <lber_pvt.h>
#include <slapi.h>
}
static Connection *
-fakeConnection(
+slapiConnectionInit(
char *DN,
int OpType )
{
return pConn;
}
+static void slapiConnectionDestroy( Connection **pConn )
+{
+ Connection *conn = *pConn;
+ Operation *op;
+
+ if ( pConn == NULL ) {
+ return;
+ }
+
+ op = (Operation *)conn->c_pending_ops.stqh_first;
+
+ if ( op->o_req_dn.bv_val != NULL ) {
+ slapi_ch_free( (void **)&op->o_req_dn.bv_val );
+ }
+ if ( op->o_req_ndn.bv_val != NULL ) {
+ slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
+ }
+
+ if ( conn->c_sb != NULL ) {
+ ber_sockbuf_free( conn->c_sb );
+ }
+ if ( op != NULL ) {
+ slapi_ch_free( (void **)&op );
+ }
+ slapi_ch_free( (void **)pConn );
+}
+
/*
* Function : values2obj
* Convert an array of strings into a BerVarray.
dn.bv_len = strlen(ldn);
rc = dnPrettyNormal( NULL, &dn, &pEntry->e_name, &pEntry->e_nname );
- if (rc != LDAP_SUCCESS) goto cleanup;
+ if ( rc != LDAP_SUCCESS )
+ goto cleanup;
if ( rc == LDAP_SUCCESS ) {
for ( i=0, pMod=mods[0]; rc == LDAP_SUCCESS && pMod != NULL; pMod=mods[++i]) {
cleanup:
- if ( dn.bv_val ) slapi_ch_free( (void **)&dn.bv_val );
- if ( op ) slapi_ch_free( (void **)&op );
- if ( modlist != NULL ) freeMods( modlist );
+ if ( dn.bv_val )
+ slapi_ch_free( (void **)&dn.bv_val );
+ if ( op )
+ slapi_ch_free( (void **)&op );
+ if ( modlist != NULL )
+ freeMods( modlist );
if ( rc != LDAP_SUCCESS ) {
if ( pEntry != NULL ) {
slapi_entry_free( pEntry );
LDAPControl **controls,
int log_change )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
Backend *be;
Connection *pConn = NULL;
Operation *op = NULL;
Slapi_PBlock *pPB = NULL;
Slapi_PBlock *pSavePB = NULL;
SlapReply rs = { REP_RESULT };
+ struct berval dn = { 0, NULL };
- struct berval dn = { 0, NULL };
-
- int rc=LDAP_SUCCESS;
- int manageDsaIt = 0;
- int isCritical;
+ int manageDsaIt = 0;
+ int isCritical;
if ( ldn == NULL ) {
- rc = LDAP_PARAM_ERROR;
+ rs.sr_err = LDAP_PARAM_ERROR;
goto cleanup;
}
- pConn = fakeConnection( NULL, LDAP_REQ_DELETE );
+ pConn = slapiConnectionInit( NULL, LDAP_REQ_DELETE );
if (pConn == NULL) {
- rc = LDAP_NO_MEMORY;
+ rs.sr_err = LDAP_NO_MEMORY;
goto cleanup;
}
dn.bv_val = slapi_ch_strdup(ldn);
dn.bv_len = strlen(ldn);
- rc = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
- if ( rc != LDAP_SUCCESS ) goto cleanup;
+ rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+ if ( rs.sr_err != LDAP_SUCCESS )
+ goto cleanup;
if ( slapi_control_present( controls,
SLAPI_CONTROL_MANAGEDSAIT_OID, NULL, &isCritical) ) {
be = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
if ( be == NULL ) {
- rc = LDAP_PARTIAL_RESULTS;
+ rs.sr_err = LDAP_PARTIAL_RESULTS;
goto cleanup;
}
if ( be->be_delete ) {
int repl_user = be_isupdate( be, &op->o_ndn );
if ( !be->be_update_ndn.bv_len || repl_user ) {
- rc = (*be->be_delete)( op, &rs );
- if ( rc == 0 ) {
- if (log_change) {
+ if ( (*be->be_delete)( op, &rs ) == 0 ) {
+ if ( log_change ) {
replog( op );
}
- rc = LDAP_SUCCESS;
} else {
- rc = LDAP_OTHER;
+ rs.sr_err = LDAP_OTHER;
}
} else {
- rc = LDAP_REFERRAL;
+ rs.sr_err = LDAP_REFERRAL;
}
} else {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
}
cleanup:
- if (pPB != NULL)
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rc );
-
- if ( dn.bv_val )
+ if ( pPB != NULL ) {
+ slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
+ }
+ if ( dn.bv_val ) {
slapi_ch_free( (void **)&dn.bv_val );
- if ( op->o_req_dn.bv_val )
- slapi_ch_free( (void **)&op->o_req_dn.bv_val );
- if ( op->o_req_ndn.bv_val )
- slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
-
+ }
if ( pConn != NULL ) {
- if ( pConn->c_sb != NULL ) ber_sockbuf_free( pConn->c_sb );
- if ( op ) slapi_ch_free( (void **)&op );
pSavePB = pPB;
- free( pConn );
}
-
+
+ slapiConnectionDestroy( &pConn );
+
return (pSavePB);
-#endif /* LDAP_SLAPI */
+#else
return NULL;
+#endif /* LDAP_SLAPI */
}
Slapi_PBlock *
LDAPControl **controls,
int log_changes )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
Connection *pConn = NULL;
Operation *op = NULL;
Slapi_PBlock *pPB = NULL, *pSavePB = NULL;
int manageDsaIt = 0;
int isCritical;
- int rc = LDAP_SUCCESS;
SlapReply rs = { REP_RESULT };
if ( e == NULL ) {
- rc = LDAP_PARAM_ERROR;
+ rs.sr_err = LDAP_PARAM_ERROR;
goto cleanup;
}
- pConn = fakeConnection( NULL, LDAP_REQ_ADD );
+ pConn = slapiConnectionInit( NULL, LDAP_REQ_ADD );
if ( pConn == NULL ) {
- rc = LDAP_NO_MEMORY;
+ rs.sr_err = LDAP_NO_MEMORY;
goto cleanup;
}
be = select_backend( &e->e_nname, manageDsaIt, 0 );
if ( be == NULL ) {
- rc = LDAP_PARTIAL_RESULTS;
+ rs.sr_err = LDAP_PARTIAL_RESULTS;
goto cleanup;
}
if ( log_changes ) {
replog( op );
}
- rc = LDAP_SUCCESS;
}
} else {
- rc = LDAP_REFERRAL;
+ rs.sr_err = LDAP_REFERRAL;
}
} else {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
}
cleanup:
if ( pPB != NULL ) {
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rc );
+ slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
}
if ( pConn != NULL ) {
- if ( pConn->c_sb != NULL ) ber_sockbuf_free( pConn->c_sb );
- if ( op != NULL ) slapi_ch_free( (void **)&op );
pSavePB = pPB;
- free( pConn );
}
+
+ slapiConnectionDestroy( &pConn );
+
return( pSavePB );
-#endif /* LDAP_SLAPI */
+#else
return NULL;
+#endif /* LDAP_SLAPI */
}
LDAPControl **controls,
int log_changes )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
LDAPMod *pMod = NULL;
Slapi_PBlock *pb = NULL;
Entry *pEntry = NULL;
- int i, rc=LDAP_SUCCESS;
+ int i, rc = LDAP_SUCCESS;
if ( mods == NULL || *mods == NULL || dn == NULL || *dn == '\0' ) {
rc = LDAP_PARAM_ERROR ;
}
return(pb);
-#endif /* LDAP_SLAPI */
+#else
return NULL;
+#endif /* LDAP_SLAPI */
}
/* Function : slapi_modrdn_internal
LDAPControl **controls,
int log_change )
{
-#if defined(LDAP_SLAPI)
- int rc = LDAP_SUCCESS;
+#ifdef LDAP_SLAPI
struct berval dn = { 0, NULL };
struct berval newrdn = { 0, NULL };
Connection *pConn = NULL;
int isCritical;
SlapReply rs = { REP_RESULT };
- pConn = fakeConnection( NULL, LDAP_REQ_MODRDN);
+ pConn = slapiConnectionInit( NULL, LDAP_REQ_MODRDN);
if ( pConn == NULL) {
- rc = LDAP_NO_MEMORY;
+ rs.sr_err = LDAP_NO_MEMORY;
goto cleanup;
}
be = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
if ( be == NULL ) {
- rc = LDAP_PARTIAL_RESULTS;
+ rs.sr_err = LDAP_PARTIAL_RESULTS;
goto cleanup;
}
dn.bv_val = slapi_ch_strdup( olddn );
dn.bv_len = strlen( olddn );
- rc = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
- if ( rc != LDAP_SUCCESS ) {
+ rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+ if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup;
}
if ( op->o_req_dn.bv_len == 0 ) {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
goto cleanup;
}
newrdn.bv_val = slapi_ch_strdup( lnewrdn );
newrdn.bv_len = strlen( lnewrdn );
- rc = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn );
- if ( rc != LDAP_SUCCESS ) {
+ rs.sr_err = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn );
+ if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup;
}
if ( be->be_modrdn ) {
int repl_user = be_isupdate( be, &op->o_ndn );
if ( !be->be_update_ndn.bv_len || repl_user ) {
- rc = (*be->be_modrdn)( op, &rs );
- if ( rc == 0 ) {
+ if ( (*be->be_modrdn)( op, &rs ) == 0 ) {
if ( log_change ) {
replog( op );
}
- rc = LDAP_SUCCESS;
-
} else {
- rc = LDAP_OTHER;
+ rs.sr_err = LDAP_OTHER;
}
-
} else {
- rc = LDAP_REFERRAL;
+ rs.sr_err = LDAP_REFERRAL;
}
-
} else {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
}
cleanup:
if ( pPB != NULL ) {
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rc );
+ slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
}
if ( dn.bv_val )
slapi_ch_free( (void **)&dn.bv_val );
- if ( op->o_req_dn.bv_val )
- slapi_ch_free( (void **)&op->o_req_dn.bv_val );
- if ( op->o_req_ndn.bv_val )
- slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
if ( newrdn.bv_val )
slapi_ch_free( (void **)&newrdn.bv_val );
slapi_ch_free( (void **)&op->oq_modrdn.rs_nnewrdn.bv_val );
if ( pConn != NULL ) {
- if ( pConn->c_sb != NULL )
- ber_sockbuf_free( pConn->c_sb );
- if ( op != NULL )
- slapi_ch_free( (void **)&op );
pSavePB = pPB;
- free( pConn );
}
+ slapiConnectionDestroy( &pConn );
+
return( pSavePB );
-#endif /* LDAP_SLAPI */
+#else
return NULL;
+#endif /* LDAP_SLAPI */
}
/* Function : slapi_modify_internal
LDAPControl **controls,
int log_change )
{
-#if defined(LDAP_SLAPI)
- int i, rc = LDAP_SUCCESS;
+#ifdef LDAP_SLAPI
+ int i;
Connection *pConn = NULL;
Operation *op = NULL;
Slapi_PBlock *pPB = NULL;
SlapReply rs = { REP_RESULT };
if ( mods == NULL || *mods == NULL || ldn == NULL ) {
- rc = LDAP_PARAM_ERROR ;
+ rs.sr_err = LDAP_PARAM_ERROR ;
goto cleanup;
}
- pConn = fakeConnection( NULL, LDAP_REQ_MODIFY );
+ pConn = slapiConnectionInit( NULL, LDAP_REQ_MODIFY );
if ( pConn == NULL ) {
- rc = LDAP_NO_MEMORY;
+ rs.sr_err = LDAP_NO_MEMORY;
goto cleanup;
}
dn.bv_val = slapi_ch_strdup( ldn );
dn.bv_len = strlen( ldn );
- rc = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
- if ( rc != LDAP_SUCCESS ) {
+ rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+ if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup;
}
be = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
if ( be == NULL ) {
- rc = LDAP_PARTIAL_RESULTS;
+ rs.sr_err = LDAP_PARTIAL_RESULTS;
goto cleanup;
}
op->o_dn = pConn->c_dn = be->be_rootdn;
op->o_ndn = pConn->c_ndn = be->be_rootndn;
- for ( i = 0, pMod = mods[0]; rc == LDAP_SUCCESS && pMod != NULL;
- pMod = mods[++i] ) {
+ for ( i = 0, pMod = mods[0];
+ rs.sr_err == LDAP_SUCCESS && pMod != NULL;
+ pMod = mods[++i] )
+ {
Modifications *mod;
+
if ( (pMod->mod_op & LDAP_MOD_BVALUES) != 0 ) {
/*
* attr values are in berval format
* convert an array of pointers to bervals
* to an array of bervals
*/
- rc = bvptr2obj( pMod->mod_bvalues, &bv );
- if ( rc != LDAP_SUCCESS ) goto cleanup;
+ rs.sr_err = bvptr2obj( pMod->mod_bvalues, &bv );
+ if ( rs.sr_err != LDAP_SUCCESS )
+ goto cleanup;
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
mod->sml_nvalues = tmp.sml_nvalues;
#endif
} else {
- rc = values2obj( pMod->mod_values, &bv );
- if ( rc != LDAP_SUCCESS ) goto cleanup;
+ rs.sr_err = values2obj( pMod->mod_values, &bv );
+ if ( rs.sr_err != LDAP_SUCCESS )
+ goto cleanup;
tmp.sml_type.bv_val = pMod->mod_type;
tmp.sml_type.bv_len = strlen( pMod->mod_type );
tmp.sml_bvalues = bv;
switch( pMod->mod_op ) {
case LDAP_MOD_ADD:
if ( mod->sml_bvalues == NULL ) {
- rc = LDAP_PROTOCOL_ERROR;
+ rs.sr_err = LDAP_PROTOCOL_ERROR;
goto cleanup;
}
break;
default:
- rc = LDAP_PROTOCOL_ERROR;
+ rs.sr_err = LDAP_PROTOCOL_ERROR;
goto cleanup;
}
}
*modtail = NULL;
if ( op->o_req_ndn.bv_len == 0 ) {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
goto cleanup;
}
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof( textbuf );
- rc = slap_mods_check( modlist, update,
+ rs.sr_err = slap_mods_check( modlist, update,
&text, textbuf, textlen );
- if (rc != LDAP_SUCCESS) {
+ if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup;
}
if ( !repl_user ) {
- rc = slap_mods_opattrs( op, modlist,
+ rs.sr_err = slap_mods_opattrs( op, modlist,
modtail, &text, textbuf,
textlen );
- if (rc != LDAP_SUCCESS) {
+ if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup;
}
}
- rc = (*be->be_modify)( op, &rs );
- if ( rc == 0 ) {
+ if ( (*be->be_modify)( op, &rs ) == 0 ) {
if ( log_change ) {
replog( op );
}
- rc = LDAP_SUCCESS;
} else {
- rc = LDAP_OTHER;
+ rs.sr_err = LDAP_OTHER;
}
} else {
- rc = LDAP_REFERRAL;
+ rs.sr_err = LDAP_REFERRAL;
}
} else {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
}
cleanup:
if ( pPB != NULL )
- slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rc );
+ slapi_pblock_set( pPB, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
if ( dn.bv_val )
slapi_ch_free( (void **)&dn.bv_val );
- if ( op->o_req_dn.bv_val )
- slapi_ch_free( (void **)&op->o_req_dn.bv_val );
- if ( op->o_req_ndn.bv_val )
- slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
- if ( modlist != NULL ) freeMods( modlist );
+ if ( modlist != NULL )
+ freeMods( modlist );
if ( pConn != NULL ) {
- if ( pConn->c_sb != NULL ) ber_sockbuf_free( pConn->c_sb );
- if ( op != NULL ) slapi_ch_free( (void **)&op );
pSavePB = pPB;
- free( pConn );
}
- return ( pSavePB );
+ slapiConnectionDestroy( &pConn );
-#endif /* LDAP_SLAPI */
+ return ( pSavePB );
+#else
return NULL;
+#endif /* LDAP_SLAPI */
}
Slapi_PBlock *
char **attrs,
int attrsonly )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
Backend *be;
Connection *c;
Operation *op = NULL;
int manageDsaIt = 0;
int isCritical;
-
- int i, rc = LDAP_SUCCESS;
+ int i;
SlapReply rs = { REP_RESULT };
- c = fakeConnection( NULL, LDAP_REQ_SEARCH );
- if (c == NULL) {
- rc = LDAP_NO_MEMORY;
+ c = slapiConnectionInit( NULL, LDAP_REQ_SEARCH );
+ if ( c == NULL ) {
+ rs.sr_err = LDAP_NO_MEMORY;
goto cleanup;
}
dn.bv_val = slapi_ch_strdup(ldn);
dn.bv_len = strlen(ldn);
- rc = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
- if ( rc != LDAP_SUCCESS ) {
+ rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+ if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup;
}
if ( scope != LDAP_SCOPE_BASE &&
scope != LDAP_SCOPE_ONELEVEL &&
scope != LDAP_SCOPE_SUBTREE ) {
- rc = LDAP_PROTOCOL_ERROR;
+ rs.sr_err = LDAP_PROTOCOL_ERROR;
goto cleanup;
}
filter = slapi_str2filter(filStr);
if ( filter == NULL ) {
- rc = LDAP_PROTOCOL_ERROR;
+ rs.sr_err = LDAP_PROTOCOL_ERROR;
goto cleanup;
}
memset( &rs, 0, sizeof(rs) );
rs.sr_type = REP_RESULT;
- rs.sr_err = LDAP_OTHER;
+ rs.sr_err = LDAP_SUCCESS;
+ rs.sr_entry = NULL; /* paranoia */
if ( scope == LDAP_SCOPE_BASE ) {
rs.sr_entry = NULL;
send_ldap_result( op, &rs );
goto cleanup;
} else if ( rs.sr_entry != NULL ) {
- rc = test_filter( op, rs.sr_entry, filter );
+ rs.sr_err = test_filter( op, rs.sr_entry, filter );
- if( rc == LDAP_COMPARE_TRUE ) {
+ if ( rs.sr_err == LDAP_COMPARE_TRUE ) {
rs.sr_type = REP_SEARCH;
rs.sr_err = LDAP_SUCCESS;
rs.sr_attrs = an;
send_ldap_result( op, &rs );
- rc = LDAP_SUCCESS;
-
goto cleanup;
}
}
be = select_backend( &op->o_req_ndn, manageDsaIt, 0 );
if ( be == NULL ) {
if ( manageDsaIt == 1 ) {
- rc = LDAP_NO_SUCH_OBJECT;
+ rs.sr_err = LDAP_NO_SUCH_OBJECT;
} else {
- rc = LDAP_PARTIAL_RESULTS;
+ rs.sr_err = LDAP_PARTIAL_RESULTS;
}
goto cleanup;
}
op->oq_search.rs_filterstr = fstr;
if ( be->be_search ) {
- rc = (*be->be_search)( op, &rs );
- if ( rc == 0 ) {
- rc = LDAP_SUCCESS;
- } else {
- rc = LDAP_OTHER;
+ if ( (*be->be_search)( op, &rs ) != 0 ) {
+ rs.sr_err = LDAP_OTHER;
}
} else {
- rc = LDAP_UNWILLING_TO_PERFORM;
+ rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
}
cleanup:
if ( ptr != NULL )
- slapi_pblock_set( ptr, SLAPI_PLUGIN_INTOP_RESULT, (void *)rc );
+ slapi_pblock_set( ptr, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
if ( dn.bv_val )
slapi_ch_free( (void **)&dn.bv_val );
- if ( op->o_req_dn.bv_val )
- slapi_ch_free( (void **)&op->o_req_dn.bv_val );
- if ( op->o_req_ndn.bv_val )
- slapi_ch_free( (void **)&op->o_req_ndn.bv_val );
-
- if ( filter ) slapi_filter_free( filter, 1 );
- if ( fstr.bv_val ) free ( fstr.bv_val );
-
- if ( an != NULL ) free( an );
+ if ( filter )
+ slapi_filter_free( filter, 1 );
+ if ( fstr.bv_val )
+ slapi_ch_free( (void **)&fstr.bv_val );
+ if ( an != NULL )
+ slapi_ch_free( (void **)&an );
if ( c != NULL ) {
- if ( c->c_sb != NULL ) ber_sockbuf_free( c->c_sb );
- if ( op != NULL ) slapi_ch_free( (void **)&op );
pSavePB = ptr;
- free( c );
}
+
+ slapiConnectionDestroy( &c );
+
return( pSavePB );
-#endif /* LDAP_SLAPI */
+#else
return NULL;
+#endif /* LDAP_SLAPI */
}
Slapi_PBlock *
char **attrs,
int attrsonly )
{
-#if defined(LDAP_SLAPI)
+#ifdef LDAP_SLAPI
return slapi_search_internal_bind( NULL, base, scope, filStr,
controls, attrs, attrsonly );
#else