1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s4:dns_server: also search DNS_QTYPE_TKEY in the answers section if it's the last section

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13019

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-05-30 14:41:21 +02:00 committed by Andrew Bartlett
parent ae7538af04
commit 5906ed94f2
2 changed files with 13 additions and 4 deletions

View File

@ -1,7 +1,6 @@
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_bad_keyname.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_bad_mac.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_gss_tsig_tkey_req_answers.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_gss_microsoft_com_tkey_req_answers.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_bad_algorithm.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_changed_algorithm1.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_gss_tsig_tkey_req_additional.fl2008r2dc

View File

@ -799,12 +799,22 @@ static WERROR handle_tkey(struct dns_server *dns,
{
struct dns_res_rec *in_tkey = NULL;
struct dns_res_rec *ret_tkey;
uint16_t i;
for (i = 0; i < in->arcount; i++) {
/*
* TKEY needs to we the last one in
* additional or answers
*/
if (in->arcount >= 1) {
uint16_t i = in->arcount - 1;
if (in->additional[i].rr_type == DNS_QTYPE_TKEY) {
in_tkey = &in->additional[i];
break;
}
} else if (in->nscount >= 1) {
/* no lookup */
} else if (in->ancount >= 1) {
uint16_t i = in->ancount - 1;
if (in->answers[i].rr_type == DNS_QTYPE_TKEY) {
in_tkey = &in->answers[i];
}
}