diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-09-07 11:58:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-09-07 11:58:04 +0000 |
commit | 9dac7b6b7b035d55bdb9731795712ead92e11f76 (patch) | |
tree | 8bed4ad4617f95bcdaac75dc43c2b2dd461b3e76 /src/peerinfo | |
parent | 2a534fc5efadca1b65648efb903c3b4c17ac33ad (diff) | |
download | gnunet-9dac7b6b7b035d55bdb9731795712ead92e11f76.tar.gz gnunet-9dac7b6b7b035d55bdb9731795712ead92e11f76.zip |
fixes
Diffstat (limited to 'src/peerinfo')
-rw-r--r-- | src/peerinfo/gnunet-service-peerinfo.c | 23 | ||||
-rw-r--r-- | src/peerinfo/peerinfo_api.c | 3 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index 3a6030fda..281779897 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c | |||
@@ -206,11 +206,24 @@ add_host_to_known_hosts (const struct GNUNET_PeerIdentity *identity) | |||
206 | { | 206 | { |
207 | size = GNUNET_DISK_fn_read (fn, buffer, sizeof (buffer)); | 207 | size = GNUNET_DISK_fn_read (fn, buffer, sizeof (buffer)); |
208 | hello = (const struct GNUNET_HELLO_Message *) buffer; | 208 | hello = (const struct GNUNET_HELLO_Message *) buffer; |
209 | now = GNUNET_TIME_absolute_get (); | 209 | if ( (size < sizeof (struct GNUNET_MessageHeader)) || |
210 | hello_clean = GNUNET_HELLO_iterate_addresses (hello, | 210 | (size != ntohs((((const struct GNUNET_MessageHeader*) hello)->size))) || |
211 | GNUNET_YES, | 211 | (size != GNUNET_HELLO_size (hello)) ) |
212 | &discard_expired, &now); | 212 | { |
213 | entry->hello = hello_clean; | 213 | GNUNET_break (0); |
214 | if (0 != UNLINK (fn)) | ||
215 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, | ||
216 | "unlink", | ||
217 | fn); | ||
218 | } | ||
219 | else | ||
220 | { | ||
221 | now = GNUNET_TIME_absolute_get (); | ||
222 | hello_clean = GNUNET_HELLO_iterate_addresses (hello, | ||
223 | GNUNET_YES, | ||
224 | &discard_expired, &now); | ||
225 | entry->hello = hello_clean; | ||
226 | } | ||
214 | } | 227 | } |
215 | GNUNET_free (fn); | 228 | GNUNET_free (fn); |
216 | entry->next = hosts; | 229 | entry->next = hosts; |
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c index 28865edc6..57197798b 100644 --- a/src/peerinfo/peerinfo_api.c +++ b/src/peerinfo/peerinfo_api.c | |||
@@ -262,8 +262,8 @@ GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
262 | struct GNUNET_CLIENT_Connection *client; | 262 | struct GNUNET_CLIENT_Connection *client; |
263 | struct ListAllPeersMessage *lapm; | 263 | struct ListAllPeersMessage *lapm; |
264 | struct ListPeerMessage *lpm; | 264 | struct ListPeerMessage *lpm; |
265 | size_t hs; | ||
266 | struct InfoContext *ihc; | 265 | struct InfoContext *ihc; |
266 | size_t hs; | ||
267 | 267 | ||
268 | client = GNUNET_CLIENT_connect (sched, "peerinfo", cfg); | 268 | client = GNUNET_CLIENT_connect (sched, "peerinfo", cfg); |
269 | if (client == NULL) | 269 | if (client == NULL) |
@@ -279,7 +279,6 @@ GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
279 | ihc->callback = callback; | 279 | ihc->callback = callback; |
280 | ihc->callback_cls = callback_cls; | 280 | ihc->callback_cls = callback_cls; |
281 | ihc->timeout = GNUNET_TIME_relative_to_absolute (timeout); | 281 | ihc->timeout = GNUNET_TIME_relative_to_absolute (timeout); |
282 | hs = 0; | ||
283 | if (peer == NULL) | 282 | if (peer == NULL) |
284 | { | 283 | { |
285 | lapm = (struct ListAllPeersMessage *) &ihc[1]; | 284 | lapm = (struct ListAllPeersMessage *) &ihc[1]; |