diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-12 08:51:22 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-12 08:51:22 +0000 |
commit | 89963b943638799819321934761a31aaa442f384 (patch) | |
tree | c870e1b1fa5fa98839f9ce981ff59fa00e1f72b8 /src/transport/gnunet-service-transport_validation.c | |
parent | 296f990f1d5309436a6033f1120e0b5b2d698bf3 (diff) | |
download | gnunet-89963b943638799819321934761a31aaa442f384.tar.gz gnunet-89963b943638799819321934761a31aaa442f384.zip |
fixed address validation for plugins with client server architecture
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index bd4476082..98a73b3da 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -903,10 +903,13 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
903 | const struct TransportPingMessage *ping; | 903 | const struct TransportPingMessage *ping; |
904 | struct TransportPongMessage *pong; | 904 | struct TransportPongMessage *pong; |
905 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 905 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
906 | struct GNUNET_TRANSPORT_PluginFunctions *server_papi; | ||
906 | struct GNUNET_CRYPTO_EccSignature *sig_cache; | 907 | struct GNUNET_CRYPTO_EccSignature *sig_cache; |
907 | struct GNUNET_TIME_Absolute *sig_cache_exp; | 908 | struct GNUNET_TIME_Absolute *sig_cache_exp; |
908 | const char *addr; | 909 | const char *addr; |
909 | const char *addrend; | 910 | const char *addrend; |
911 | char *plugin_name; | ||
912 | char *pos; | ||
910 | size_t alen; | 913 | size_t alen; |
911 | size_t slen; | 914 | size_t slen; |
912 | ssize_t ret; | 915 | ssize_t ret; |
@@ -960,13 +963,26 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
960 | { | 963 | { |
961 | GNUNET_break (0); | 964 | GNUNET_break (0); |
962 | } | 965 | } |
963 | if (NULL == (papi = GST_plugins_find (address.transport_name))) | 966 | |
967 | if (0 != strstr (address.transport_name, "_client")) | ||
968 | { | ||
969 | plugin_name = GNUNET_strdup (address.transport_name); | ||
970 | pos = strstr (plugin_name, "_client"); | ||
971 | GNUNET_assert (NULL != pos); | ||
972 | GNUNET_snprintf (pos, strlen ("_server") + 1, "%s", "_server"); | ||
973 | } | ||
974 | else | ||
975 | plugin_name = GNUNET_strdup (address.transport_name); | ||
976 | |||
977 | if (NULL == (papi = GST_plugins_find (plugin_name))) | ||
964 | { | 978 | { |
965 | /* we don't have the plugin for this address */ | 979 | /* we don't have the plugin for this address */ |
966 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Plugin `%s' not available, cannot confirm having this address \n", | 980 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Plugin `%s' not available, cannot confirm having this address \n", |
967 | address.transport_name) ; | 981 | plugin_name); |
982 | GNUNET_free (plugin_name); | ||
968 | return; | 983 | return; |
969 | } | 984 | } |
985 | GNUNET_free (plugin_name); | ||
970 | if (GNUNET_OK != papi->check_address (papi->cls, addrend, alen)) | 986 | if (GNUNET_OK != papi->check_address (papi->cls, addrend, alen)) |
971 | { | 987 | { |
972 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Address `%s' is not one of my addresses, not confirming PING\n", | 988 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Address `%s' is not one of my addresses, not confirming PING\n", |