summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-05-29 15:20:21 +0200
committerKai Blin <kai@samba.org>2012-05-30 00:37:55 +0200
commit6cdbce266b6ecccf181429949104df700d58351c (patch)
tree7398248b8b5e8ded3147a3e4c02f6302892091b9
parent1171c562f6ba074413b730086c97787661ec9634 (diff)
downloadsamba-6cdbce266b6ecccf181429949104df700d58351c.tar.gz
samba-6cdbce266b6ecccf181429949104df700d58351c.tar.bz2
samba-6cdbce266b6ecccf181429949104df700d58351c.zip
s4-dns: Create a proper talloc hierarchy in create_response_rr
Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Kai Blin <kai@samba.org>
-rw-r--r--source4/dns_server/dns_query.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c
index b57a26c763..3564140948 100644
--- a/source4/dns_server/dns_query.c
+++ b/source4/dns_server/dns_query.c
@@ -67,11 +67,23 @@ static WERROR create_response_rr(const struct dns_name_question *question,
ans[ai].rdata.srv_record.priority = rec->data.srv.wPriority;
ans[ai].rdata.srv_record.weight = rec->data.srv.wWeight;
ans[ai].rdata.srv_record.port = rec->data.srv.wPort;
- ans[ai].rdata.srv_record.target = rec->data.srv.nameTarget;
+ ans[ai].rdata.srv_record.target = talloc_strdup(
+ ans, rec->data.srv.nameTarget);
+ if (ans[ai].rdata.srv_record.target == NULL) {
+ return WERR_NOMEM;
+ }
break;
case DNS_QTYPE_SOA:
- ans[ai].rdata.soa_record.mname = rec->data.soa.mname;
- ans[ai].rdata.soa_record.rname = rec->data.soa.rname;
+ ans[ai].rdata.soa_record.mname = talloc_strdup(
+ ans, rec->data.soa.mname);
+ if (ans[ai].rdata.soa_record.mname == NULL) {
+ return WERR_NOMEM;
+ }
+ ans[ai].rdata.soa_record.rname = talloc_strdup(
+ ans, rec->data.soa.rname);
+ if (ans[ai].rdata.soa_record.rname == NULL) {
+ return WERR_NOMEM;
+ }
ans[ai].rdata.soa_record.serial = rec->data.soa.serial;
ans[ai].rdata.soa_record.refresh = rec->data.soa.refresh;
ans[ai].rdata.soa_record.retry = rec->data.soa.retry;