[Asterisk-code-review] dns: Use ntohl for ans->ttl in dns parse answer ex (asterisk[master])

Matt Jordan asteriskteam at digium.com
Wed Nov 11 08:09:06 CST 2015


Matt Jordan has submitted this change and it was merged.

Change subject: dns: Use ntohl for ans->ttl in dns_parse_answer_ex
......................................................................


dns: Use ntohl for ans->ttl in dns_parse_answer_ex

dns_parse_answer_ex was not converting ans->ttl from network
by order to host byte order which was causing certain ttls
it to go negative. In turn this was causing answer edit checks
to fail.

ASTERISK-25528 #close
Reported-by: Daniel Tryba
Tested-by: George Joseph

Change-Id: I31505132d6321c46d2f39fd06c20ee808a864037
---
M main/dns.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/main/dns.c b/main/dns.c
index e1b7770..c3b352d 100644
--- a/main/dns.c
+++ b/main/dns.c
@@ -475,7 +475,7 @@
 		/* Skip over the records that do not have the same resource record class and type we care about */
 		if (ntohs(ans->class) == rr_class && ntohs(ans->rtype) == rr_type) {
 			/* Invoke the record handler callback to deliver the discovered record */
-			record_handler(context, answer, ntohs(ans->size), ans->ttl);
+			record_handler(context, answer, ntohs(ans->size), ntohl(ans->ttl));
 			/*At least one record was found */
 			ret = AST_DNS_SEARCH_SUCCESS;
 		}

-- 
To view, visit https://gerrit.asterisk.org/1585
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I31505132d6321c46d2f39fd06c20ee808a864037
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list