[PR #8970/8610223d backport][stable-8] dig lookup plugin: Fix using only last nameserver specified #8985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #8970 as merged into main (8610223).
SUMMARY
Currently, when specifying multiple nameservers, only the very last one is actually used. Fix that by collecting all specified nameservers and passing them to the Resolver after the argument processing is done.
ISSUE TYPE
COMPONENT NAME
dig
ADDITIONAL INFORMATION
Currently, when specifying multiple nameservers either using multiple
@ns.example.com
arguments or by specifying multiple nameservers in a single argument (@ns1.example.com,ns2.example.com
), due to a bug only the very last nameserver that is specified is actually used.This is because for every iteration of the
for ns in nsset
loop, the local list of nameservers is cleared and after adding the currently processed nameserver entry, the wholenameservers
list of the Resolver instance is overridden with that new list with just one element. And as far as I can see, when setting thatnameserver
property, the dnspython library actually overrides the existing list and doesn't do some trickery to append the new nameservers or something like that.Therefore, the assignment of the
nameservers
property of the Resolver is moved after the argument processing so all nameservers are added and then collectively written to thenameservers
property of the Resolver.