mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-18 18:18:06 -05:00
ITS#4899 fix from HEAD
This commit is contained in:
parent
f94d411f5e
commit
1656b527a4
1 changed files with 18 additions and 6 deletions
|
|
@ -596,13 +596,25 @@ int ldap_pvt_thread_pool_setkey(
|
|||
if ( !ctx || !key ) return EINVAL;
|
||||
|
||||
for ( i=0; i<MAXKEYS; i++ ) {
|
||||
if ( !ctx[i].ltk_key || ctx[i].ltk_key == key ) {
|
||||
if ( data || kfree )
|
||||
if (( data && !ctx[i].ltk_key ) || ctx[i].ltk_key == key ) {
|
||||
if ( data || kfree ) {
|
||||
ctx[i].ltk_key = key;
|
||||
else
|
||||
ctx[i].ltk_key = NULL;
|
||||
ctx[i].ltk_data = data;
|
||||
ctx[i].ltk_free = kfree;
|
||||
ctx[i].ltk_data = data;
|
||||
ctx[i].ltk_free = kfree;
|
||||
} else {
|
||||
int j;
|
||||
for ( j=i+1; j<MAXKEYS; j++ )
|
||||
if ( !ctx[j].ltk_key ) break;
|
||||
j--;
|
||||
if ( j != i ) {
|
||||
ctx[i].ltk_key = ctx[j].ltk_key;
|
||||
ctx[i].ltk_data = ctx[j].ltk_data;
|
||||
ctx[i].ltk_free = ctx[j].ltk_free;
|
||||
}
|
||||
ctx[j].ltk_key = NULL;
|
||||
ctx[j].ltk_data = NULL;
|
||||
ctx[j].ltk_free = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue