From e538a0c6b335e2fbcb55503d84df2a81f6690e28 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 28 Jan 2026 13:06:24 +0000 Subject: [PATCH] ITS#10416 libldap: allow fractional seconds for timeouts in ldaprc --- libraries/libldap/init.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 5f144a0499..53def401e9 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -230,8 +230,23 @@ ldap_int_conf_option( char *next; tv.tv_usec = 0; tv.tv_sec = strtol( opt, &next, 10 ); - if ( next != opt && next[ 0 ] == '\0' && tv.tv_sec > 0 ) { - (void)ldap_set_option( NULL, attrs[i].offset, (const void *)&tv ); + if ( next != opt ) { + if ( next[ 0 ] == '.' ) { + int digits; + opt = next+1; + tv.tv_usec = strtol( opt, &next, 10 ) ; + digits = next - opt; + while ( digits > 6 ) { + tv.tv_usec /= 10; + digits--; + } + while ( digits < 6 ) { + tv.tv_usec *= 10; + digits++; + } + } + if ( next[ 0 ] == '\0' && ( tv.tv_sec > 0 || tv.tv_usec > 0 )) + (void)ldap_set_option( NULL, attrs[i].offset, (const void *)&tv ); } } break; case ATTR_OPT_INT: { -- 2.47.3