-/* $OpenLDAP$/
+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2002-2003 The OpenLDAP Foundation.
{
#if defined(LDAP_SLAPI)
int i, freeit;
+ int addcon = 0;
if ( isValidParam( pb, param ) == INVALID_PARAM ) {
return PBLOCK_ERROR;
return PBLOCK_ERROR;
}
+ if ( param == SLAPI_ADD_RESCONTROL ) {
+ addcon = 1;
+ param = SLAPI_RES_CONTROLS;
+ }
+
switch ( param ) {
case SLAPI_CONN_DN:
case SLAPI_CONN_AUTHMETHOD:
pb->curParams[i] = param;
pb->numParams++;
}
- if ( freeit ) ch_free( pb->curVals[i] );
- pb->curVals[i] = val;
+ if ( addcon ) {
+ LDAPControl **ctrls = pb->curVals[i];
+ int j;
+
+ for (j=0; ctrls[j]; j++);
+ ctrls = ch_realloc( ctrls, (j+2)*sizeof(LDAPControl *) );
+ ctrls[j] = val;
+ ctrls[j+1] = NULL;
+ pb->curVals[i] = ctrls;
+ } else {
+ if ( freeit ) ch_free( pb->curVals[i] );
+ pb->curVals[i] = val;
+ }
unLock( pb );
return LDAP_SUCCESS;