set( Slapi_PBlock *pb, int param, void *val )
{
#if defined(LDAP_SLAPI)
- int i;
+ int i, freeit;
if ( isValidParam( pb, param ) == INVALID_PARAM ) {
return PBLOCK_ERROR;
return PBLOCK_ERROR;
}
+ switch ( param ) {
+ case SLAPI_CONN_DN:
+ case SLAPI_CONN_AUTHMETHOD:
+ case SLAPI_IBM_CONN_DN_ALT:
+ case SLAPI_IBM_CONN_DN_ORIG:
+ case SLAPI_RESULT_TEXT:
+ case SLAPI_RESULT_MATCHED:
+ freeit = 1; break;
+ default:
+ freeit = 0; break;
+ }
for( i = 0; i < pb->numParams; i++ ) {
if ( pb->curParams[i] == param ) {
break;
pb->curParams[i] = param;
pb->numParams++;
}
+ if ( freeit ) ch_free( pb->curVals[i] );
pb->curVals[i] = val;
unLock( pb );
0 );
if ( connAuthType != NULL ) {
rc = slapi_pblock_set(pb, SLAPI_CONN_AUTHMETHOD, (void *)connAuthType);
+ /* slapi_pblock_set dups this itself */
+ slapi_ch_free( (void **)&connAuthType );
if ( rc != LDAP_SUCCESS )
return rc;
}
if ( conn->c_authz.sai_dn.bv_val != NULL ) {
- char *connDn = slapi_ch_strdup(conn->c_authz.sai_dn.bv_val);
- rc = slapi_pblock_set(pb, SLAPI_CONN_DN, (void *)connDn);
+ /* slapi_pblock_set dups this itself */
+ rc = slapi_pblock_set(pb, SLAPI_CONN_DN, (void *)conn->c_authz.sai_dn.bv_val);
if ( rc != LDAP_SUCCESS )
return rc;
}
return 1;
}
- slapi_x_pblock_set_operation( op->o_pb, op );
-
switch ( access ) {
case ACL_WRITE:
slap_access |= SLAPI_ACL_ADD | SLAPI_ACL_DELETE | SLAPI_ACL_WRITE;
return 1;
}
+ slapi_x_pblock_set_operation( op->o_pb, op );
+
rc = 1; /* default allow policy */
for ( pGetPlugin = tmpPlugin; *pGetPlugin != NULL; pGetPlugin++ ) {