aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--src/vpn/gnunet-service-dns.c77
2 files changed, 45 insertions, 34 deletions
diff --git a/TODO b/TODO
index 5e68b7a51..a72b7fab3 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,6 @@
10.9.0pre3: 10.9.0pre3:
2* make sure transport provides latency in ATS (fs tests are complaining bitterly,
3 on line gnunet-service-fs_cp.c:338).
2* clean buildbots (with new transport) 4* clean buildbots (with new transport)
3 5
40.9.0pre4: 60.9.0pre4:
diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c
index 1c38f5ddc..4ff0a75a9 100644
--- a/src/vpn/gnunet-service-dns.c
+++ b/src/vpn/gnunet-service-dns.c
@@ -1123,12 +1123,13 @@ cleanup_task (void *cls
1123 * 1123 *
1124 * @return 1124 * @return
1125 */ 1125 */
1126uint64_t 1126static uint64_t
1127get_port_from_redirects (const char *udp_redirects, const char *tcp_redirects) 1127get_port_from_redirects (const char *udp_redirects, const char *tcp_redirects)
1128{ 1128{
1129 uint64_t ret = 0; 1129 uint64_t ret = 0;
1130 char *cpy, *hostname, *redirect; 1130 char *cpy, *hostname, *redirect;
1131 int local_port, count = 0; 1131 int local_port;
1132 unsigned int count = 0;
1132 1133
1133 if (NULL != udp_redirects) 1134 if (NULL != udp_redirects)
1134 { 1135 {
@@ -1197,12 +1198,11 @@ get_port_from_redirects (const char *udp_redirects, const char *tcp_redirects)
1197 } 1198 }
1198 1199
1199out: 1200out:
1200 if (NULL != cpy) 1201 GNUNET_free_non_null (cpy);
1201 GNUNET_free (cpy);
1202 return ret; 1202 return ret;
1203} 1203}
1204 1204
1205void 1205static void
1206publish_name (const char *name, uint64_t ports, uint32_t service_type, 1206publish_name (const char *name, uint64_t ports, uint32_t service_type,
1207 struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key) 1207 struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key)
1208{ 1208{
@@ -1245,28 +1245,36 @@ publish_name (const char *name, uint64_t ports, uint32_t service_type,
1245 GNUNET_TIME_UNIT_MINUTES, NULL, NULL); 1245 GNUNET_TIME_UNIT_MINUTES, NULL, NULL);
1246} 1246}
1247 1247
1248
1248/** 1249/**
1249 * @brief Publishes the record defined by the section section 1250 * @brief Publishes the record defined by the section section
1250 * 1251 *
1251 * @param cls closure 1252 * @param cls closure
1252 * @param section the current section 1253 * @param section the current section
1253 */ 1254 */
1254void 1255static void
1255publish_iterate (void *cls __attribute__ ((unused)), const char *section) 1256publish_iterate (void *cls __attribute__ ((unused)), const char *section)
1256{ 1257{
1258 char *udp_redirects;
1259 char *tcp_redirects;
1260 char *alternative_names;
1261 char *alternative_name;
1262 char *keyfile;
1263
1257 if ((strlen (section) < 8) || 1264 if ((strlen (section) < 8) ||
1258 (0 != strcmp (".gnunet.", section + (strlen (section) - 8)))) 1265 (0 != strcmp (".gnunet.", section + (strlen (section) - 8))))
1259 return; 1266 return;
1260 1267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1261 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Parsing dns-name %s\n", section); 1268 "Parsing dns-name %s\n",
1262 1269 section);
1263 char *udp_redirects, *tcp_redirects, *alternative_names, *alternative_name, 1270 if (GNUNET_OK !=
1264 *keyfile; 1271 GNUNET_CONFIGURATION_get_value_string (cfg, section, "UDP_REDIRECTS",
1265 1272 &udp_redirects))
1266 GNUNET_CONFIGURATION_get_value_string (cfg, section, "UDP_REDIRECTS", 1273 udp_redirects = NULL;
1267 &udp_redirects); 1274 if (GNUNET_OK !=
1268 GNUNET_CONFIGURATION_get_value_string (cfg, section, "TCP_REDIRECTS", 1275 GNUNET_CONFIGURATION_get_value_string (cfg, section, "TCP_REDIRECTS",
1269 &tcp_redirects); 1276 &tcp_redirects))
1277 tcp_redirects = NULL;
1270 1278
1271 if (GNUNET_OK != 1279 if (GNUNET_OK !=
1272 GNUNET_CONFIGURATION_get_value_filename (cfg, "GNUNETD", "HOSTKEY", 1280 GNUNET_CONFIGURATION_get_value_filename (cfg, "GNUNETD", "HOSTKEY",
@@ -1296,22 +1304,23 @@ publish_iterate (void *cls __attribute__ ((unused)), const char *section)
1296 1304
1297 1305
1298 publish_name (section, ports, service_type, my_private_key); 1306 publish_name (section, ports, service_type, my_private_key);
1299 1307 if (GNUNET_OK ==
1300 GNUNET_CONFIGURATION_get_value_string (cfg, section, "ALTERNATIVE_NAMES", 1308 GNUNET_CONFIGURATION_get_value_string (cfg, section, "ALTERNATIVE_NAMES",
1301 &alternative_names); 1309 &alternative_names))
1302 for (alternative_name = strtok (alternative_names, " "); 1310 {
1303 alternative_name != NULL; alternative_name = strtok (NULL, " ")) 1311 for (alternative_name = strtok (alternative_names, " ");
1304 { 1312 alternative_name != NULL; alternative_name = strtok (NULL, " "))
1305 char *altname = 1313 {
1306 alloca (strlen (alternative_name) + strlen (section) + 1 + 1); 1314 char *altname =
1307 strcpy (altname, alternative_name); 1315 alloca (strlen (alternative_name) + strlen (section) + 1 + 1);
1308 strcpy (altname + strlen (alternative_name) + 1, section); 1316 strcpy (altname, alternative_name);
1309 altname[strlen (alternative_name)] = '.'; 1317 strcpy (altname + strlen (alternative_name) + 1, section);
1310 1318 altname[strlen (alternative_name)] = '.';
1311 publish_name (altname, ports, service_type, my_private_key); 1319
1312 } 1320 publish_name (altname, ports, service_type, my_private_key);
1313 1321 }
1314 GNUNET_free_non_null (alternative_names); 1322 GNUNET_free (alternative_names);
1323 }
1315 GNUNET_CRYPTO_rsa_key_free (my_private_key); 1324 GNUNET_CRYPTO_rsa_key_free (my_private_key);
1316 GNUNET_free_non_null (udp_redirects); 1325 GNUNET_free_non_null (udp_redirects);
1317 GNUNET_free_non_null (tcp_redirects); 1326 GNUNET_free_non_null (tcp_redirects);
@@ -1328,9 +1337,9 @@ publish_names (void *cls
1328 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1337 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1329 return; 1338 return;
1330 1339
1331 GNUNET_CONFIGURATION_iterate_sections (cfg, publish_iterate, NULL); 1340 GNUNET_CONFIGURATION_iterate_sections (cfg, &publish_iterate, NULL);
1332 1341
1333 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_HOURS, publish_names, NULL); 1342 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_HOURS, &publish_names, NULL);
1334} 1343}
1335 1344
1336/** 1345/**