aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-06-16 21:47:37 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-06-16 21:47:37 +0000
commitd89f437df5f75c2eebcea71ba6adc6e8452b2d27 (patch)
treeb4c5a7cb568e32a2e1daa5d6a7e09b07d4652b92
parent7285a75bacb65122bdfe54ca84b3891951bd5796 (diff)
downloadgnunet-d89f437df5f75c2eebcea71ba6adc6e8452b2d27.tar.gz
gnunet-d89f437df5f75c2eebcea71ba6adc6e8452b2d27.zip
properly handle CNAME as specified in rfc1034#section-3.6.2
-rw-r--r--src/gns/gnunet-service-gns_resolver.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index d6fe4d3d4..565d50eaf 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -1359,6 +1359,19 @@ read_dns_response (void *cls,
1359 1359
1360 for (i = 0; i < packet->num_answers; i++) 1360 for (i = 0; i < packet->num_answers; i++)
1361 { 1361 {
1362 /* http://tools.ietf.org/html/rfc1034#section-3.6.2 */
1363 if (packet->authority_records[i].type == GNUNET_GNS_RECORD_TYPE_CNAME)
1364 {
1365 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1366 "CNAME... restarting query with %s\n",
1367 packet->answers[i].data.hostname
1368 );
1369 strcpy (rh->dns_name, packet->answers[i].data.hostname);
1370 send_dns_packet (rh);
1371 GNUNET_DNSPARSER_free_packet (packet);
1372 return;
1373 }
1374
1362 if ((packet->answers[i].type == rlh->record_type) && 1375 if ((packet->answers[i].type == rlh->record_type) &&
1363 (0 == strcmp (packet->answers[i].name, rh->dns_name))) 1376 (0 == strcmp (packet->answers[i].name, rh->dns_name)))
1364 { 1377 {
@@ -1379,6 +1392,7 @@ read_dns_response (void *cls,
1379 1392
1380 for (i = 0; i < packet->num_authority_records; i++) 1393 for (i = 0; i < packet->num_authority_records; i++)
1381 { 1394 {
1395
1382 if (packet->authority_records[i].type == GNUNET_GNS_RECORD_TYPE_NS) 1396 if (packet->authority_records[i].type == GNUNET_GNS_RECORD_TYPE_NS)
1383 { 1397 {
1384 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,