https://bugs.openldap.org/show_bug.cgi?id=10442
Issue ID: 10442 Summary: BAD_COPY_PASTE In function 'dds_db_open': Value 'di_max_ttl' might be 'di_min_ttl' Product: OpenLDAP Version: 2.6.8 Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: build Assignee: bugs@openldap.org Reporter: tarasov.mv@ksb-soft.ru Target Milestone: ---
Based on the description in the link, the logic is as follows:
https://www.opennet.ru/cgi-bin/opennet/man.cgi?topic=slapo-dds&category=...
Both values can be specified in the slapd.conf configuration file, from where they will be read, but if neither is specified, then:
dds-max-ttl will default to 86400 seconds = 1 day (i.e., DDS_RF2589_DEFAULT_TTL). dds-min-ttl will default to 0, indicating that the lower TTL limit is not set.
What we see in the implementation code:
If di->di_max_ttl == 0 (does this mean "di->di_max_ttl is not defined"?), then di->di_max_ttl will receive DDS_RF2589_DEFAULT_TTL. That is, the implementation actually sets what should be the default if the value is undefined.
If di->di_min_ttl == 0 (does this mean "di->di_min_ttl is undefined"?), then di->di_max_ttl receives DDS_RF2589_DEFAULT_TTL. That is, if the value is undefined (is 0 at the time of checking), the implementation sets di->di_max_ttl to the default value.
I believe there will be incorrect behavior in the following scenario: if, before these conditions are met, di->di_max_ttl == 100000, and di->di_min_ttl == 0, then di->di_max_ttl will be overwritten with the default 86400 for no apparent reason.
Besides this:
The current dds_db_open is executed after dds_db_init, where di->di_min_ttl is missing from the definition, but instead is written twice:
di->di_max_ttl = DDS_RF2589_DEFAULT_TTL; di->di_max_ttl = DDS_RF2589_DEFAULT_TTL;
This, in my opinion, is also a sign of bad_copy_paste.
I think the status is Confirmed+Major.
https://bugs.openldap.org/show_bug.cgi?id=10442
Misha tarasov.mv@ksb-soft.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |Снимок Snapshot | |2026-01-23 08:08:39 +0500 | |Дата создания | |23.01.2026 07:49 (admin) | |Дата импорта 23.01.2026 | |06:08 Имя хоста | |svace.ru-central1.internal | |Приложенные файлы | |Параметры анализа | |Статистика по детекторам | | | |/home/fedora/rpmbuild/BUILD | |/openldap-2.6.8-build/openl | |dap-2.6.8/openldap-2.6.8/se | |rvers/slapd/overlays/dds.c
--- Comment #1 from Misha tarasov.mv@ksb-soft.ru ---
/home/fedora/rpmbuild/BUILD/openldap-2.6.8-build/openldap-2.6.8/openldap-2.6.8/servers/slapd/overlays/dds.c
https://bugs.openldap.org/show_bug.cgi?id=10442
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |TEST Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Howard Chu hyc@openldap.org --- Looks like this error has been present ever since the initial commit of the dds overlay. Fixed now in git ee7651a4308fdc1e3968862f4f47113ee7844e6a
https://bugs.openldap.org/show_bug.cgi?id=10442
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs_review | Target Milestone|--- |2.6.13
https://bugs.openldap.org/show_bug.cgi?id=10442
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- head:
• ee7651a4 by Howard Chu at 2026-02-05T15:30:52+00:00 ITS#10442 slapo-dds: fix min-ttl/max-ttl init
• 3521bfb3 by Howard Chu at 2026-02-05T15:46:19+00:00 ITS#10442 slapo-dds: delete redundant line
RE26:
• f2734c31 by Howard Chu at 2026-02-13T01:57:03+00:00 ITS#10442 slapo-dds: fix min-ttl/max-ttl init
• b16ae579 by Howard Chu at 2026-02-13T01:59:10+00:00 ITS#10442 slapo-dds: delete redundant line
https://bugs.openldap.org/show_bug.cgi?id=10442
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|TEST |FIXED Status|RESOLVED |VERIFIED