summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2012-03-10 23:47:29 +0100
committerKai Blin <kai@samba.org>2012-03-11 00:31:37 +0100
commite6c6f4959558d89f811c3da281b10e3525660179 (patch)
treec1b53207abe3c267e00675c261a09261aa5e1d8f
parentf9f1d98e747e9126b9d301052f639bbc25db7a88 (diff)
downloadsamba-e6c6f4959558d89f811c3da281b10e3525660179.tar.gz
s4 dns: Support TXT queries
-rw-r--r--source4/dns_server/dns_query.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c
index 42aa11f009c..4277659cf7e 100644
--- a/source4/dns_server/dns_query.c
+++ b/source4/dns_server/dns_query.c
@@ -35,6 +35,8 @@ static WERROR create_response_rr(const struct dns_name_question *question,
{
struct dns_res_rec *ans = *answers;
uint16_t ai = *ancount;
+ char *tmp;
+ uint32_t i;
ZERO_STRUCT(ans[ai]);
@@ -69,7 +71,16 @@ static WERROR create_response_rr(const struct dns_name_question *question,
case DNS_QTYPE_PTR:
ans[ai].rdata.ptr_record = talloc_strdup(ans, rec->data.ptr);
break;
+ case DNS_QTYPE_TXT:
+ tmp = talloc_asprintf(ans, "\"%s\"", rec->data.txt.str[0]);
+ for (i=1; i<rec->data.txt.count; i++) {
+ tmp = talloc_asprintf_append(tmp, " \"%s\"",
+ rec->data.txt.str[i]);
+ }
+ ans[ai].rdata.txt_record.txt = tmp;
+ break;
default:
+ DEBUG(0, ("Got unhandled type %u query.\n", rec->wType));
return DNS_ERR(NOT_IMPLEMENTED);
}