diff options
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/gnunet-gns-fcfsd.c | 2 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns.c | 11 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_interceptor.c | 21 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 31 | ||||
-rw-r--r-- | src/gns/plugin_block_gns.c | 16 |
5 files changed, 50 insertions, 31 deletions
diff --git a/src/gns/gnunet-gns-fcfsd.c b/src/gns/gnunet-gns-fcfsd.c index b919b4fed..6802d6685 100644 --- a/src/gns/gnunet-gns-fcfsd.c +++ b/src/gns/gnunet-gns-fcfsd.c | |||
@@ -386,7 +386,7 @@ zone_to_name_cb (void *cls, | |||
386 | &pub)); | 386 | &pub)); |
387 | r.data = &pub; | 387 | r.data = &pub; |
388 | r.data_size = sizeof (pub); | 388 | r.data_size = sizeof (pub); |
389 | r.expiration = GNUNET_TIME_UNIT_FOREVER_ABS; | 389 | r.expiration_time = UINT64_MAX; |
390 | r.record_type = GNUNET_NAMESTORE_TYPE_PKEY; | 390 | r.record_type = GNUNET_NAMESTORE_TYPE_PKEY; |
391 | r.flags = GNUNET_NAMESTORE_RF_AUTHORITY; | 391 | r.flags = GNUNET_NAMESTORE_RF_AUTHORITY; |
392 | request->qe = GNUNET_NAMESTORE_record_create (ns, | 392 | request->qe = GNUNET_NAMESTORE_record_create (ns, |
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 63b180b4b..f63e22e25 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -500,13 +500,16 @@ process_shorten_zone_shorten (void *cls, | |||
500 | { | 500 | { |
501 | struct ClientShortenHandle *csh = cls; | 501 | struct ClientShortenHandle *csh = cls; |
502 | struct GNUNET_TIME_Relative remaining_time; | 502 | struct GNUNET_TIME_Relative remaining_time; |
503 | struct GNUNET_TIME_Absolute et; | ||
503 | 504 | ||
504 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); | 505 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); |
505 | 506 | ||
506 | if ((rd_count == 1) && | 507 | if ((rd_count == 1) && |
507 | (remaining_time.rel_value != 0)) | 508 | (remaining_time.rel_value != 0)) |
508 | { | 509 | { |
509 | remaining_time = GNUNET_TIME_absolute_get_remaining (rd->expiration); | 510 | GNUNET_break (0 == (rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
511 | et.abs_value = rd->expiration_time; | ||
512 | remaining_time = GNUNET_TIME_absolute_get_remaining (et); | ||
510 | if ((rd->record_type == GNUNET_GNS_RECORD_PKEY) && | 513 | if ((rd->record_type == GNUNET_GNS_RECORD_PKEY) && |
511 | (remaining_time.rel_value != 0)) | 514 | (remaining_time.rel_value != 0)) |
512 | { | 515 | { |
@@ -523,6 +526,7 @@ process_shorten_zone_shorten (void *cls, | |||
523 | 526 | ||
524 | } | 527 | } |
525 | 528 | ||
529 | |||
526 | static void | 530 | static void |
527 | process_private_zone_shorten (void *cls, | 531 | process_private_zone_shorten (void *cls, |
528 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, | 532 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key, |
@@ -534,13 +538,16 @@ process_private_zone_shorten (void *cls, | |||
534 | { | 538 | { |
535 | struct GNUNET_TIME_Relative remaining_time; | 539 | struct GNUNET_TIME_Relative remaining_time; |
536 | struct ClientShortenHandle *csh = cls; | 540 | struct ClientShortenHandle *csh = cls; |
541 | struct GNUNET_TIME_Absolute et; | ||
537 | 542 | ||
538 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); | 543 | remaining_time = GNUNET_TIME_absolute_get_remaining (expiration); |
539 | 544 | ||
540 | if ((rd_count == 1) && | 545 | if ((rd_count == 1) && |
541 | (remaining_time.rel_value != 0)) | 546 | (remaining_time.rel_value != 0)) |
542 | { | 547 | { |
543 | remaining_time = GNUNET_TIME_absolute_get_remaining (rd->expiration); | 548 | GNUNET_break (0 == (rd->flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
549 | et.abs_value = rd->expiration_time; | ||
550 | remaining_time = GNUNET_TIME_absolute_get_remaining (et); | ||
544 | if ((rd->record_type == GNUNET_GNS_RECORD_PKEY) && | 551 | if ((rd->record_type == GNUNET_GNS_RECORD_PKEY) && |
545 | (remaining_time.rel_value != 0)) | 552 | (remaining_time.rel_value != 0)) |
546 | { | 553 | { |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index 0e44755ed..5956e5223 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -40,13 +40,19 @@ | |||
40 | */ | 40 | */ |
41 | struct InterceptLookupHandle | 41 | struct InterceptLookupHandle |
42 | { | 42 | { |
43 | /* the request handle to reply to */ | 43 | /** |
44 | * the request handle to reply to | ||
45 | */ | ||
44 | struct GNUNET_DNS_RequestHandle *request_handle; | 46 | struct GNUNET_DNS_RequestHandle *request_handle; |
45 | 47 | ||
46 | /* the dns parser packet received */ | 48 | /** |
49 | * the dns parser packet received | ||
50 | */ | ||
47 | struct GNUNET_DNSPARSER_Packet *packet; | 51 | struct GNUNET_DNSPARSER_Packet *packet; |
48 | 52 | ||
49 | /* the query parsed from the packet */ | 53 | /** |
54 | * the query parsed from the packet | ||
55 | */ | ||
50 | struct GNUNET_DNSPARSER_Query *query; | 56 | struct GNUNET_DNSPARSER_Query *query; |
51 | }; | 57 | }; |
52 | 58 | ||
@@ -71,6 +77,7 @@ static struct GNUNET_CRYPTO_RsaPrivateKey *our_key; | |||
71 | */ | 77 | */ |
72 | static struct GNUNET_TIME_Relative default_lookup_timeout; | 78 | static struct GNUNET_TIME_Relative default_lookup_timeout; |
73 | 79 | ||
80 | |||
74 | /** | 81 | /** |
75 | * Reply to dns request with the result from our lookup. | 82 | * Reply to dns request with the result from our lookup. |
76 | * | 83 | * |
@@ -82,7 +89,7 @@ static void | |||
82 | reply_to_dns(void* cls, uint32_t rd_count, | 89 | reply_to_dns(void* cls, uint32_t rd_count, |
83 | const struct GNUNET_NAMESTORE_RecordData *rd) | 90 | const struct GNUNET_NAMESTORE_RecordData *rd) |
84 | { | 91 | { |
85 | int i; | 92 | uint32_t i; |
86 | size_t len; | 93 | size_t len; |
87 | int ret; | 94 | int ret; |
88 | char *buf; | 95 | char *buf; |
@@ -137,7 +144,8 @@ reply_to_dns(void* cls, uint32_t rd_count, | |||
137 | answer_records[i].data.raw.data_len = rd[i].data_size; | 144 | answer_records[i].data.raw.data_len = rd[i].data_size; |
138 | answer_records[i].data.raw.data = (char*)rd[i].data; | 145 | answer_records[i].data.raw.data = (char*)rd[i].data; |
139 | } | 146 | } |
140 | answer_records[i].expiration_time = rd[i].expiration; | 147 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
148 | answer_records[i].expiration_time.abs_value = rd[i].expiration_time; | ||
141 | answer_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn | 149 | answer_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn |
142 | } | 150 | } |
143 | else | 151 | else |
@@ -163,7 +171,8 @@ reply_to_dns(void* cls, uint32_t rd_count, | |||
163 | additional_records[i].data.raw.data_len = rd[i].data_size; | 171 | additional_records[i].data.raw.data_len = rd[i].data_size; |
164 | additional_records[i].data.raw.data = (char*)rd[i].data; | 172 | additional_records[i].data.raw.data = (char*)rd[i].data; |
165 | } | 173 | } |
166 | additional_records[i].expiration_time = rd[i].expiration; | 174 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
175 | additional_records[i].expiration_time.abs_value = rd[i].expiration_time; | ||
167 | additional_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn | 176 | additional_records[i].class = GNUNET_DNSPARSER_CLASS_INTERNET;//hmmn |
168 | } | 177 | } |
169 | } | 178 | } |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index b6bc5eb1d..8d82fa8ad 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -200,11 +200,11 @@ process_pseu_lookup_ns (void* cls, | |||
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | 202 | ||
203 | /** name is free */ | 203 | /* name is free */ |
204 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 204 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
205 | "GNS_AUTO_PSEU: Name %s not taken in NS! Adding\n", gph->test_name); | 205 | "GNS_AUTO_PSEU: Name %s not taken in NS! Adding\n", gph->test_name); |
206 | 206 | ||
207 | new_pkey.expiration = GNUNET_TIME_UNIT_FOREVER_ABS; | 207 | new_pkey.expiration_time = UINT64_MAX; |
208 | new_pkey.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode); | 208 | new_pkey.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode); |
209 | new_pkey.data = &gph->ahead->zone; | 209 | new_pkey.data = &gph->ahead->zone; |
210 | new_pkey.record_type = GNUNET_GNS_RECORD_PKEY; | 210 | new_pkey.record_type = GNUNET_GNS_RECORD_PKEY; |
@@ -1136,6 +1136,8 @@ process_record_result_ns(void* cls, | |||
1136 | struct RecordLookupHandle *rlh; | 1136 | struct RecordLookupHandle *rlh; |
1137 | struct GNUNET_TIME_Relative remaining_time; | 1137 | struct GNUNET_TIME_Relative remaining_time; |
1138 | struct GNUNET_CRYPTO_ShortHashCode zone; | 1138 | struct GNUNET_CRYPTO_ShortHashCode zone; |
1139 | struct GNUNET_TIME_Absolute et; | ||
1140 | unsigned int i; | ||
1139 | 1141 | ||
1140 | rh = (struct ResolverHandle *) cls; | 1142 | rh = (struct ResolverHandle *) cls; |
1141 | rlh = (struct RecordLookupHandle *)rh->proc_cls; | 1143 | rlh = (struct RecordLookupHandle *)rh->proc_cls; |
@@ -1179,14 +1181,11 @@ process_record_result_ns(void* cls, | |||
1179 | } | 1181 | } |
1180 | else | 1182 | else |
1181 | { | 1183 | { |
1182 | |||
1183 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1184 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1184 | "GNS_PHASE_REC-%d: Processing additional result %s from namestore\n", | 1185 | "GNS_PHASE_REC-%d: Processing additional result %s from namestore\n", |
1185 | rh->id, name); | 1186 | rh->id, name); |
1186 | int i; | ||
1187 | for (i=0; i<rd_count;i++) | 1187 | for (i=0; i<rd_count;i++) |
1188 | { | 1188 | { |
1189 | |||
1190 | if (rd[i].record_type != rlh->record_type) | 1189 | if (rd[i].record_type != rlh->record_type) |
1191 | continue; | 1190 | continue; |
1192 | 1191 | ||
@@ -1199,7 +1198,9 @@ process_record_result_ns(void* cls, | |||
1199 | continue; | 1198 | continue; |
1200 | } | 1199 | } |
1201 | 1200 | ||
1202 | if ((GNUNET_TIME_absolute_get_remaining (rd[i].expiration)).rel_value | 1201 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
1202 | et.abs_value = rd[i].expiration_time; | ||
1203 | if ((GNUNET_TIME_absolute_get_remaining (et)).rel_value | ||
1203 | == 0) | 1204 | == 0) |
1204 | { | 1205 | { |
1205 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1206 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
@@ -1207,9 +1208,7 @@ process_record_result_ns(void* cls, | |||
1207 | rh->id); | 1208 | rh->id); |
1208 | continue; | 1209 | continue; |
1209 | } | 1210 | } |
1210 | |||
1211 | rh->answered++; | 1211 | rh->answered++; |
1212 | |||
1213 | } | 1212 | } |
1214 | 1213 | ||
1215 | /** | 1214 | /** |
@@ -1265,7 +1264,7 @@ process_record_result_vpn (void* cls, int af, const void *address) | |||
1265 | return; | 1264 | return; |
1266 | } | 1265 | } |
1267 | rd.record_type = GNUNET_GNS_RECORD_TYPE_A; | 1266 | rd.record_type = GNUNET_GNS_RECORD_TYPE_A; |
1268 | rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS; | 1267 | rd.expiration_time = UINT64_MAX; /* FIXME: should probably pick something shorter... */ |
1269 | rd.data = address; | 1268 | rd.data = address; |
1270 | rd.data_size = sizeof (struct in_addr); | 1269 | rd.data_size = sizeof (struct in_addr); |
1271 | rd.flags = 0; | 1270 | rd.flags = 0; |
@@ -1286,7 +1285,7 @@ process_record_result_vpn (void* cls, int af, const void *address) | |||
1286 | return; | 1285 | return; |
1287 | } | 1286 | } |
1288 | rd.record_type = GNUNET_GNS_RECORD_AAAA; | 1287 | rd.record_type = GNUNET_GNS_RECORD_AAAA; |
1289 | rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS; | 1288 | rd.expiration_time = UINT64_MAX; /* FIXME: should probably pick something shorter... */ |
1290 | rd.data = address; | 1289 | rd.data = address; |
1291 | rd.data_size = sizeof (struct in6_addr); | 1290 | rd.data_size = sizeof (struct in6_addr); |
1292 | rd.flags = 0; | 1291 | rd.flags = 0; |
@@ -1360,6 +1359,7 @@ handle_record_vpn (void* cls, struct ResolverHandle *rh, | |||
1360 | static void | 1359 | static void |
1361 | send_dns_packet (struct ResolverHandle *rh); | 1360 | send_dns_packet (struct ResolverHandle *rh); |
1362 | 1361 | ||
1362 | |||
1363 | static void | 1363 | static void |
1364 | handle_dns_resolver (void *cls, | 1364 | handle_dns_resolver (void *cls, |
1365 | const struct sockaddr *addr, | 1365 | const struct sockaddr *addr, |
@@ -1395,7 +1395,7 @@ handle_dns_resolver (void *cls, | |||
1395 | rd.data = &sai6->sin6_addr; | 1395 | rd.data = &sai6->sin6_addr; |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS; | 1398 | rd.expiration_time = UINT64_MAX; /* FIXME: should probably pick something shorter */ |
1399 | 1399 | ||
1400 | finish_lookup (rh, rlh, 1, &rd); | 1400 | finish_lookup (rh, rlh, 1, &rd); |
1401 | free_resolver_handle (rh); | 1401 | free_resolver_handle (rh); |
@@ -1530,7 +1530,7 @@ read_dns_response (void *cls, | |||
1530 | rd.data_size = packet->answers[i].data.raw.data_len; | 1530 | rd.data_size = packet->answers[i].data.raw.data_len; |
1531 | rd.record_type = packet->answers[i].type; | 1531 | rd.record_type = packet->answers[i].type; |
1532 | rd.flags = 0; | 1532 | rd.flags = 0; |
1533 | rd.expiration = packet->answers[i].expiration_time; | 1533 | rd.expiration_time = packet->answers[i].expiration_time.abs_value; |
1534 | finish_lookup (rh, rlh, 1, &rd); | 1534 | finish_lookup (rh, rlh, 1, &rd); |
1535 | GNUNET_NETWORK_socket_close (rh->dns_sock); | 1535 | GNUNET_NETWORK_socket_close (rh->dns_sock); |
1536 | GNUNET_DNSPARSER_free_packet (packet); | 1536 | GNUNET_DNSPARSER_free_packet (packet); |
@@ -2956,6 +2956,8 @@ process_delegation_result_ns (void* cls, | |||
2956 | struct GNUNET_TIME_Relative remaining_time; | 2956 | struct GNUNET_TIME_Relative remaining_time; |
2957 | struct GNUNET_CRYPTO_ShortHashCode zone; | 2957 | struct GNUNET_CRYPTO_ShortHashCode zone; |
2958 | char new_name[MAX_DNS_NAME_LENGTH]; | 2958 | char new_name[MAX_DNS_NAME_LENGTH]; |
2959 | unsigned int i; | ||
2960 | struct GNUNET_TIME_Absolute et; | ||
2959 | 2961 | ||
2960 | rh = (struct ResolverHandle *)cls; | 2962 | rh = (struct ResolverHandle *)cls; |
2961 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 2963 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
@@ -3032,7 +3034,6 @@ process_delegation_result_ns (void* cls, | |||
3032 | * move on with query | 3034 | * move on with query |
3033 | * Note only 1 pkey should have been returned.. anything else would be strange | 3035 | * Note only 1 pkey should have been returned.. anything else would be strange |
3034 | */ | 3036 | */ |
3035 | int i; | ||
3036 | for (i=0; i<rd_count;i++) | 3037 | for (i=0; i<rd_count;i++) |
3037 | { | 3038 | { |
3038 | 3039 | ||
@@ -3096,7 +3097,9 @@ process_delegation_result_ns (void* cls, | |||
3096 | continue; | 3097 | continue; |
3097 | } | 3098 | } |
3098 | 3099 | ||
3099 | if ((GNUNET_TIME_absolute_get_remaining (rd[i].expiration)).rel_value | 3100 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); |
3101 | et.abs_value = rd[i].expiration_time; | ||
3102 | if ((GNUNET_TIME_absolute_get_remaining (et)).rel_value | ||
3100 | == 0) | 3103 | == 0) |
3101 | { | 3104 | { |
3102 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 3105 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index ba1fd56e1..f033811ee 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c | |||
@@ -135,7 +135,8 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
135 | { | 135 | { |
136 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; | 136 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; |
137 | unsigned int i; | 137 | unsigned int i; |
138 | struct GNUNET_TIME_Absolute exp = GNUNET_TIME_UNIT_FOREVER_ABS; | 138 | uint64_t exp = UINT64_MAX; |
139 | struct GNUNET_TIME_Absolute et; | ||
139 | 140 | ||
140 | if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (rd_len, | 141 | if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (rd_len, |
141 | rd_data, | 142 | rd_data, |
@@ -154,26 +155,25 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
154 | record_xquery = ntohl(*((uint32_t*)xquery)); | 155 | record_xquery = ntohl(*((uint32_t*)xquery)); |
155 | 156 | ||
156 | for (i=0; i<rd_count; i++) | 157 | for (i=0; i<rd_count; i++) |
157 | { | 158 | { |
158 | 159 | GNUNET_break (0 == (rd[i].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)); | |
159 | exp = GNUNET_TIME_absolute_min (exp, rd[i].expiration); | 160 | exp = GNUNET_MIN (exp, rd[i].expiration_time); |
160 | |||
161 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 161 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
162 | "Got record of size %d\n", rd[i].data_size); | 162 | "Got record of size %d\n", rd[i].data_size); |
163 | |||
164 | if ((record_xquery != 0) | 163 | if ((record_xquery != 0) |
165 | && (rd[i].record_type == record_xquery)) | 164 | && (rd[i].record_type == record_xquery)) |
166 | { | 165 | { |
167 | record_match++; | 166 | record_match++; |
168 | } | 167 | } |
169 | } | 168 | } |
169 | et.abs_value = exp; | ||
170 | 170 | ||
171 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 171 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
172 | "Verifying signature of %d records for name %s\n", | 172 | "Verifying signature of %d records for name %s\n", |
173 | rd_count, name); | 173 | rd_count, name); |
174 | 174 | ||
175 | if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (&nrb->public_key, | 175 | if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature (&nrb->public_key, |
176 | exp, | 176 | et, |
177 | name, | 177 | name, |
178 | rd_count, | 178 | rd_count, |
179 | rd, | 179 | rd, |