[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: do not crash on multiple CN
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: do not crash on multiple CNAMEs |
Date: |
Sun, 20 May 2018 12:51:44 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 98edad8c6 do not crash on multiple CNAMEs
98edad8c6 is described below
commit 98edad8c6d481091fda3a59d1047762e10fe72c0
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun May 20 12:51:41 2018 +0200
do not crash on multiple CNAMEs
---
src/gns/gnunet-service-gns_resolver.c | 71 ++++++++++++++++++++++-------------
src/util/resolver_api.c | 4 +-
2 files changed, 47 insertions(+), 28 deletions(-)
diff --git a/src/gns/gnunet-service-gns_resolver.c
b/src/gns/gnunet-service-gns_resolver.c
index 542085910..369bd3d63 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -946,35 +946,43 @@ dns_result_parser (void *cls,
if ( (p->num_answers > 0) &&
(GNUNET_DNSPARSER_TYPE_CNAME == p->answers[0].type) &&
(GNUNET_DNSPARSER_TYPE_CNAME != rh->record_type) )
- {
- int af;
+ {
+ int af;
- GNUNET_free (rh->name);
- rh->name = GNUNET_strdup (p->answers[0].data.hostname);
- rh->name_resolution_pos = strlen (rh->name);
- switch (rh->record_type)
- {
- case GNUNET_DNSPARSER_TYPE_A:
- af = AF_INET;
- break;
- case GNUNET_DNSPARSER_TYPE_AAAA:
- af = AF_INET6;
- break;
- default:
- af = AF_UNSPEC;
- break;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Doing standard DNS lookup for `%s'\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Got CNAME `%s' from DNS for `%s'\n",
+ p->answers[0].data.hostname,
+ rh->name);
+ if (NULL != rh->std_resolve)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Multiple CNAME results from DNS resolving `%s'! Not really
allowed...\n",
rh->name);
- rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
- af,
- DNS_LOOKUP_TIMEOUT,
- &handle_dns_result,
- rh);
- GNUNET_DNSPARSER_free_packet (p);
- return;
+ GNUNET_RESOLVER_request_cancel (rh->std_resolve);
+ }
+ GNUNET_free (rh->name);
+ rh->name = GNUNET_strdup (p->answers[0].data.hostname);
+ rh->name_resolution_pos = strlen (rh->name);
+ switch (rh->record_type)
+ {
+ case GNUNET_DNSPARSER_TYPE_A:
+ af = AF_INET;
+ break;
+ case GNUNET_DNSPARSER_TYPE_AAAA:
+ af = AF_INET6;
+ break;
+ default:
+ af = AF_UNSPEC;
+ break;
}
+ rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
+ af,
+ DNS_LOOKUP_TIMEOUT,
+ &handle_dns_result,
+ rh);
+ GNUNET_DNSPARSER_free_packet (p);
+ return;
+ }
/* convert from (parsed) DNS to (binary) GNS format! */
rd_count = p->num_answers + p->num_authority_records +
p->num_additional_records;
@@ -1245,6 +1253,17 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
rh);
return;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Got CNAME `%s' from GNS for `%s'\n",
+ cname,
+ rh->name);
+ if (NULL != rh->std_resolve)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Multiple CNAME results from GNS resolving `%s'! Not really
allowed...\n",
+ rh->name);
+ GNUNET_RESOLVER_request_cancel (rh->std_resolve);
+ }
/* name is absolute, go to DNS */
GNUNET_free (rh->name);
rh->name = GNUNET_strdup (cname);
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index 68f02587a..21f902578 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -515,8 +515,8 @@ handle_response (void *cls,
if ( (NULL != rh->addr_callback) &&
(GNUNET_SYSERR != rh->was_transmitted) )
rh->addr_callback (rh->cls,
- NULL,
- 0);
+ NULL,
+ 0);
}
rh->was_transmitted = GNUNET_NO;
GNUNET_RESOLVER_request_cancel (rh);
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: do not crash on multiple CNAMEs,
gnunet <=