aboutsummaryrefslogtreecommitdiff
path: root/src/psycstore
diff options
context:
space:
mode:
authorChristophe Genevey Metat <genevey.christophe@gmail.com>2016-07-28 13:18:20 +0000
committerChristophe Genevey Metat <genevey.christophe@gmail.com>2016-07-28 13:18:20 +0000
commit39e290e789e2eccaaf5db1201b0acc9038fa8960 (patch)
tree6e9cef343d5e396d871dd11970185bbfc74b10e0 /src/psycstore
parentbc5798bad9474460df4943701933c9444f6a2305 (diff)
downloadgnunet-39e290e789e2eccaaf5db1201b0acc9038fa8960.tar.gz
gnunet-39e290e789e2eccaaf5db1201b0acc9038fa8960.zip
fix fragment_store function
Diffstat (limited to 'src/psycstore')
-rw-r--r--src/psycstore/plugin_psycstore_mysql.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/psycstore/plugin_psycstore_mysql.c b/src/psycstore/plugin_psycstore_mysql.c
index 51708c4a6..4c28b00b0 100644
--- a/src/psycstore/plugin_psycstore_mysql.c
+++ b/src/psycstore/plugin_psycstore_mysql.c
@@ -956,6 +956,9 @@ fragment_store (void *cls,
956 uint64_t message_id = GNUNET_ntohll (msg->message_id); 956 uint64_t message_id = GNUNET_ntohll (msg->message_id);
957 uint64_t group_generation = GNUNET_ntohll (msg->group_generation); 957 uint64_t group_generation = GNUNET_ntohll (msg->group_generation);
958 958
959 uint64_t hop_counter = ntohl(msg->hop_counter);
960 uint64_t flags = ntohl(msg->flags);
961
959 if (fragment_id > INT64_MAX || fragment_offset > INT64_MAX || 962 if (fragment_id > INT64_MAX || fragment_offset > INT64_MAX ||
960 message_id > INT64_MAX || group_generation > INT64_MAX) 963 message_id > INT64_MAX || group_generation > INT64_MAX)
961 { 964 {
@@ -972,16 +975,19 @@ fragment_store (void *cls,
972 975
973 struct GNUNET_MY_QueryParam params_insert[] = { 976 struct GNUNET_MY_QueryParam params_insert[] = {
974 GNUNET_MY_query_param_auto_from_type (channel_key), 977 GNUNET_MY_query_param_auto_from_type (channel_key),
975 GNUNET_MY_query_param_uint32 ((const uint32_t *) &msg->hop_counter), 978 GNUNET_MY_query_param_uint64 (&hop_counter),
976 GNUNET_MY_query_param_auto_from_type (&msg->signature), 979 GNUNET_MY_query_param_auto_from_type (&msg->signature),
977 GNUNET_MY_query_param_auto_from_type (&msg->purpose), 980 GNUNET_MY_query_param_auto_from_type (&msg->purpose),
981 //GNUNET_MY_query_param_fixed_size (&msg->signature, sizeof (msg->signature)),
982 //GNUNET_MY_query_param_fixed_size (&msg->purpose, sizeof (msg->purpose)),
978 GNUNET_MY_query_param_uint64 (&fragment_id), 983 GNUNET_MY_query_param_uint64 (&fragment_id),
979 GNUNET_MY_query_param_uint64 (&fragment_offset), 984 GNUNET_MY_query_param_uint64 (&fragment_offset),
980 GNUNET_MY_query_param_uint64 (&message_id), 985 GNUNET_MY_query_param_uint64 (&message_id),
981 GNUNET_MY_query_param_uint64 (&group_generation), 986 GNUNET_MY_query_param_uint64 (&group_generation),
982 GNUNET_MY_query_param_uint32 ( (const uint32_t *) &msg->flags), 987 GNUNET_MY_query_param_uint64 (&flags),
983 GNUNET_MY_query_param_uint32 (&psycstore_flags), 988 GNUNET_MY_query_param_uint32 (&psycstore_flags),
984 GNUNET_MY_query_param_auto_from_type (&msg[1]), 989 GNUNET_MY_query_param_fixed_size (&msg[1], ntohs (msg->header.size)
990 - sizeof (*msg)),
985 GNUNET_MY_query_param_end 991 GNUNET_MY_query_param_end
986 }; 992 };
987 993
@@ -1112,9 +1118,9 @@ fragment_row (struct GNUNET_MYSQL_StatementHandle *stmt,
1112 purpose, 1118 purpose,
1113 purpose_size); 1119 purpose_size);
1114 mp->fragment_id = GNUNET_htonll (fragment_id); 1120 mp->fragment_id = GNUNET_htonll (fragment_id);
1115 mp->fragment_offset = GNUNET_htonllk (fragment_offset); 1121 mp->fragment_offset = GNUNET_htonll (fragment_offset);
1116 mp->message_id = GNUNET_htonllk (message_id); 1122 mp->message_id = GNUNET_htonll (message_id);
1117 mp->group_generation = GNUNET_htonllk (group_generation); 1123 mp->group_generation = GNUNET_htonll (group_generation);
1118 mp->flags = msg_flags; 1124 mp->flags = msg_flags;
1119 1125
1120 GNUNET_memcpy (&mp[1], 1126 GNUNET_memcpy (&mp[1],