]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10416 libldap: allow fractional seconds for timeouts in ldaprc master 827/head
authorHoward Chu <hyc@openldap.org>
Wed, 28 Jan 2026 13:06:24 +0000 (13:06 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 9 Feb 2026 00:05:59 +0000 (00:05 +0000)
libraries/libldap/init.c

index 5f144a049960b6aa5951767f0f1c01d7c8b22d03..53def401e90249c46396a894da36491a3b6cc43d 100644 (file)
@@ -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: {