mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 17:18:01 +03:00
util: Skip over any extra verbiage preceding version in dnsmasq version string
dnsmasq usually prints out a version string like this: Dnsmasq version 2.82 [...] but a user reported that the build of dnsmasq included with pihole has a version string like this: Dnsmasq version pi-hole-2.81 [...] We parse the dnsmasq version number to figure out if the dnsmasq binary supports certain features. Since we expect the version number (and it must be only numbers!) to start on the first non-space after the string "Dnsmasq version", we fail to parse this format of the version string. Rather than spending a bunch of time trying to get pihole to change that, we can just make our parsing more permissive - after searching for "Dnsmasq version", we'll skip ahead to the first decimal digit, rather than just the first non-space. (NB: The features we're checking for purely by looking at version number have been in all releases of dnsmasq since at least 2012, so we could actually just remove the reading of the version number completely. However it's possible (although *highly* unlikely) that some new feature would be added to dnsmasq in the future and we would need to add that code back.) Resolves: https://gitlab.com/libvirt/libvirt/-/issues/29 Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0e89a7b4e0
commit
a4be2e35db
@ -638,7 +638,9 @@ dnsmasqCapsSetFromBuffer(dnsmasqCapsPtr caps, const char *buf)
|
||||
p = STRSKIP(buf, DNSMASQ_VERSION_STR);
|
||||
if (!p)
|
||||
goto fail;
|
||||
virSkipSpaces(&p);
|
||||
|
||||
virSkipToDigit(&p);
|
||||
|
||||
if (virParseVersionString(p, &caps->version, true) < 0)
|
||||
goto fail;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user