diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-11-09 08:59:36 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-11-13 22:14:13 +1100 |
commit | eecc1d294256210ee8c2f6ab79d21b835258a6d4 (patch) | |
tree | 3f34e99fb2be2209b9e6bd19e531f17977eaac47 | |
parent | b59c5db5f74f56c0536635a41ae51c389109ceb5 (diff) | |
download | samba-eecc1d294256210ee8c2f6ab79d21b835258a6d4.tar.gz samba-eecc1d294256210ee8c2f6ab79d21b835258a6d4.tar.bz2 samba-eecc1d294256210ee8c2f6ab79d21b835258a6d4.zip |
lib/addns: don't depend on the order in resp->answers[]
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | lib/addns/dnsgss.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/addns/dnsgss.c b/lib/addns/dnsgss.c index c22173468d..52f1298e01 100644 --- a/lib/addns/dnsgss.c +++ b/lib/addns/dnsgss.c @@ -164,6 +164,8 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx, struct dns_request *resp; struct dns_buffer *buf; struct dns_tkey_record *tkey; + struct dns_rrec *tkey_answer = NULL; + uint16_t i; err = dns_receive(mem_ctx, conn, &buf); if (!ERR_DNS_IS_OK(err)) goto error; @@ -174,9 +176,16 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx, /* * TODO: Compare id and keyname */ - - if ((resp->num_answers == 0) || - (resp->answers[0]->type != QTYPE_TKEY)) { + + for (i=0; i < resp->num_answers; i++) { + if (resp->answers[i]->type != QTYPE_TKEY) { + continue; + } + + tkey_answer = resp->answers[i]; + } + + if (tkey_answer == NULL) { err = ERROR_DNS_INVALID_MESSAGE; goto error; } |