- {
- /* done! */
- alucb->cb (alucb->cb_cls, NULL);
- GNUNET_CLIENT_disconnect (alucb->client, GNUNET_NO);
- GNUNET_free (alucb);
- return;
- }
- address = (const char *) &msg[1];
- if (address[size - sizeof (struct GNUNET_MessageHeader) - 1] != '\0')
- {
- /* invalid reply */
- GNUNET_break (0);
- alucb->cb (alucb->cb_cls, NULL);
- GNUNET_CLIENT_disconnect (alucb->client, GNUNET_NO);
- GNUNET_free (alucb);
- return;
- }
+ {
+ /* done! */
+ pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL);
+ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (pal_ctx);
+ return;
+ }
+
+ if ((size <
+ sizeof (struct GNUNET_MessageHeader) +
+ sizeof (struct AddressIterateResponseMessage)) ||
+ (ntohs (msg->type) !=
+ GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE))
+ {
+ GNUNET_break (0);
+ pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL);
+ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (pal_ctx);
+ return;
+ }
+
+ air_msg = (struct AddressIterateResponseMessage *) msg;
+ tlen = ntohl (air_msg->pluginlen);
+ alen = ntohl (air_msg->addrlen);
+
+ if (size != sizeof (struct AddressIterateResponseMessage) + tlen + alen)
+ {
+ GNUNET_break (0);
+ pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL);
+ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (pal_ctx);
+ return;
+ }
+
+ addr = (const char *) &air_msg[1];
+ transport_name = &addr[alen];
+
+ if (transport_name[tlen - 1] != '\0')
+ {
+ GNUNET_break_op (0);
+ pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL);
+ GNUNET_TRANSPORT_peer_get_active_addresses_cancel (pal_ctx);
+ return;
+ }
+