-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nsupdate: fix 'index out of range' error when changing NS records #8614
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! A first quick note:
Co-authored-by: Felix Fontein <felix@fontein.de>
lookup_result = lookup.answer[0] if lookup.answer else lookup.authority[0] | ||
entries_to_remove = [n.to_text() for n in lookup_result.items if n.to_text() not in self.value] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, in case lookup.answer
does not exist, shouldn't entries_to_remove
simply be set to []
? In that situation there is no current NS
value on that level that can be deleted, after all.
So something like
lookup_result = lookup.answer[0] if lookup.answer else lookup.authority[0] | |
entries_to_remove = [n.to_text() for n in lookup_result.items if n.to_text() not in self.value] | |
entries_to_remove = [n.to_text() for n in lookup.answer[0].items if n.to_text() not in self.value] if lookup.answer else [] |
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my understanding of that block is bind9 will not let you rewrite the last NS record in the zone, so the new record is inserted first, and old one is deleted after. In my case it would not be the last, but the record does exist and needs to be deleted. But since the zone is subdelegated to another server, the data is in authority section. My guess is it was tested on the server where delegation was to another local zone so this was missed. If we do it like you suggest, we would have dupes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, ok. This still doens't sound right to me, but I don't use bind9 or the module so I don't know what really happens :)
In any case, this shouldn't break any existing behavior since if this happened so far, it resulted in an error, so in the worst case this is introducing wrong behavior in a case that didn't work at all before. If someone complains about it, we'll have to look into it again to figure out why exactly it works for you but not for them. And if nobody complains, I guess it's fine for everyone then :)
I'll merge tomorrow if nobody objects. |
Backport to stable-8: 💚 backport PR created✅ Backport PR branch: Backported as #8629 🤖 @patchback |
) * nsupdate: fix 'index out of range' error when changing NS records * add clog fragment * Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 9dd2b71)
@artw thanks for your contribution! |
Backport to stable-9: 💚 backport PR created✅ Backport PR branch: Backported as #8630 🤖 @patchback |
) * nsupdate: fix 'index out of range' error when changing NS records * add clog fragment * Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 9dd2b71)
…nge' error when changing NS records (#8629) nsupdate: fix 'index out of range' error when changing NS records (#8614) * nsupdate: fix 'index out of range' error when changing NS records * add clog fragment * Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 9dd2b71) Co-authored-by: Art Win <art@make.lv>
…nge' error when changing NS records (#8630) nsupdate: fix 'index out of range' error when changing NS records (#8614) * nsupdate: fix 'index out of range' error when changing NS records * add clog fragment * Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 9dd2b71) Co-authored-by: Art Win <art@make.lv>
…sible-collections#8614) * nsupdate: fix 'index out of range' error when changing NS records * add clog fragment * Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
…sible-collections#8614) * nsupdate: fix 'index out of range' error when changing NS records * add clog fragment * Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
…sible-collections#8614) * nsupdate: fix 'index out of range' error when changing NS records * add clog fragment * Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
SUMMARY
fallback to authority section of the response if there is no authoritative answer, instead of crashing
fixes #8612
ISSUE TYPE
COMPONENT NAME
nsupdate
ADDITIONAL INFORMATION