mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
ITS#10013 Introduce slap_add_ctrl, changing slap_add_ctrls signature
This commit is contained in:
parent
2494ade786
commit
c1f00a8af6
9 changed files with 84 additions and 81 deletions
|
|
@ -247,7 +247,7 @@ dupent_response_done( Operation *op, SlapReply *rs )
|
||||||
BerElementBuffer berbuf;
|
BerElementBuffer berbuf;
|
||||||
BerElement *ber = (BerElement *) &berbuf;
|
BerElement *ber = (BerElement *) &berbuf;
|
||||||
struct berval ctrlval;
|
struct berval ctrlval;
|
||||||
LDAPControl *ctrl, *ctrlsp[2];
|
LDAPControl *ctrl;
|
||||||
|
|
||||||
ber_init2( ber, NULL, LBER_USE_DER );
|
ber_init2( ber, NULL, LBER_USE_DER );
|
||||||
|
|
||||||
|
|
@ -281,9 +281,7 @@ dupent_response_done( Operation *op, SlapReply *rs )
|
||||||
|
|
||||||
ber_free_buf( ber );
|
ber_free_buf( ber );
|
||||||
|
|
||||||
ctrlsp[0] = ctrl;
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
ctrlsp[1] = NULL;
|
|
||||||
slap_add_ctrls( op, rs, ctrlsp );
|
|
||||||
|
|
||||||
return SLAP_CB_CONTINUE;
|
return SLAP_CB_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +298,7 @@ dupent_response_entry_1level(
|
||||||
int i, rc = LDAP_SUCCESS;
|
int i, rc = LDAP_SUCCESS;
|
||||||
|
|
||||||
for ( i = 0; i < valnum[level].ap->a_numvals; i++ ) {
|
for ( i = 0; i < valnum[level].ap->a_numvals; i++ ) {
|
||||||
LDAPControl *ctrl = NULL, *ctrlsp[2];
|
LDAPControl *ctrl;
|
||||||
|
|
||||||
valnum[level].a.a_vals[0] = valnum[level].ap->a_vals[i];
|
valnum[level].a.a_vals[0] = valnum[level].ap->a_vals[i];
|
||||||
if ( valnum[level].ap->a_nvals != valnum[level].ap->a_vals ) {
|
if ( valnum[level].ap->a_nvals != valnum[level].ap->a_vals ) {
|
||||||
|
|
@ -325,9 +323,7 @@ dupent_response_entry_1level(
|
||||||
ctrl->ldctl_oid = LDAP_CONTROL_DUPENT_ENTRY;
|
ctrl->ldctl_oid = LDAP_CONTROL_DUPENT_ENTRY;
|
||||||
ctrl->ldctl_iscritical = 0;
|
ctrl->ldctl_iscritical = 0;
|
||||||
|
|
||||||
ctrlsp[0] = ctrl;
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
ctrlsp[1] = NULL;
|
|
||||||
slap_add_ctrls( op, rs, ctrlsp );
|
|
||||||
|
|
||||||
/* do the real send */
|
/* do the real send */
|
||||||
rs->sr_entry = e;
|
rs->sr_entry = e;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ noopsrch_response( Operation *op, SlapReply *rs )
|
||||||
BerElementBuffer berbuf;
|
BerElementBuffer berbuf;
|
||||||
BerElement *ber = (BerElement *) &berbuf;
|
BerElement *ber = (BerElement *) &berbuf;
|
||||||
struct berval ctrlval;
|
struct berval ctrlval;
|
||||||
LDAPControl *ctrl, *ctrlsp[2];
|
LDAPControl *ctrl;
|
||||||
int rc = rs->sr_err;
|
int rc = rs->sr_err;
|
||||||
|
|
||||||
if ( nc->nc_save_slimit >= 0 && nc->nc_nentries >= nc->nc_save_slimit ) {
|
if ( nc->nc_save_slimit >= 0 && nc->nc_nentries >= nc->nc_save_slimit ) {
|
||||||
|
|
@ -136,9 +136,7 @@ noopsrch_response( Operation *op, SlapReply *rs )
|
||||||
|
|
||||||
ber_free_buf( ber );
|
ber_free_buf( ber );
|
||||||
|
|
||||||
ctrlsp[0] = ctrl;
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
ctrlsp[1] = NULL;
|
|
||||||
slap_add_ctrls( op, rs, ctrlsp );
|
|
||||||
}
|
}
|
||||||
return SLAP_CB_CONTINUE;
|
return SLAP_CB_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1492,7 +1492,7 @@ send_paged_response(
|
||||||
ID *lastid,
|
ID *lastid,
|
||||||
int tentries )
|
int tentries )
|
||||||
{
|
{
|
||||||
LDAPControl *ctrls[2];
|
LDAPControl *ctrl;
|
||||||
BerElementBuffer berbuf;
|
BerElementBuffer berbuf;
|
||||||
BerElement *ber = (BerElement *)&berbuf;
|
BerElement *ber = (BerElement *)&berbuf;
|
||||||
PagedResultsCookie respcookie;
|
PagedResultsCookie respcookie;
|
||||||
|
|
@ -1502,8 +1502,6 @@ send_paged_response(
|
||||||
"send_paged_response: lastid=0x%08lx nentries=%d\n",
|
"send_paged_response: lastid=0x%08lx nentries=%d\n",
|
||||||
lastid ? *lastid : 0, rs->sr_nentries );
|
lastid ? *lastid : 0, rs->sr_nentries );
|
||||||
|
|
||||||
ctrls[1] = NULL;
|
|
||||||
|
|
||||||
ber_init2( ber, NULL, LBER_USE_DER );
|
ber_init2( ber, NULL, LBER_USE_DER );
|
||||||
|
|
||||||
if ( lastid ) {
|
if ( lastid ) {
|
||||||
|
|
@ -1524,15 +1522,15 @@ send_paged_response(
|
||||||
/* return size of 0 -- no estimate */
|
/* return size of 0 -- no estimate */
|
||||||
ber_printf( ber, "{iO}", 0, &cookie );
|
ber_printf( ber, "{iO}", 0, &cookie );
|
||||||
|
|
||||||
ctrls[0] = op->o_tmpalloc( sizeof(LDAPControl), op->o_tmpmemctx );
|
ctrl = op->o_tmpalloc( sizeof(LDAPControl), op->o_tmpmemctx );
|
||||||
if ( ber_flatten2( ber, &ctrls[0]->ldctl_value, 0 ) == -1 ) {
|
if ( ber_flatten2( ber, &ctrl->ldctl_value, 0 ) == -1 ) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrls[0]->ldctl_oid = LDAP_CONTROL_PAGEDRESULTS;
|
ctrl->ldctl_oid = LDAP_CONTROL_PAGEDRESULTS;
|
||||||
ctrls[0]->ldctl_iscritical = 0;
|
ctrl->ldctl_iscritical = 0;
|
||||||
|
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
rs->sr_err = LDAP_SUCCESS;
|
rs->sr_err = LDAP_SUCCESS;
|
||||||
send_ldap_result( op, rs );
|
send_ldap_result( op, rs );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,7 @@ send_paged_response(
|
||||||
ID *lastid,
|
ID *lastid,
|
||||||
int tentries )
|
int tentries )
|
||||||
{
|
{
|
||||||
LDAPControl *ctrls[2];
|
LDAPControl *ctrl;
|
||||||
BerElementBuffer berbuf;
|
BerElementBuffer berbuf;
|
||||||
BerElement *ber = (BerElement *)&berbuf;
|
BerElement *ber = (BerElement *)&berbuf;
|
||||||
PagedResultsCookie respcookie;
|
PagedResultsCookie respcookie;
|
||||||
|
|
@ -283,8 +283,6 @@ send_paged_response(
|
||||||
"send_paged_response: lastid=0x%08lx nentries=%d\n",
|
"send_paged_response: lastid=0x%08lx nentries=%d\n",
|
||||||
lastid ? *lastid : 0, rs->sr_nentries );
|
lastid ? *lastid : 0, rs->sr_nentries );
|
||||||
|
|
||||||
ctrls[1] = NULL;
|
|
||||||
|
|
||||||
ber_init2( ber, NULL, LBER_USE_DER );
|
ber_init2( ber, NULL, LBER_USE_DER );
|
||||||
|
|
||||||
if ( lastid ) {
|
if ( lastid ) {
|
||||||
|
|
@ -305,15 +303,15 @@ send_paged_response(
|
||||||
/* return size of 0 -- no estimate */
|
/* return size of 0 -- no estimate */
|
||||||
ber_printf( ber, "{iO}", 0, &cookie );
|
ber_printf( ber, "{iO}", 0, &cookie );
|
||||||
|
|
||||||
ctrls[0] = op->o_tmpalloc( sizeof(LDAPControl), op->o_tmpmemctx );
|
ctrl = op->o_tmpalloc( sizeof(LDAPControl), op->o_tmpmemctx );
|
||||||
if ( ber_flatten2( ber, &ctrls[0]->ldctl_value, 0 ) == -1 ) {
|
if ( ber_flatten2( ber, &ctrl->ldctl_value, 0 ) == -1 ) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrls[0]->ldctl_oid = LDAP_CONTROL_PAGEDRESULTS;
|
ctrl->ldctl_oid = LDAP_CONTROL_PAGEDRESULTS;
|
||||||
ctrls[0]->ldctl_iscritical = 0;
|
ctrl->ldctl_iscritical = 0;
|
||||||
|
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
rs->sr_err = LDAP_SUCCESS;
|
rs->sr_err = LDAP_SUCCESS;
|
||||||
send_ldap_result( op, rs );
|
send_ldap_result( op, rs );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,8 @@ void slap_free_ctrls(
|
||||||
int slap_add_ctrls(
|
int slap_add_ctrls(
|
||||||
Operation *op,
|
Operation *op,
|
||||||
SlapReply *rs,
|
SlapReply *rs,
|
||||||
LDAPControl **ctrls )
|
LDAPControl **ctrls,
|
||||||
|
int numctrls )
|
||||||
{
|
{
|
||||||
int i = 0, j;
|
int i = 0, j;
|
||||||
LDAPControl **ctrlsp;
|
LDAPControl **ctrlsp;
|
||||||
|
|
@ -652,7 +653,12 @@ int slap_add_ctrls(
|
||||||
for ( ; rs->sr_ctrls[ i ]; i++ ) ;
|
for ( ; rs->sr_ctrls[ i ]; i++ ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( j=0; ctrls[j]; j++ ) ;
|
if ( numctrls ) {
|
||||||
|
j = numctrls;
|
||||||
|
} else {
|
||||||
|
for ( j=0; ctrls[j]; j++ ) ;
|
||||||
|
numctrls = j;
|
||||||
|
}
|
||||||
|
|
||||||
ctrlsp = op->o_tmpalloc(( i+j+1 )*sizeof(LDAPControl *), op->o_tmpmemctx );
|
ctrlsp = op->o_tmpalloc(( i+j+1 )*sizeof(LDAPControl *), op->o_tmpmemctx );
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
@ -660,7 +666,7 @@ int slap_add_ctrls(
|
||||||
for ( ; rs->sr_ctrls[i]; i++ )
|
for ( ; rs->sr_ctrls[i]; i++ )
|
||||||
ctrlsp[i] = rs->sr_ctrls[i];
|
ctrlsp[i] = rs->sr_ctrls[i];
|
||||||
}
|
}
|
||||||
for ( j=0; ctrls[j]; j++)
|
for ( j=0; j < numctrls; j++)
|
||||||
ctrlsp[i++] = ctrls[j];
|
ctrlsp[i++] = ctrls[j];
|
||||||
ctrlsp[i] = NULL;
|
ctrlsp[i] = NULL;
|
||||||
|
|
||||||
|
|
@ -671,6 +677,15 @@ int slap_add_ctrls(
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
slap_add_ctrl(
|
||||||
|
Operation *op,
|
||||||
|
SlapReply *rs,
|
||||||
|
LDAPControl *ctrl )
|
||||||
|
{
|
||||||
|
return slap_add_ctrls( op, rs, &ctrl, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
int slap_parse_ctrl(
|
int slap_parse_ctrl(
|
||||||
Operation *op,
|
Operation *op,
|
||||||
SlapReply *rs,
|
SlapReply *rs,
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ deref_response( Operation *op, SlapReply *rs )
|
||||||
struct berval bv = BER_BVNULL;
|
struct berval bv = BER_BVNULL;
|
||||||
int nDerefRes = 0, nDerefVals = 0, nAttrs = 0, nVals = 0;
|
int nDerefRes = 0, nDerefVals = 0, nAttrs = 0, nVals = 0;
|
||||||
struct berval ctrlval;
|
struct berval ctrlval;
|
||||||
LDAPControl *ctrl, *ctrlsp[2];
|
LDAPControl *ctrl;
|
||||||
AccessControlState acl_state = ACL_STATE_INIT;
|
AccessControlState acl_state = ACL_STATE_INIT;
|
||||||
static char dummy = '\0';
|
static char dummy = '\0';
|
||||||
Entry *ebase;
|
Entry *ebase;
|
||||||
|
|
@ -473,9 +473,7 @@ deref_response( Operation *op, SlapReply *rs )
|
||||||
|
|
||||||
ber_free_buf( ber );
|
ber_free_buf( ber );
|
||||||
|
|
||||||
ctrlsp[0] = ctrl;
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
ctrlsp[1] = NULL;
|
|
||||||
slap_add_ctrls( op, rs, ctrlsp );
|
|
||||||
|
|
||||||
rc = SLAP_CB_CONTINUE;
|
rc = SLAP_CB_CONTINUE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1997,7 +1997,7 @@ add_account_control(
|
||||||
{
|
{
|
||||||
BerElementBuffer berbuf;
|
BerElementBuffer berbuf;
|
||||||
BerElement *ber = (BerElement *) &berbuf;
|
BerElement *ber = (BerElement *) &berbuf;
|
||||||
LDAPControl c = { 0 }, *cp = NULL, *ctrls[2] = { NULL, NULL };
|
LDAPControl c = { 0 }, *ctrl;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
BER_BVZERO( &c.ldctl_value );
|
BER_BVZERO( &c.ldctl_value );
|
||||||
|
|
@ -2022,20 +2022,18 @@ add_account_control(
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
cp = op->o_tmpalloc( sizeof( LDAPControl ) + c.ldctl_value.bv_len, op->o_tmpmemctx );
|
ctrl = op->o_tmpalloc( sizeof( LDAPControl ) + c.ldctl_value.bv_len, op->o_tmpmemctx );
|
||||||
if ( !cp ) {
|
if ( !ctrl ) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
cp->ldctl_oid = (char *)ppolicy_account_ctrl_oid;
|
ctrl->ldctl_oid = (char *)ppolicy_account_ctrl_oid;
|
||||||
cp->ldctl_iscritical = 0;
|
ctrl->ldctl_iscritical = 0;
|
||||||
cp->ldctl_value.bv_val = (char *)&cp[1];
|
ctrl->ldctl_value.bv_val = (char *)&ctrl[1];
|
||||||
cp->ldctl_value.bv_len = c.ldctl_value.bv_len;
|
ctrl->ldctl_value.bv_len = c.ldctl_value.bv_len;
|
||||||
AC_MEMCPY( cp->ldctl_value.bv_val, c.ldctl_value.bv_val, c.ldctl_value.bv_len );
|
AC_MEMCPY( ctrl->ldctl_value.bv_val, c.ldctl_value.bv_val, c.ldctl_value.bv_len );
|
||||||
|
|
||||||
/* TODO: ITS#10013 Use something like slap_add_ctrl when it exists */
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
ctrls[ 0 ] = cp;
|
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
|
||||||
|
|
||||||
rc = LDAP_SUCCESS;
|
rc = LDAP_SUCCESS;
|
||||||
fail:
|
fail:
|
||||||
|
|
@ -2822,7 +2820,7 @@ ppolicy_bind_response( Operation *op, SlapReply *rs )
|
||||||
char nowstr_usec[ LDAP_LUTIL_GENTIME_BUFSIZE+8 ];
|
char nowstr_usec[ LDAP_LUTIL_GENTIME_BUFSIZE+8 ];
|
||||||
struct berval timestamp, timestamp_usec;
|
struct berval timestamp, timestamp_usec;
|
||||||
BackendDB *be = op->o_bd;
|
BackendDB *be = op->o_bd;
|
||||||
LDAPControl *ctrls[2] = { NULL, NULL };
|
LDAPControl *ctrl = NULL;
|
||||||
Entry *e;
|
Entry *e;
|
||||||
|
|
||||||
ldap_pvt_thread_mutex_lock( &pi->pwdFailureTime_mutex );
|
ldap_pvt_thread_mutex_lock( &pi->pwdFailureTime_mutex );
|
||||||
|
|
@ -3195,16 +3193,16 @@ locked:
|
||||||
if ( ppb->pErr == PP_accountLocked && !pi->use_lockout ) {
|
if ( ppb->pErr == PP_accountLocked && !pi->use_lockout ) {
|
||||||
ppb->pErr = PP_noError;
|
ppb->pErr = PP_noError;
|
||||||
}
|
}
|
||||||
ctrls[0] = create_passcontrol( op, warn, ngut, ppb->pErr );
|
ctrl = create_passcontrol( op, warn, ngut, ppb->pErr );
|
||||||
} else if ( pi->send_netscape_controls ) {
|
} else if ( pi->send_netscape_controls ) {
|
||||||
if ( ppb->pErr != PP_noError || pwExpired ) {
|
if ( ppb->pErr != PP_noError || pwExpired ) {
|
||||||
ctrls[0] = create_passexpiry( op, 1, 0 );
|
ctrl = create_passexpiry( op, 1, 0 );
|
||||||
} else if ( warn > 0 ) {
|
} else if ( warn > 0 ) {
|
||||||
ctrls[0] = create_passexpiry( op, 0, warn );
|
ctrl = create_passexpiry( op, 0, warn );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ctrls[0] ) {
|
if ( ctrl ) {
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
op->o_callback->sc_cleanup = ppolicy_ctrls_cleanup;
|
op->o_callback->sc_cleanup = ppolicy_ctrls_cleanup;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
|
@ -3318,9 +3316,9 @@ ppolicy_restrict(
|
||||||
Debug( LDAP_DEBUG_TRACE,
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
"connection restricted to password changing only\n" );
|
"connection restricted to password changing only\n" );
|
||||||
if ( send_ctrl ) {
|
if ( send_ctrl ) {
|
||||||
LDAPControl *ctrls[2] = { NULL, NULL };
|
LDAPControl *ctrl;
|
||||||
ctrls[0] = create_passcontrol( op, -1, -1, PP_changeAfterReset );
|
ctrl = create_passcontrol( op, -1, -1, PP_changeAfterReset );
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
}
|
}
|
||||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
||||||
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS,
|
send_ldap_error( op, rs, LDAP_INSUFFICIENT_ACCESS,
|
||||||
|
|
@ -3666,9 +3664,9 @@ ppolicy_add(
|
||||||
char *txt = errmsg.bv_val;
|
char *txt = errmsg.bv_val;
|
||||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
||||||
if ( send_ctrl ) {
|
if ( send_ctrl ) {
|
||||||
LDAPControl *ctrls[2] = { NULL, NULL };
|
LDAPControl *ctrl;
|
||||||
ctrls[0] = create_passcontrol( op, -1, -1, pErr );
|
ctrl = create_passcontrol( op, -1, -1, pErr );
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
}
|
}
|
||||||
send_ldap_error( op, rs, rc, txt && txt[0] ? txt : "Password fails quality checking policy" );
|
send_ldap_error( op, rs, rc, txt && txt[0] ? txt : "Password fails quality checking policy" );
|
||||||
if ( txt != errbuf ) {
|
if ( txt != errbuf ) {
|
||||||
|
|
@ -3776,7 +3774,7 @@ ppolicy_modify( Operation *op, SlapReply *rs )
|
||||||
struct berval newpw = BER_BVNULL, oldpw = BER_BVNULL,
|
struct berval newpw = BER_BVNULL, oldpw = BER_BVNULL,
|
||||||
*bv, cr[2];
|
*bv, cr[2];
|
||||||
LDAPPasswordPolicyError pErr = PP_noError;
|
LDAPPasswordPolicyError pErr = PP_noError;
|
||||||
LDAPControl *ctrls[2] = { NULL, NULL };
|
LDAPControl *ctrl = NULL;
|
||||||
int is_pwdexop = 0, is_pwdadmin = 0;
|
int is_pwdexop = 0, is_pwdadmin = 0;
|
||||||
int got_del_grace = 0, got_del_lock = 0, got_pw = 0, got_del_fail = 0,
|
int got_del_grace = 0, got_del_lock = 0, got_pw = 0, got_del_fail = 0,
|
||||||
got_del_success = 0;
|
got_del_success = 0;
|
||||||
|
|
@ -4512,8 +4510,8 @@ return_results:
|
||||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
||||||
be_entry_release_r( op, e );
|
be_entry_release_r( op, e );
|
||||||
if ( send_ctrl ) {
|
if ( send_ctrl ) {
|
||||||
ctrls[0] = create_passcontrol( op, -1, -1, pErr );
|
ctrl = create_passcontrol( op, -1, -1, pErr );
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
if ( is_pwdexop ) {
|
if ( is_pwdexop ) {
|
||||||
/* Retain controls for the actual response */
|
/* Retain controls for the actual response */
|
||||||
rs->sr_flags &= ~REP_CTRLS_MUSTBEFREED;
|
rs->sr_flags &= ~REP_CTRLS_MUSTBEFREED;
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ static int pack_vlv_response_control(
|
||||||
Operation *op,
|
Operation *op,
|
||||||
SlapReply *rs,
|
SlapReply *rs,
|
||||||
sort_op *so,
|
sort_op *so,
|
||||||
LDAPControl **ctrlsp )
|
LDAPControl **ctrlp )
|
||||||
{
|
{
|
||||||
LDAPControl *ctrl;
|
LDAPControl *ctrl;
|
||||||
BerElementBuffer berbuf;
|
BerElementBuffer berbuf;
|
||||||
|
|
@ -237,9 +237,9 @@ static int pack_vlv_response_control(
|
||||||
ctrl->ldctl_value.bv_val = (char *)(ctrl+1);
|
ctrl->ldctl_value.bv_val = (char *)(ctrl+1);
|
||||||
ctrl->ldctl_value.bv_len = bv.bv_len;
|
ctrl->ldctl_value.bv_len = bv.bv_len;
|
||||||
AC_MEMCPY( ctrl->ldctl_value.bv_val, bv.bv_val, bv.bv_len );
|
AC_MEMCPY( ctrl->ldctl_value.bv_val, bv.bv_val, bv.bv_len );
|
||||||
ctrlsp[0] = ctrl;
|
*ctrlp = ctrl;
|
||||||
} else {
|
} else {
|
||||||
ctrlsp[0] = NULL;
|
*ctrlp = NULL;
|
||||||
rs->sr_err = LDAP_OTHER;
|
rs->sr_err = LDAP_OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -451,7 +451,7 @@ static void send_list(
|
||||||
int i, j, dir, rc;
|
int i, j, dir, rc;
|
||||||
BackendDB *be;
|
BackendDB *be;
|
||||||
Entry *e;
|
Entry *e;
|
||||||
LDAPControl *ctrls[2];
|
LDAPControl *ctrl;
|
||||||
|
|
||||||
rs->sr_attrs = op->ors_attrs;
|
rs->sr_attrs = op->ors_attrs;
|
||||||
|
|
||||||
|
|
@ -480,9 +480,8 @@ static void send_list(
|
||||||
if ( vc->vc_offset > so->so_nentries ) {
|
if ( vc->vc_offset > so->so_nentries ) {
|
||||||
range_err:
|
range_err:
|
||||||
so->so_vlv_rc = LDAP_VLV_RANGE_ERROR;
|
so->so_vlv_rc = LDAP_VLV_RANGE_ERROR;
|
||||||
pack_vlv_response_control( op, rs, so, ctrls );
|
pack_vlv_response_control( op, rs, so, &ctrl );
|
||||||
ctrls[1] = NULL;
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
|
||||||
rs->sr_err = LDAP_VLV_ERROR;
|
rs->sr_err = LDAP_VLV_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -513,9 +512,8 @@ range_err:
|
||||||
mr->smr_syntax, mr, &vc->vc_value, &bv, op->o_tmpmemctx );
|
mr->smr_syntax, mr, &vc->vc_value, &bv, op->o_tmpmemctx );
|
||||||
if ( rc ) {
|
if ( rc ) {
|
||||||
so->so_vlv_rc = LDAP_INAPPROPRIATE_MATCHING;
|
so->so_vlv_rc = LDAP_INAPPROPRIATE_MATCHING;
|
||||||
pack_vlv_response_control( op, rs, so, ctrls );
|
pack_vlv_response_control( op, rs, so, &ctrl );
|
||||||
ctrls[1] = NULL;
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
|
||||||
rs->sr_err = LDAP_VLV_ERROR;
|
rs->sr_err = LDAP_VLV_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -688,22 +686,22 @@ static void send_result(
|
||||||
LDAPControl *ctrls[3];
|
LDAPControl *ctrls[3];
|
||||||
int rc, i = 0;
|
int rc, i = 0;
|
||||||
|
|
||||||
rc = pack_sss_response_control( op, rs, ctrls );
|
rc = pack_sss_response_control( op, rs, &ctrls[i] );
|
||||||
if ( rc == LDAP_SUCCESS ) {
|
if ( rc == LDAP_SUCCESS ) {
|
||||||
i++;
|
i++;
|
||||||
rc = -1;
|
rc = -1;
|
||||||
if ( so->so_paged > SLAP_CONTROL_IGNORED ) {
|
if ( so->so_paged > SLAP_CONTROL_IGNORED ) {
|
||||||
rc = pack_pagedresult_response_control( op, rs, so, ctrls+1 );
|
rc = pack_pagedresult_response_control( op, rs, so, &ctrls[i] );
|
||||||
} else if ( so->so_vlv > SLAP_CONTROL_IGNORED ) {
|
} else if ( so->so_vlv > SLAP_CONTROL_IGNORED ) {
|
||||||
rc = pack_vlv_response_control( op, rs, so, ctrls+1 );
|
rc = pack_vlv_response_control( op, rs, so, &ctrls[i] );
|
||||||
}
|
}
|
||||||
if ( rc == LDAP_SUCCESS )
|
if ( rc == LDAP_SUCCESS )
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
ctrls[i] = NULL;
|
ctrls[i] = NULL;
|
||||||
|
|
||||||
if ( ctrls[0] != NULL )
|
if ( i )
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
slap_add_ctrls( op, rs, ctrls, i );
|
||||||
send_ldap_result( op, rs );
|
send_ldap_result( op, rs );
|
||||||
|
|
||||||
if ( so->so_tree == NULL ) {
|
if ( so->so_tree == NULL ) {
|
||||||
|
|
@ -818,16 +816,15 @@ static int sssvlv_op_search(
|
||||||
|
|
||||||
if ( op->o_ctrlflag[sss_cid] <= SLAP_CONTROL_IGNORED ) {
|
if ( op->o_ctrlflag[sss_cid] <= SLAP_CONTROL_IGNORED ) {
|
||||||
if ( op->o_ctrlflag[vlv_cid] > SLAP_CONTROL_IGNORED ) {
|
if ( op->o_ctrlflag[vlv_cid] > SLAP_CONTROL_IGNORED ) {
|
||||||
LDAPControl *ctrls[2];
|
LDAPControl *ctrl;
|
||||||
so2.so_vcontext = 0;
|
so2.so_vcontext = 0;
|
||||||
so2.so_vlv_target = 0;
|
so2.so_vlv_target = 0;
|
||||||
so2.so_nentries = 0;
|
so2.so_nentries = 0;
|
||||||
so2.so_vlv_rc = LDAP_VLV_SSS_MISSING;
|
so2.so_vlv_rc = LDAP_VLV_SSS_MISSING;
|
||||||
so2.so_vlv = op->o_ctrlflag[vlv_cid];
|
so2.so_vlv = op->o_ctrlflag[vlv_cid];
|
||||||
rc = pack_vlv_response_control( op, rs, &so2, ctrls );
|
rc = pack_vlv_response_control( op, rs, &so2, &ctrl );
|
||||||
if ( rc == LDAP_SUCCESS ) {
|
if ( rc == LDAP_SUCCESS ) {
|
||||||
ctrls[1] = NULL;
|
slap_add_ctrl( op, rs, ctrl );
|
||||||
slap_add_ctrls( op, rs, ctrls );
|
|
||||||
}
|
}
|
||||||
rs->sr_err = LDAP_VLV_ERROR;
|
rs->sr_err = LDAP_VLV_ERROR;
|
||||||
rs->sr_text = "Sort control is required with VLV";
|
rs->sr_text = "Sort control is required with VLV";
|
||||||
|
|
|
||||||
|
|
@ -645,7 +645,12 @@ LDAP_SLAPD_F (void) slap_free_ctrls LDAP_P((
|
||||||
LDAP_SLAPD_F (int) slap_add_ctrls LDAP_P((
|
LDAP_SLAPD_F (int) slap_add_ctrls LDAP_P((
|
||||||
Operation *op,
|
Operation *op,
|
||||||
SlapReply *rs,
|
SlapReply *rs,
|
||||||
LDAPControl **ctrls ));
|
LDAPControl **ctrls,
|
||||||
|
int numctrls ));
|
||||||
|
LDAP_SLAPD_F (int) slap_add_ctrl LDAP_P((
|
||||||
|
Operation *op,
|
||||||
|
SlapReply *rs,
|
||||||
|
LDAPControl *ctrl ));
|
||||||
LDAP_SLAPD_F (int) slap_parse_ctrl LDAP_P((
|
LDAP_SLAPD_F (int) slap_parse_ctrl LDAP_P((
|
||||||
Operation *op,
|
Operation *op,
|
||||||
SlapReply *rs,
|
SlapReply *rs,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue