summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-11-09 08:59:36 +0100
committerKarolin Seeger <kseeger@samba.org>2012-12-06 09:40:20 +0100
commitb5d59660d16954d9169323235d210c2891d674dd (patch)
tree5d3063176e5871550c88d7b72cf9eacec329306b /lib
parentfff6962f70e195c55db344d5a20be417213160c3 (diff)
downloadsamba-b5d59660d16954d9169323235d210c2891d674dd.tar.gz
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> (cherry picked from commit eecc1d294256210ee8c2f6ab79d21b835258a6d4) The last 2 patches address bug #9402 - lib/addns doesn't work samba4 with a bind9 server. (cherry picked from commit abb142b4db54ecf17e3b05c374e9d51c6ddc4e04)
Diffstat (limited to 'lib')
-rw-r--r--lib/addns/dnsgss.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/addns/dnsgss.c b/lib/addns/dnsgss.c
index fe7c6ca536e..a8b2ea18bcb 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;
}