aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-29 22:26:21 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-29 22:26:21 +0100
commite871f8368c8a1f0867f68f656875e4c37c26f298 (patch)
treec2aa6a2b40213d695e8f047a51695563f44d74b8
parentf8bccfbb602bdbed4bcc00fd3c6c3a00add82416 (diff)
downloadgnunet-e871f8368c8a1f0867f68f656875e4c37c26f298.tar.gz
gnunet-e871f8368c8a1f0867f68f656875e4c37c26f298.zip
finish (?) libgnunetatstransport for now
-rw-r--r--src/arm/gnunet-service-arm.c32
-rw-r--r--src/ats/ats_api2_transport.c41
-rw-r--r--src/fs/gnunet-service-fs.c10
-rw-r--r--src/gns/gnunet-service-gns.c17
-rw-r--r--src/namestore/gnunet-service-namestore.c9
-rw-r--r--src/regex/gnunet-service-regex.c12
-rw-r--r--src/transport/gnunet-service-tng.c38
-rw-r--r--src/util/gnunet-service-resolver.c30
8 files changed, 62 insertions, 127 deletions
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index bc138e6fc..c9c9b3638 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -469,7 +469,7 @@ get_server_addresses (const char *service_name,
469#endif 469#endif
470 if ( (GNUNET_YES != abstract) && 470 if ( (GNUNET_YES != abstract) &&
471 (GNUNET_OK != 471 (GNUNET_OK !=
472 GNUNET_DISK_directory_create_for_file (unixpath)) ) 472 GNUNET_DISK_directory_create_for_file (unixpath)) )
473 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, 473 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
474 "mkdir", 474 "mkdir",
475 unixpath); 475 unixpath);
@@ -1234,18 +1234,8 @@ static int
1234check_start (void *cls, 1234check_start (void *cls,
1235 const struct GNUNET_ARM_Message *amsg) 1235 const struct GNUNET_ARM_Message *amsg)
1236{ 1236{
1237 uint16_t size;
1238 const char *servicename;
1239
1240 (void) cls; 1237 (void) cls;
1241 size = ntohs (amsg->header.size) - sizeof (struct GNUNET_ARM_Message); 1238 GNUNET_MQ_check_zero_termination (amsg);
1242 servicename = (const char *) &amsg[1];
1243 if ( (0 == size) ||
1244 (servicename[size - 1] != '\0') )
1245 {
1246 GNUNET_break (0);
1247 return GNUNET_SYSERR;
1248 }
1249 return GNUNET_OK; 1239 return GNUNET_OK;
1250} 1240}
1251 1241
@@ -1327,18 +1317,8 @@ static int
1327check_stop (void *cls, 1317check_stop (void *cls,
1328 const struct GNUNET_ARM_Message *amsg) 1318 const struct GNUNET_ARM_Message *amsg)
1329{ 1319{
1330 uint16_t size;
1331 const char *servicename;
1332
1333 (void) cls; 1320 (void) cls;
1334 size = ntohs (amsg->header.size) - sizeof (struct GNUNET_ARM_Message); 1321 GNUNET_MQ_check_zero_termination (amsg);
1335 servicename = (const char *) &amsg[1];
1336 if ( (0 == size) ||
1337 (servicename[size - 1] != '\0') )
1338 {
1339 GNUNET_break (0);
1340 return GNUNET_SYSERR;
1341 }
1342 return GNUNET_OK; 1322 return GNUNET_OK;
1343} 1323}
1344 1324
@@ -1715,7 +1695,7 @@ delayed_restart_task (void *cls)
1715 * Task triggered whenever we receive a SIGCHLD (child 1695 * Task triggered whenever we receive a SIGCHLD (child
1716 * process died). 1696 * process died).
1717 * 1697 *
1718 * @param cls closure, NULL 1698 * @param cls closure, NULL
1719 */ 1699 */
1720static void 1700static void
1721maint_child_death (void *cls) 1701maint_child_death (void *cls)
@@ -2230,7 +2210,7 @@ run (void *cls,
2230 start_system = GNUNET_CONFIGURATION_get_value_yesno (cfg, 2210 start_system = GNUNET_CONFIGURATION_get_value_yesno (cfg,
2231 "ARM", 2211 "ARM",
2232 "START_SYSTEM_SERVICES"); 2212 "START_SYSTEM_SERVICES");
2233 if ( (GNUNET_NO == start_user) && 2213 if ( (GNUNET_NO == start_user) &&
2234 (GNUNET_NO == start_system) ) 2214 (GNUNET_NO == start_system) )
2235 { 2215 {
2236 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2216 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/ats/ats_api2_transport.c b/src/ats/ats_api2_transport.c
index 6add4baf5..5ad9fb40e 100644
--- a/src/ats/ats_api2_transport.c
+++ b/src/ats/ats_api2_transport.c
@@ -131,6 +131,29 @@ struct GNUNET_ATS_TransportHandle
131}; 131};
132 132
133 133
134
135/**
136 * Convert ATS properties from host to network byte order.
137 *
138 * @param nbo[OUT] value written
139 * @param hbo value read
140 */
141static void
142properties_hton (struct PropertiesNBO *nbo,
143 const struct GNUNET_ATS_Properties *hbo)
144{
145 nbo->delay = GNUNET_TIME_relative_hton (hbo->delay);
146 nbo->goodput_out = htonl (hbo->goodput_out);
147 nbo->goodput_in = htonl (hbo->goodput_in);
148 nbo->utilization_out = htonl (hbo->utilization_out);
149 nbo->utilization_in = htonl (hbo->utilization_in);
150 nbo->distance = htonl (hbo->distance);
151 nbo->mtu = htonl (hbo->mtu);
152 nbo->nt = htonl ((uint32_t) hbo->nt);
153 nbo->cc = htonl ((uint32_t) hbo->cc);
154}
155
156
134/** 157/**
135 * Re-establish the connection to the ATS service. 158 * Re-establish the connection to the ATS service.
136 * 159 *
@@ -250,10 +273,10 @@ match_session_cb (void *cls,
250 273
251 (void) pid; 274 (void) pid;
252 if (fc->session_id == sr->slot) 275 if (fc->session_id == sr->slot)
253 { 276 {
254 fc->sr = sr; 277 fc->sr = sr;
255 return GNUNET_NO; 278 return GNUNET_NO;
256 } 279 }
257 return GNUNET_YES; 280 return GNUNET_YES;
258} 281}
259 282
@@ -366,8 +389,8 @@ send_add_session_message (const struct GNUNET_ATS_SessionRecord *ar)
366 : GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD); 389 : GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD);
367 m->peer = ar->pid; 390 m->peer = ar->pid;
368 m->session_id = htonl (ar->slot); 391 m->session_id = htonl (ar->slot);
369 // FIXME: convert endianess here! 392 properties_hton (&m->properties,
370 // m->properties = ar->properties; 393 &ar->properties);
371 GNUNET_memcpy (&m[1], 394 GNUNET_memcpy (&m[1],
372 ar->address, 395 ar->address,
373 alen); 396 alen);
@@ -580,7 +603,7 @@ GNUNET_ATS_session_add (struct GNUNET_ATS_TransportHandle *ath,
580 alen = strlen (address) + 1; 603 alen = strlen (address) + 1;
581 ar = GNUNET_malloc (sizeof (struct GNUNET_ATS_SessionRecord) + alen); 604 ar = GNUNET_malloc (sizeof (struct GNUNET_ATS_SessionRecord) + alen);
582 ar->ath = ath; 605 ar->ath = ath;
583 ar->slot = 42; // FIXME: make up unique number! 606 ar->slot = s;
584 ar->session = session; 607 ar->session = session;
585 ar->address = (const char *) &ar[1]; 608 ar->address = (const char *) &ar[1];
586 ar->pid = *pid; 609 ar->pid = *pid;
@@ -627,8 +650,8 @@ GNUNET_ATS_session_update (struct GNUNET_ATS_SessionRecord *ar,
627 GNUNET_MESSAGE_TYPE_ATS_SESSION_UPDATE); 650 GNUNET_MESSAGE_TYPE_ATS_SESSION_UPDATE);
628 m->session_id = htonl (ar->slot); 651 m->session_id = htonl (ar->slot);
629 m->peer = ar->pid; 652 m->peer = ar->pid;
630 // FIXME: convert endianess here! 653 properties_hton (&m->properties,
631 // m->properties = ar->properties; 654 &ar->properties);
632 GNUNET_MQ_send (ath->mq, 655 GNUNET_MQ_send (ath->mq,
633 ev); 656 ev);
634} 657}
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index fea22f279..04d483847 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -965,15 +965,9 @@ static int
965check_client_index_start (void *cls, 965check_client_index_start (void *cls,
966 const struct IndexStartMessage *ism) 966 const struct IndexStartMessage *ism)
967{ 967{
968 uint16_t msize;
969 char *fn; 968 char *fn;
970 969
971 msize = ntohs (ism->header.size); 970 GNUNET_MQ_check_zero_termination (ism);
972 if (((const char *) ism)[msize - 1] != '\0')
973 {
974 GNUNET_break (0);
975 return GNUNET_SYSERR;
976 }
977 if (0 != ism->reserved) 971 if (0 != ism->reserved)
978 { 972 {
979 GNUNET_break (0); 973 GNUNET_break (0);
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 71e744733..bd9d17895 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -396,19 +396,12 @@ static int
396check_lookup (void *cls, 396check_lookup (void *cls,
397 const struct LookupMessage *l_msg) 397 const struct LookupMessage *l_msg)
398{ 398{
399 size_t msg_size; 399 size_t nlen;
400 const char* name;
401 400
402 (void) cls; 401 (void) cls;
403 msg_size = ntohs (l_msg->header.size); 402 GNUNET_MQ_check_zero_termination (l_msg);
404 if (msg_size < sizeof (struct LookupMessage)) 403 nlen = ntohs (l_msg->header.size) - sizeof (struct LookupMessage);
405 { 404 if (nlen > GNUNET_DNSPARSER_MAX_NAME_LENGTH)
406 GNUNET_break (0);
407 return GNUNET_SYSERR;
408 }
409 name = (const char *) &l_msg[1];
410 if ( ('\0' != name[msg_size - sizeof (struct LookupMessage) - 1]) ||
411 (strlen (name) > GNUNET_DNSPARSER_MAX_NAME_LENGTH) )
412 { 405 {
413 GNUNET_break (0); 406 GNUNET_break (0);
414 return GNUNET_SYSERR; 407 return GNUNET_SYSERR;
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index cdd52cc42..0558649ca 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1221,7 +1221,6 @@ check_record_lookup (void *cls,
1221{ 1221{
1222 uint32_t name_len; 1222 uint32_t name_len;
1223 size_t src_size; 1223 size_t src_size;
1224 const char *name_tmp;
1225 1224
1226 (void) cls; 1225 (void) cls;
1227 name_len = ntohl (ll_msg->label_len); 1226 name_len = ntohl (ll_msg->label_len);
@@ -1231,13 +1230,7 @@ check_record_lookup (void *cls,
1231 GNUNET_break (0); 1230 GNUNET_break (0);
1232 return GNUNET_SYSERR; 1231 return GNUNET_SYSERR;
1233 } 1232 }
1234 1233 GNUNET_MQ_check_zero_termination (ll_msg);
1235 name_tmp = (const char *) &ll_msg[1];
1236 if ('\0' != name_tmp[name_len -1])
1237 {
1238 GNUNET_break (0);
1239 return GNUNET_SYSERR;
1240 }
1241 return GNUNET_OK; 1234 return GNUNET_OK;
1242} 1235}
1243 1236
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c
index eb10e7c07..9b9cad231 100644
--- a/src/regex/gnunet-service-regex.c
+++ b/src/regex/gnunet-service-regex.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -131,16 +131,8 @@ check_announce (void *cls,
131 const struct AnnounceMessage *am) 131 const struct AnnounceMessage *am)
132{ 132{
133 struct ClientEntry *ce = cls; 133 struct ClientEntry *ce = cls;
134 const char *regex;
135 uint16_t size;
136 134
137 size = ntohs (am->header.size) - sizeof (*am); 135 GNUNET_MQ_check_zero_termination (am);
138 regex = (const char *) &am[1];
139 if ('\0' != regex[size - 1])
140 {
141 GNUNET_break (0);
142 return GNUNET_SYSERR;
143 }
144 if (NULL != ce->ah) 136 if (NULL != ce->ah)
145 { 137 {
146 /* only one announcement per client allowed */ 138 /* only one announcement per client allowed */
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index b184a0600..feaa0cfff 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -1078,7 +1078,6 @@ check_communicator_available (void *cls,
1078 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam) 1078 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
1079{ 1079{
1080 struct TransportClient *tc = cls; 1080 struct TransportClient *tc = cls;
1081 const char *addr;
1082 uint16_t size; 1081 uint16_t size;
1083 1082
1084 if (CT_NONE != tc->type) 1083 if (CT_NONE != tc->type)
@@ -1090,12 +1089,7 @@ check_communicator_available (void *cls,
1090 size = ntohs (cam->header.size) - sizeof (*cam); 1089 size = ntohs (cam->header.size) - sizeof (*cam);
1091 if (0 == size) 1090 if (0 == size)
1092 return GNUNET_OK; /* receive-only communicator */ 1091 return GNUNET_OK; /* receive-only communicator */
1093 addr = (const char *) &cam[1]; 1092 GNUNET_MQ_check_zero_termination (cam);
1094 if ('\0' != addr[size-1])
1095 {
1096 GNUNET_break (0);
1097 return GNUNET_SYSERR;
1098 }
1099 return GNUNET_OK; 1093 return GNUNET_OK;
1100} 1094}
1101 1095
@@ -1135,26 +1129,13 @@ check_add_address (void *cls,
1135 const struct GNUNET_TRANSPORT_AddAddressMessage *aam) 1129 const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
1136{ 1130{
1137 struct TransportClient *tc = cls; 1131 struct TransportClient *tc = cls;
1138 const char *addr;
1139 uint16_t size;
1140 1132
1141 if (CT_COMMUNICATOR != tc->type) 1133 if (CT_COMMUNICATOR != tc->type)
1142 { 1134 {
1143 GNUNET_break (0); 1135 GNUNET_break (0);
1144 return GNUNET_SYSERR; 1136 return GNUNET_SYSERR;
1145 } 1137 }
1146 size = ntohs (aam->header.size) - sizeof (*aam); 1138 GNUNET_MQ_check_zero_termination (aam);
1147 if (0 == size)
1148 {
1149 GNUNET_break (0);
1150 return GNUNET_SYSERR;
1151 }
1152 addr = (const char *) &aam[1];
1153 if ('\0' != addr[size-1])
1154 {
1155 GNUNET_break (0);
1156 return GNUNET_SYSERR;
1157 }
1158 return GNUNET_OK; 1139 return GNUNET_OK;
1159} 1140}
1160 1141
@@ -1363,26 +1344,13 @@ check_add_queue_message (void *cls,
1363 const struct GNUNET_TRANSPORT_AddQueueMessage *aqm) 1344 const struct GNUNET_TRANSPORT_AddQueueMessage *aqm)
1364{ 1345{
1365 struct TransportClient *tc = cls; 1346 struct TransportClient *tc = cls;
1366 const char *addr;
1367 uint16_t size;
1368 1347
1369 if (CT_COMMUNICATOR != tc->type) 1348 if (CT_COMMUNICATOR != tc->type)
1370 { 1349 {
1371 GNUNET_break (0); 1350 GNUNET_break (0);
1372 return GNUNET_SYSERR; 1351 return GNUNET_SYSERR;
1373 } 1352 }
1374 size = ntohs (aqm->header.size) - sizeof (*aqm); 1353 GNUNET_MQ_check_zero_termination (aqm);
1375 if (0 == size)
1376 {
1377 GNUNET_break (0);
1378 return GNUNET_SYSERR;
1379 }
1380 addr = (const char *) &aqm[1];
1381 if ('\0' != addr[size-1])
1382 {
1383 GNUNET_break (0);
1384 return GNUNET_SYSERR;
1385 }
1386 return GNUNET_OK; 1354 return GNUNET_OK;
1387} 1355}
1388 1356
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index 3b871ce33..5f8957d8c 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -365,12 +365,12 @@ lookup_dns_servers (char ***server_addrs)
365 return -1; 365 return -1;
366 } 366 }
367 if ((size_t) bytes_read > SIZE_MAX) 367 if ((size_t) bytes_read > SIZE_MAX)
368 { 368 {
369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
370 "/etc/resolv.conf file too large to mmap. " 370 "/etc/resolv.conf file too large to mmap. "
371 "DNS resolution will not be possible.\n"); 371 "DNS resolution will not be possible.\n");
372 GNUNET_DISK_file_close (fh); 372 GNUNET_DISK_file_close (fh);
373 return -1; 373 return -1;
374 } 374 }
375 buf = GNUNET_DISK_file_map (fh, 375 buf = GNUNET_DISK_file_map (fh,
376 &mh, 376 &mh,
@@ -600,7 +600,7 @@ remove_expired (struct ResolveCache *rc)
600 pos); 600 pos);
601 GNUNET_DNSPARSER_free_record (pos->record); 601 GNUNET_DNSPARSER_free_record (pos->record);
602 GNUNET_free (pos->record); 602 GNUNET_free (pos->record);
603 GNUNET_free (pos); 603 GNUNET_free (pos);
604 } 604 }
605 } 605 }
606 if (NULL == rc->records_head) 606 if (NULL == rc->records_head)
@@ -1062,7 +1062,7 @@ process_get (const char *hostname,
1062 struct GNUNET_SERVICE_Client *client) 1062 struct GNUNET_SERVICE_Client *client)
1063{ 1063{
1064 char fqdn[255]; 1064 char fqdn[255];
1065 1065
1066 if ( (NULL != my_domain) && 1066 if ( (NULL != my_domain) &&
1067 (NULL == strchr (hostname, 1067 (NULL == strchr (hostname,
1068 (unsigned char) '.')) && 1068 (unsigned char) '.')) &&
@@ -1072,7 +1072,7 @@ process_get (const char *hostname,
1072 sizeof (fqdn), 1072 sizeof (fqdn),
1073 "%s.%s", 1073 "%s.%s",
1074 hostname, 1074 hostname,
1075 my_domain); 1075 my_domain);
1076 } 1076 }
1077 else if (strlen (hostname) < 255) 1077 else if (strlen (hostname) < 255)
1078 { 1078 {
@@ -1126,15 +1126,7 @@ check_get (void *cls,
1126 direction = ntohl (get->direction); 1126 direction = ntohl (get->direction);
1127 if (GNUNET_NO == direction) 1127 if (GNUNET_NO == direction)
1128 { 1128 {
1129 /* IP from hostname */ 1129 GNUNET_MQ_check_zero_termination (get);
1130 const char *hostname;
1131
1132 hostname = (const char *) &get[1];
1133 if (hostname[size - 1] != '\0')
1134 {
1135 GNUNET_break (0);
1136 return GNUNET_SYSERR;
1137 }
1138 return GNUNET_OK; 1130 return GNUNET_OK;
1139 } 1131 }
1140 af = ntohl (get->af); 1132 af = ntohl (get->af);
@@ -1257,7 +1249,7 @@ shutdown_task (void *cls)
1257 1249
1258 1250
1259/** 1251/**
1260 * Add information about a host from /etc/hosts 1252 * Add information about a host from /etc/hosts
1261 * to our cache. 1253 * to our cache.
1262 * 1254 *
1263 * @param hostname the name of the host 1255 * @param hostname the name of the host
@@ -1278,7 +1270,7 @@ add_host (const char *hostname,
1278 rec = GNUNET_malloc (sizeof (struct GNUNET_DNSPARSER_Record)); 1270 rec = GNUNET_malloc (sizeof (struct GNUNET_DNSPARSER_Record));
1279 rec->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS; 1271 rec->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS;
1280 rec->type = rec_type; 1272 rec->type = rec_type;
1281 rec->dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET; 1273 rec->dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
1282 rec->name = GNUNET_strdup (hostname); 1274 rec->name = GNUNET_strdup (hostname);
1283 rec->data.raw.data = GNUNET_memdup (data, 1275 rec->data.raw.data = GNUNET_memdup (data,
1284 data_size); 1276 data_size);
@@ -1298,7 +1290,7 @@ add_host (const char *hostname,
1298 1290
1299/** 1291/**
1300 * Extract host information from a line in /etc/hosts 1292 * Extract host information from a line in /etc/hosts
1301 * 1293 *
1302 * @param line the line to parse 1294 * @param line the line to parse
1303 * @param line_len number of bytes in @a line 1295 * @param line_len number of bytes in @a line
1304 */ 1296 */
@@ -1389,12 +1381,12 @@ load_etc_hosts (void)
1389 return; 1381 return;
1390 } 1382 }
1391 if ((size_t) bytes_read > SIZE_MAX) 1383 if ((size_t) bytes_read > SIZE_MAX)
1392 { 1384 {
1393 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1385 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1394 "/etc/hosts file too large to mmap. " 1386 "/etc/hosts file too large to mmap. "
1395 "DNS resolution will not be possible.\n"); 1387 "DNS resolution will not be possible.\n");
1396 GNUNET_DISK_file_close (fh); 1388 GNUNET_DISK_file_close (fh);
1397 return; 1389 return;
1398 } 1390 }
1399 buf = GNUNET_DISK_file_map (fh, 1391 buf = GNUNET_DISK_file_map (fh,
1400 &mh, 1392 &mh,