ITS#9853 Allow inheriting lastbind precision from the frontend

This commit is contained in:
Ondřej Kuzník 2022-09-07 15:01:15 +01:00
parent a033c1e74e
commit 294a16c10c
3 changed files with 12 additions and 4 deletions

View file

@ -1508,7 +1508,9 @@ will be updated. More than
.B integer
seconds must have passed since the last successful bind. In a
replicated environment with frequent bind activity it may be
useful to set this to a large value.
useful to set this to a large value. On a backend, if set to
.B 0
(the default), the value set on the frontend is used.
.TP
.B olcLimits: <selector> <limit> [<limit> [...]]
Specify time and size limits based on the operation's initiator or

View file

@ -1411,7 +1411,9 @@ will be updated. More than
.B integer
seconds must have passed since the last successful bind. In a
replicated environment with frequent bind activity it may be
useful to set this to a large value.
useful to set this to a large value. On a backend, if set to
.B 0
(the default), the value set on the frontend is used.
.TP
.B limits <selector> <limit> [<limit> [...]]
Specify time and size limits based on the operation's initiator or

View file

@ -424,6 +424,11 @@ fe_op_lastbind( Operation *op )
if ( (a = attr_find( e->e_attrs, slap_schema.si_ad_pwdLastSuccess )) != NULL ) {
struct lutil_tm tm;
struct lutil_timet tt;
unsigned int precision = op->o_bd->be_lastbind_precision;
if ( precision == 0 ) {
precision = frontendDB->be_lastbind_precision;
}
if ( lutil_parsetime( a->a_nvals[0].bv_val, &tm ) == 0 ) {
lutil_tm2time( &tm, &tt );
@ -437,8 +442,7 @@ fe_op_lastbind( Operation *op )
* TODO: If the recorded bind time is within configurable precision,
* it doesn't need to be updated (save a write for nothing)
*/
if ( bindtime != (time_t)-1 &&
op->o_time <= bindtime + op->o_bd->be_lastbind_precision ) {
if ( bindtime != (time_t)-1 && op->o_time <= bindtime + precision ) {
be_entry_release_r( op, e );
return LDAP_SUCCESS;
}