diff options
author | Amitay Isaacs <amitay@gmail.com> | 2012-02-28 17:01:27 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2012-03-02 00:24:50 +1100 |
commit | 78446b42b7bed565dff75db73e8efcd3835808c0 (patch) | |
tree | b99d8394a4feb296432f64700671c97c4c5f7846 | |
parent | e5409ad0ca0517118c261fa924221fd18afaf66d (diff) | |
download | samba-78446b42b7bed565dff75db73e8efcd3835808c0.tar.gz samba-78446b42b7bed565dff75db73e8efcd3835808c0.tar.bz2 samba-78446b42b7bed565dff75db73e8efcd3835808c0.zip |
s4-dns: Fix handling of TXT DNS Record
-rw-r--r-- | source4/dns_server/dns_update.c | 11 | ||||
-rw-r--r-- | source4/dns_server/dns_utils.c | 13 |
2 files changed, 21 insertions, 3 deletions
diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c index 3fd612cfab..62cf9e555a 100644 --- a/source4/dns_server/dns_update.c +++ b/source4/dns_server/dns_update.c @@ -334,8 +334,15 @@ static WERROR dns_rr_to_dnsp(TALLOC_CTX *mem_ctx, W_ERROR_HAVE_NO_MEMORY(r->data.mx.nameTarget); break; case DNS_QTYPE_TXT: - r->data.txt = talloc_strdup(mem_ctx, rrec->rdata.txt_record.txt); - W_ERROR_HAVE_NO_MEMORY(r->data.txt); + /* FIXME: This converts the TXT rr data into a single string. + * Since dns server does not reply to qtype TXT, + * this is not yet relevant. + */ + r->data.txt.count = 1; + r->data.txt.str = talloc_array(mem_ctx, const char *, 1); + W_ERROR_HAVE_NO_MEMORY(r->data.txt.str); + r->data.txt.str[0] = talloc_strdup(mem_ctx, rrec->rdata.txt_record.txt); + W_ERROR_HAVE_NO_MEMORY(r->data.txt.str[0]); break; default: DEBUG(0, ("Got a qytpe of %d\n", rrec->rr_type)); diff --git a/source4/dns_server/dns_utils.c b/source4/dns_server/dns_utils.c index 4649e5ffca..1f7648cd5b 100644 --- a/source4/dns_server/dns_utils.c +++ b/source4/dns_server/dns_utils.c @@ -115,6 +115,9 @@ bool dns_name_equal(const char *name1, const char *name2) bool dns_records_match(struct dnsp_DnssrvRpcRecord *rec1, struct dnsp_DnssrvRpcRecord *rec2) { + bool status; + int i; + if (rec1->wType != rec2->wType) { return false; } @@ -128,7 +131,15 @@ bool dns_records_match(struct dnsp_DnssrvRpcRecord *rec1, case DNS_TYPE_CNAME: return dns_name_equal(rec1->data.cname, rec2->data.cname); case DNS_TYPE_TXT: - return strcmp(rec1->data.txt, rec2->data.txt) == 0; + if (rec1->data.txt.count != rec2->data.txt.count) { + return false; + } + status = true; + for (i=0; i<rec1->data.txt.count; i++) { + status = status && (strcmp(rec1->data.txt.str[i], + rec2->data.txt.str[i]) == 0); + } + return status; case DNS_TYPE_PTR: return strcmp(rec1->data.ptr, rec2->data.ptr) == 0; case DNS_TYPE_NS: |