summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-02-28 16:35:39 +1100
committerAmitay Isaacs <amitay@gmail.com>2012-03-02 00:24:50 +1100
commitcf139b4efcf13c12b20f63969c0744771a0d8e9a (patch)
tree63d4cbbcdc292877780f3971debf771a73a74e81 /source4
parent0c774220412c4b56c00d276ef4bfc50336a99284 (diff)
downloadsamba-cf139b4efcf13c12b20f63969c0744771a0d8e9a.tar.gz
samba-cf139b4efcf13c12b20f63969c0744771a0d8e9a.tar.xz
samba-cf139b4efcf13c12b20f63969c0744771a0d8e9a.zip
s4-rpc: dnsserver: Update data type for TXT DNS records
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/dnsserver/dnsdata.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/source4/rpc_server/dnsserver/dnsdata.c b/source4/rpc_server/dnsserver/dnsdata.c
index 50be4bcbf19..c8ac58d8bd1 100644
--- a/source4/rpc_server/dnsserver/dnsdata.c
+++ b/source4/rpc_server/dnsserver/dnsdata.c
@@ -236,7 +236,7 @@ char *dns_split_node_name(TALLOC_CTX *tmp_ctx, const char *node_name, const char
void dnsp_to_dns_copy(TALLOC_CTX *mem_ctx, struct dnsp_DnssrvRpcRecord *dnsp,
struct DNS_RPC_RECORD *dns)
{
- int len;
+ int i, len;
ZERO_STRUCTP(dns);
@@ -323,8 +323,12 @@ void dnsp_to_dns_copy(TALLOC_CTX *mem_ctx, struct dnsp_DnssrvRpcRecord *dnsp,
break;
case DNS_TYPE_TXT:
- dns->data.name.len = strlen(dnsp->data.txt);
- dns->data.name.str = talloc_strdup(mem_ctx, dnsp->data.txt);
+ dns->data.txt.count = dnsp->data.txt.count;
+ dns->data.txt.str = talloc_array(mem_ctx, struct DNS_RPC_NAME, dnsp->data.txt.count);
+ for (i=0; i<dnsp->data.txt.count; i++) {
+ dns->data.txt.str[i].str = talloc_strdup(mem_ctx, dnsp->data.txt.str[i]);
+ dns->data.txt.str[i].len = strlen(dnsp->data.txt.str[i]);
+ }
break;
case DNS_TYPE_AAAA:
@@ -355,7 +359,7 @@ void dnsp_to_dns_copy(TALLOC_CTX *mem_ctx, struct dnsp_DnssrvRpcRecord *dnsp,
struct dnsp_DnssrvRpcRecord *dns_to_dnsp_copy(TALLOC_CTX *mem_ctx, struct DNS_RPC_RECORD *dns)
{
- int len;
+ int i, len;
struct dnsp_DnssrvRpcRecord *dnsp;
dnsp = talloc_zero(mem_ctx, struct dnsp_DnssrvRpcRecord);
@@ -436,7 +440,11 @@ struct dnsp_DnssrvRpcRecord *dns_to_dnsp_copy(TALLOC_CTX *mem_ctx, struct DNS_RP
break;
case DNS_TYPE_TXT:
- dnsp->data.txt = talloc_strdup(mem_ctx, dns->data.name.str);
+ dnsp->data.txt.count = dns->data.txt.count;
+ dnsp->data.txt.str = talloc_array(mem_ctx, const char *, dns->data.txt.count);
+ for (i=0; i<dns->data.txt.count; i++) {
+ dnsp->data.txt.str[i] = talloc_strdup(mem_ctx, dns->data.txt.str[i].str);
+ }
break;
case DNS_TYPE_AAAA:
@@ -929,6 +937,9 @@ bool dns_name_equal(const char *name1, const char *name2)
bool dns_record_match(struct dnsp_DnssrvRpcRecord *rec1, struct dnsp_DnssrvRpcRecord *rec2)
{
+ bool status;
+ int i;
+
if (rec1->wType != rec2->wType) {
return false;
}
@@ -963,7 +974,15 @@ bool dns_record_match(struct dnsp_DnssrvRpcRecord *rec1, struct dnsp_DnssrvRpcRe
dns_name_equal(rec1->data.mx.nameTarget, rec2->data.srv.nameTarget);
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_AAAA:
return strcmp(rec1->data.ipv6, rec2->data.ipv6) == 0;