From: Howard Chu Date: Wed, 28 Jan 2026 13:06:24 +0000 (+0000) Subject: ITS#10416 libldap: allow fractional seconds for timeouts in ldaprc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e538a0c6b335e2fbcb55503d84df2a81f6690e28;p=thirdparty%2Fopenldap.git ITS#10416 libldap: allow fractional seconds for timeouts in ldaprc --- 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: {