Commit 99deb62c authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#6056

parent 6d6c037a
......@@ -8,6 +8,7 @@ OpenLDAP 2.4.17 Engineering
Fixed slapd global alloc handling (ITS#6054)
Fixed slapd moduleload with static backends and modules (ITS#6016)
Fixed slapd normalization of updated schema attributes (ITS#5540)
Fixed slapd pagedresults stacked control with overlays (ITS#6056)
Fixed slapd sockets usage on windows (ITS#6039)
Build Environment
Added test056-monitor (ITS#5540)
......
......@@ -1274,7 +1274,7 @@ send_paged_response(
ID *lastid,
int tentries )
{
LDAPControl ctrl, *ctrls[2];
LDAPControl *ctrls[2];
BerElementBuffer berbuf;
BerElement *ber = (BerElement *)&berbuf;
PagedResultsCookie respcookie;
......@@ -1284,8 +1284,6 @@ send_paged_response(
"send_paged_response: lastid=0x%08lx nentries=%d\n",
lastid ? *lastid : 0, rs->sr_nentries, NULL );
BER_BVZERO( &ctrl.ldctl_value );
ctrls[0] = &ctrl;
ctrls[1] = NULL;
ber_init2( ber, NULL, LBER_USE_DER );
......@@ -1308,6 +1306,7 @@ send_paged_response(
/* return size of 0 -- no estimate */
ber_printf( ber, "{iO}", 0, &cookie );
ctrls[0] = op->o_tmpalloc( sizeof(LDAPControl), op->o_tmpmemctx );
if ( ber_flatten2( ber, &ctrls[0]->ldctl_value, 0 ) == -1 ) {
goto done;
}
......@@ -1315,10 +1314,9 @@ send_paged_response(
ctrls[0]->ldctl_oid = LDAP_CONTROL_PAGEDRESULTS;
ctrls[0]->ldctl_iscritical = 0;
rs->sr_ctrls = ctrls;
slap_add_ctrls( op, rs, ctrls );
rs->sr_err = LDAP_SUCCESS;
send_ldap_result( op, rs );
rs->sr_ctrls = NULL;
done:
(void) ber_free_buf( ber );
......
......@@ -539,6 +539,37 @@ void slap_free_ctrls(
op->o_tmpfree( ctrls, op->o_tmpmemctx );
}
int slap_add_ctrls(
Operation *op,
SlapReply *rs,
LDAPControl **ctrls )
{
int i = 0, j;
LDAPControl **ctrlsp;
if ( rs->sr_ctrls ) {
for ( ; rs->sr_ctrls[ i ]; i++ ) ;
}
for ( j=0; ctrls[j]; j++ ) ;
ctrlsp = op->o_tmpalloc(( i+j+1 )*sizeof(LDAPControl *), op->o_tmpmemctx );
i = 0;
if ( rs->sr_ctrls ) {
for ( ; rs->sr_ctrls[i]; i++ )
ctrlsp[i] = rs->sr_ctrls[i];
}
for ( j=0; ctrls[j]; j++)
ctrlsp[i++] = ctrls[j];
ctrlsp[i] = NULL;
if ( rs->sr_flags & REP_CTRLS_MUSTBEFREED )
op->o_tmpfree( rs->sr_ctrls, op->o_tmpmemctx );
rs->sr_ctrls = ctrlsp;
rs->sr_flags |= REP_CTRLS_MUSTBEFREED;
return i;
}
int slap_parse_ctrl(
Operation *op,
SlapReply *rs,
......
......@@ -290,7 +290,7 @@ deref_response( Operation *op, SlapReply *rs )
struct berval bv = BER_BVNULL;
int nDerefRes = 0, nDerefVals = 0, nAttrs = 0, nVals = 0;
struct berval ctrlval;
LDAPControl *ctrl, **ctrlsp;
LDAPControl *ctrl, *ctrlsp[2];
AccessControlState acl_state = ACL_STATE_INIT;
static char dummy = '\0';
Entry *ebase;
......@@ -471,26 +471,9 @@ deref_response( Operation *op, SlapReply *rs )
ber_free_buf( ber );
i = 0;
if ( rs->sr_ctrls ) {
for ( ; rs->sr_ctrls[ i ] != NULL; i++ )
/* count'em */ ;
}
i += 2;
ctrlsp = op->o_tmpcalloc( i, sizeof(LDAPControl *), op->o_tmpmemctx );
i = 0;
if ( rs->sr_ctrls != NULL ) {
for ( ; rs->sr_ctrls[ i ] != NULL; i++ ) {
ctrlsp[ i ] = rs->sr_ctrls[ i ];
}
}
ctrlsp[ i++ ] = ctrl;
ctrlsp[ i++ ] = NULL;
if ( rs->sr_flags & REP_CTRLS_MUSTBEFREED ) {
op->o_tmpfree( rs->sr_ctrls, op->o_tmpmemctx );
}
rs->sr_ctrls = ctrlsp;
rs->sr_flags |= REP_CTRLS_MUSTBEFREED;
ctrlsp[0] = ctrl;
ctrlsp[1] = NULL;
slap_add_ctrls( op, rs, ctrlsp );
rc = SLAP_CB_CONTINUE;
......
......@@ -623,6 +623,10 @@ LDAP_SLAPD_V( struct slap_control_ids ) slap_cids;
LDAP_SLAPD_F (void) slap_free_ctrls LDAP_P((
Operation *op,
LDAPControl **ctrls ));
LDAP_SLAPD_F (int) slap_add_ctrls LDAP_P((
Operation *op,
SlapReply *rs,
LDAPControl **ctrls ));
LDAP_SLAPD_F (int) slap_parse_ctrl LDAP_P((
Operation *op,
SlapReply *rs,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment