]> git.ipfire.org Git - thirdparty/chrony.git/commit
conf: fix sourcedir reloading to not multiply sources
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 2 Jun 2025 08:53:47 +0000 (10:53 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 3 Jun 2025 09:41:12 +0000 (11:41 +0200)
commitcacd64bf4a1fb5248f16c1fa5008a4beed568844
tree5f13b596a0569761e00554b23ff936c62ee0c1b0
parent6c2ee89970a4bb90464cbdf1f5e504700baafe59
conf: fix sourcedir reloading to not multiply sources

The sourcedir reload triggered by the chronyc "reload sources"
command incorrectly assumed that NSR_AddSourceByName() can return
only the NSR_Success status when a source is added. It ignored the
NSR_UnresolvedName status returned for a source whose name needs to
be resolved after the call (i.e. not specified with an IP address)
and added the source again, effectively multiplying it if the name
can be resolved to a different IP address.

Fix the code to check for the NSR_UnresolvedName status to correctly
determine whether the source was already added before and should not be
added again.

Reported-by: MichaelR <MichaelR42@runbox.com>
Fixes: 916ed70c4a81 ("conf: save source status in sourcedir reload")
conf.c