mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#4899 fix for keys not getting cleared
This commit is contained in:
parent
63bef22335
commit
c80d5f970a
@ -825,10 +825,25 @@ int ldap_pvt_thread_pool_setkey(
|
||||
if ( !ctx || !key ) return EINVAL;
|
||||
|
||||
for ( i=0; i<MAXKEYS; i++ ) {
|
||||
if ( !ctx->ltu_key[i].ltk_key || ctx->ltu_key[i].ltk_key == key ) {
|
||||
ctx->ltu_key[i].ltk_key = key;
|
||||
ctx->ltu_key[i].ltk_data = data;
|
||||
ctx->ltu_key[i].ltk_free = kfree;
|
||||
if (( data && !ctx->ltu_key[i].ltk_key ) || ctx->ltu_key[i].ltk_key == key ) {
|
||||
if ( data || kfree ) {
|
||||
ctx->ltu_key[i].ltk_key = key;
|
||||
ctx->ltu_key[i].ltk_data = data;
|
||||
ctx->ltu_key[i].ltk_free = kfree;
|
||||
} else {
|
||||
int j;
|
||||
for ( j=i+1; j<MAXKEYS; j++ )
|
||||
if ( !ctx->ltu_key[j].ltk_key ) break;
|
||||
j--;
|
||||
if ( j != i ) {
|
||||
ctx->ltu_key[i].ltk_key = ctx->ltu_key[j].ltk_key;
|
||||
ctx->ltu_key[i].ltk_data = ctx->ltu_key[j].ltk_data;
|
||||
ctx->ltu_key[i].ltk_free = ctx->ltu_key[j].ltk_free;
|
||||
}
|
||||
ctx->ltu_key[i].ltk_key = NULL;
|
||||
ctx->ltu_key[i].ltk_data = NULL;
|
||||
ctx->ltu_key[i].ltk_free = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user