dns_sdlz_putrr does not auto increase buffer
Summary
dns_sdlz_putrr does not auto increase buffer
BIND version used
9.16, but the in the current master the bug exists.
Steps to reproduce
add dlz ldap support and create long dlzDomain
What is the current bug behavior?
when "dns_rdata_fromtext: buffer-0x7f17cc6ea940:1: near '604800': ran out of space" is "detected" and buffer < 64k, dns_sdlz_putrr imediatly exits with DNS_R_SERVFAIL.
What is the expected correct behavior?
loop in dns_sdlz_putrr to increase the buffer so parsing can happen.
Relevant configuration files
Relevant logs and/or screenshots
Possible fixes
commenting out result = DNS_R_SERVFAIL;
in https://gitlab.isc.org/isc-projects/bind9/-/blob/main/lib/dns/sdlz.c#L1855 fixes the issue.
As far as i understand the code in dns_sdlz_putrr it does run a while loop until the buffer had been increased enough so the input could be sucessfully parsed ( or 64k buffer size is reached).
But the line mentioned above does overwrite the result hard to DNS_R_SERVFAIL. Yes, only when result != ISC_R_SUCCESS
but for my understanding a result ISC_R_NOSPACE will always be != ISC_R_SUCCESS, so the loop will never happen / is basically dead code.
Which in my case does break lookup, but removing the 1855 line enables the original buffer increment logic and a patched instance does loop a second time with an increased buffer and therefor can parse the dlz ldap input correctly and resolve sucessfully.
I'm not sure if just removing line 1855 is the correct solution. I would say 1866 does already handle the jump to failure: in case the result is != success.