diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-15 14:50:56 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-15 14:50:56 +0000 |
commit | 6f3db5a9f86d272c27ba8c5b3da3849c536b66e6 (patch) | |
tree | 5c31256b34d84af1ee4ca57155c00e9d437202a5 /src | |
parent | c592e22bd5c98416b81c66ccd0abb79ccb82540a (diff) | |
download | gnunet-6f3db5a9f86d272c27ba8c5b3da3849c536b66e6.tar.gz gnunet-6f3db5a9f86d272c27ba8c5b3da3849c536b66e6.zip |
implementing mantis 0002193
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 107 | ||||
-rw-r--r-- | src/namestore/namestore.h | 8 | ||||
-rw-r--r-- | src/namestore/namestore_common.c | 19 | ||||
-rw-r--r-- | src/namestore/test_namestore_api.conf | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_create.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_create_update.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup_specific_type.c | 5 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_put.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove_not_existing_record.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_sign_verify.c | 2 |
12 files changed, 122 insertions, 45 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index d13221600..a14ad923d 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -211,7 +211,6 @@ struct KeyLoadContext | |||
211 | }; | 211 | }; |
212 | 212 | ||
213 | 213 | ||
214 | |||
215 | /** | 214 | /** |
216 | * Writes the encrypted private key of a zone in a file | 215 | * Writes the encrypted private key of a zone in a file |
217 | * | 216 | * |
@@ -794,6 +793,7 @@ handle_lookup_name (void *cls, | |||
794 | const char *name; | 793 | const char *name; |
795 | uint32_t rid; | 794 | uint32_t rid; |
796 | uint32_t type; | 795 | uint32_t type; |
796 | char *conv_name; | ||
797 | 797 | ||
798 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 798 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
799 | "Received `%s' message\n", | 799 | "Received `%s' message\n", |
@@ -838,15 +838,23 @@ handle_lookup_name (void *cls, | |||
838 | type, name, | 838 | type, name, |
839 | GNUNET_short_h2s(&ln_msg->zone)); | 839 | GNUNET_short_h2s(&ln_msg->zone)); |
840 | 840 | ||
841 | conv_name = GNUNET_NAMESTORE_normalize_string (name); | ||
842 | if (NULL == conv_name) | ||
843 | { | ||
844 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
845 | "Error converting name `%s'\n", name); | ||
846 | return; | ||
847 | } | ||
848 | |||
841 | /* do the actual lookup */ | 849 | /* do the actual lookup */ |
842 | lnc.request_id = rid; | 850 | lnc.request_id = rid; |
843 | lnc.nc = nc; | 851 | lnc.nc = nc; |
844 | lnc.record_type = type; | 852 | lnc.record_type = type; |
845 | lnc.name = name; | 853 | lnc.name = conv_name; |
846 | lnc.zone = &ln_msg->zone; | 854 | lnc.zone = &ln_msg->zone; |
847 | if (GNUNET_SYSERR == | 855 | if (GNUNET_SYSERR == |
848 | GSN_database->iterate_records (GSN_database->cls, | 856 | GSN_database->iterate_records (GSN_database->cls, |
849 | &ln_msg->zone, name, 0 /* offset */, | 857 | &ln_msg->zone, conv_name, 0 /* offset */, |
850 | &handle_lookup_name_it, &lnc)) | 858 | &handle_lookup_name_it, &lnc)) |
851 | { | 859 | { |
852 | /* internal error (in database plugin); might be best to just hang up on | 860 | /* internal error (in database plugin); might be best to just hang up on |
@@ -854,8 +862,10 @@ handle_lookup_name (void *cls, | |||
854 | might also be false... */ | 862 | might also be false... */ |
855 | GNUNET_break (0); | 863 | GNUNET_break (0); |
856 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 864 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
865 | GNUNET_free (conv_name); | ||
857 | return; | 866 | return; |
858 | } | 867 | } |
868 | GNUNET_free (conv_name); | ||
859 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 869 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
860 | } | 870 | } |
861 | 871 | ||
@@ -883,6 +893,7 @@ handle_record_put (void *cls, | |||
883 | size_t msg_size_exp; | 893 | size_t msg_size_exp; |
884 | const char *name; | 894 | const char *name; |
885 | const char *rd_ser; | 895 | const char *rd_ser; |
896 | char * conv_name; | ||
886 | uint32_t rid; | 897 | uint32_t rid; |
887 | uint32_t rd_ser_len; | 898 | uint32_t rd_ser_len; |
888 | uint32_t rd_count; | 899 | uint32_t rd_count; |
@@ -932,37 +943,45 @@ handle_record_put (void *cls, | |||
932 | expire = GNUNET_TIME_absolute_ntoh (rp_msg->expire); | 943 | expire = GNUNET_TIME_absolute_ntoh (rp_msg->expire); |
933 | signature = &rp_msg->signature; | 944 | signature = &rp_msg->signature; |
934 | rd_ser = &name[name_len]; | 945 | rd_ser = &name[name_len]; |
946 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; | ||
947 | |||
948 | if (GNUNET_OK != | ||
949 | GNUNET_NAMESTORE_records_deserialize (rd_ser_len, rd_ser, rd_count, rd)) | ||
935 | { | 950 | { |
936 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; | 951 | GNUNET_break (0); |
952 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
953 | return; | ||
954 | } | ||
955 | GNUNET_CRYPTO_short_hash (&rp_msg->public_key, | ||
956 | sizeof (rp_msg->public_key), | ||
957 | &zone_hash); | ||
937 | 958 | ||
938 | if (GNUNET_OK != | 959 | conv_name = GNUNET_NAMESTORE_normalize_string (name); |
939 | GNUNET_NAMESTORE_records_deserialize (rd_ser_len, rd_ser, rd_count, rd)) | 960 | if (NULL == conv_name) |
940 | { | 961 | { |
941 | GNUNET_break (0); | 962 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
942 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 963 | "Error converting name `%s'\n", name); |
943 | return; | 964 | return; |
944 | } | ||
945 | GNUNET_CRYPTO_short_hash (&rp_msg->public_key, | ||
946 | sizeof (rp_msg->public_key), | ||
947 | &zone_hash); | ||
948 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
949 | "Putting %u records under name `%s' in zone `%s'\n", | ||
950 | rd_count, name, | ||
951 | GNUNET_short_h2s (&zone_hash)); | ||
952 | res = GSN_database->put_records(GSN_database->cls, | ||
953 | &rp_msg->public_key, | ||
954 | expire, | ||
955 | name, | ||
956 | rd_count, rd, | ||
957 | signature); | ||
958 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
959 | "Putting record for name `%s': %s\n", | ||
960 | name, | ||
961 | (GNUNET_OK == res) ? "OK" : "FAILED"); | ||
962 | } | 965 | } |
966 | |||
967 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
968 | "Putting %u records under name `%s' in zone `%s'\n", | ||
969 | rd_count, conv_name, | ||
970 | GNUNET_short_h2s (&zone_hash)); | ||
971 | res = GSN_database->put_records(GSN_database->cls, | ||
972 | &rp_msg->public_key, | ||
973 | expire, | ||
974 | conv_name, | ||
975 | rd_count, rd, | ||
976 | signature); | ||
977 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
978 | "Putting record for name `%s': %s\n", | ||
979 | conv_name, | ||
980 | (GNUNET_OK == res) ? "OK" : "FAILED"); | ||
963 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 981 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
964 | "Sending `%s' message\n", | 982 | "Sending `%s' message\n", |
965 | "RECORD_PUT_RESPONSE"); | 983 | "RECORD_PUT_RESPONSE"); |
984 | GNUNET_free (conv_name); | ||
966 | rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE); | 985 | rpr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE); |
967 | rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage)); | 986 | rpr_msg.gns_header.header.size = htons (sizeof (struct RecordPutResponseMessage)); |
968 | rpr_msg.gns_header.r_id = htonl (rid); | 987 | rpr_msg.gns_header.r_id = htonl (rid); |
@@ -1150,6 +1169,7 @@ handle_record_create (void *cls, | |||
1150 | uint32_t rid; | 1169 | uint32_t rid; |
1151 | const char *pkey_tmp; | 1170 | const char *pkey_tmp; |
1152 | const char *name_tmp; | 1171 | const char *name_tmp; |
1172 | char *conv_name; | ||
1153 | const char *rd_ser; | 1173 | const char *rd_ser; |
1154 | unsigned int rd_count; | 1174 | unsigned int rd_count; |
1155 | int res; | 1175 | int res; |
@@ -1220,17 +1240,26 @@ handle_record_create (void *cls, | |||
1220 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 1240 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
1221 | &pubkey_hash); | 1241 | &pubkey_hash); |
1222 | learn_private_key (pkey); | 1242 | learn_private_key (pkey); |
1243 | |||
1244 | conv_name = GNUNET_NAMESTORE_normalize_string(name_tmp); | ||
1245 | if (NULL == conv_name) | ||
1246 | { | ||
1247 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1248 | "Error converting name `%s'\n", name_tmp); | ||
1249 | return; | ||
1250 | } | ||
1223 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1251 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1224 | "Creating record for name `%s' in zone `%s'\n", | 1252 | "Creating record for name `%s' in zone `%s'\n", |
1225 | name_tmp, GNUNET_short_h2s(&pubkey_hash)); | 1253 | conv_name, GNUNET_short_h2s(&pubkey_hash)); |
1226 | crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire); | 1254 | crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire); |
1227 | crc.res = GNUNET_SYSERR; | 1255 | crc.res = GNUNET_SYSERR; |
1228 | crc.rd = &rd; | 1256 | crc.rd = &rd; |
1229 | crc.name = name_tmp; | 1257 | crc.name = conv_name; |
1230 | 1258 | ||
1231 | /* Get existing records for name */ | 1259 | /* Get existing records for name */ |
1232 | res = GSN_database->iterate_records (GSN_database->cls, &pubkey_hash, name_tmp, 0, | 1260 | res = GSN_database->iterate_records (GSN_database->cls, &pubkey_hash, conv_name, 0, |
1233 | &handle_create_record_it, &crc); | 1261 | &handle_create_record_it, &crc); |
1262 | GNUNET_free (conv_name); | ||
1234 | if (res != GNUNET_SYSERR) | 1263 | if (res != GNUNET_SYSERR) |
1235 | res = GNUNET_OK; | 1264 | res = GNUNET_OK; |
1236 | 1265 | ||
@@ -1399,6 +1428,7 @@ handle_record_remove (void *cls, | |||
1399 | const char *pkey_tmp; | 1428 | const char *pkey_tmp; |
1400 | const char *name_tmp; | 1429 | const char *name_tmp; |
1401 | const char *rd_ser; | 1430 | const char *rd_ser; |
1431 | char * conv_name; | ||
1402 | size_t key_len; | 1432 | size_t key_len; |
1403 | size_t name_len; | 1433 | size_t name_len; |
1404 | size_t rd_ser_len; | 1434 | size_t rd_ser_len; |
@@ -1473,15 +1503,23 @@ handle_record_remove (void *cls, | |||
1473 | return; | 1503 | return; |
1474 | } | 1504 | } |
1475 | 1505 | ||
1506 | conv_name = GNUNET_NAMESTORE_normalize_string(name_tmp); | ||
1507 | if (NULL == conv_name) | ||
1508 | { | ||
1509 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1510 | "Error converting name `%s'\n", name_tmp); | ||
1511 | return; | ||
1512 | } | ||
1513 | |||
1476 | if (0 == rd_count) | 1514 | if (0 == rd_count) |
1477 | { | 1515 | { |
1478 | /* remove the whole name and all records */ | 1516 | /* remove the whole name and all records */ |
1479 | res = GSN_database->remove_records (GSN_database->cls, | 1517 | res = GSN_database->remove_records (GSN_database->cls, |
1480 | &pubkey_hash, | 1518 | &pubkey_hash, |
1481 | name_tmp); | 1519 | conv_name); |
1482 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1520 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1483 | "Removing name `%s': %s\n", | 1521 | "Removing name `%s': %s\n", |
1484 | name_tmp, (GNUNET_OK == res) ? "OK" : "FAILED"); | 1522 | conv_name, (GNUNET_OK == res) ? "OK" : "FAILED"); |
1485 | if (GNUNET_OK != res) | 1523 | if (GNUNET_OK != res) |
1486 | /* Could not remove entry from database */ | 1524 | /* Could not remove entry from database */ |
1487 | res = RECORD_REMOVE_RESULT_FAILED_TO_PUT_UPDATE; | 1525 | res = RECORD_REMOVE_RESULT_FAILED_TO_PUT_UPDATE; |
@@ -1492,7 +1530,7 @@ handle_record_remove (void *cls, | |||
1492 | { | 1530 | { |
1493 | /* remove a single record */ | 1531 | /* remove a single record */ |
1494 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1532 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1495 | "Removing record for name `%s' in zone `%s'\n", name_tmp, | 1533 | "Removing record for name `%s' in zone `%s'\n", conv_name, |
1496 | GNUNET_short_h2s (&pubkey_hash)); | 1534 | GNUNET_short_h2s (&pubkey_hash)); |
1497 | rrc.rd = &rd; | 1535 | rrc.rd = &rd; |
1498 | rrc.op_res = RECORD_REMOVE_RESULT_RECORD_NOT_FOUND; | 1536 | rrc.op_res = RECORD_REMOVE_RESULT_RECORD_NOT_FOUND; |
@@ -1503,7 +1541,7 @@ handle_record_remove (void *cls, | |||
1503 | { | 1541 | { |
1504 | res = GSN_database->iterate_records (GSN_database->cls, | 1542 | res = GSN_database->iterate_records (GSN_database->cls, |
1505 | &pubkey_hash, | 1543 | &pubkey_hash, |
1506 | name_tmp, | 1544 | conv_name, |
1507 | off++, | 1545 | off++, |
1508 | &handle_record_remove_it, &rrc); | 1546 | &handle_record_remove_it, &rrc); |
1509 | } | 1547 | } |
@@ -1527,6 +1565,7 @@ handle_record_remove (void *cls, | |||
1527 | break; | 1565 | break; |
1528 | } | 1566 | } |
1529 | } | 1567 | } |
1568 | GNUNET_free (conv_name); | ||
1530 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1569 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1531 | "Sending `%s' message\n", | 1570 | "Sending `%s' message\n", |
1532 | "RECORD_REMOVE_RESPONSE"); | 1571 | "RECORD_REMOVE_RESPONSE"); |
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index 49015f158..42cc2b2d1 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h | |||
@@ -32,6 +32,14 @@ | |||
32 | #define MAX_NAME_LEN 256 | 32 | #define MAX_NAME_LEN 256 |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Convert a string from to local codeset to UTF-8 lowercase | ||
36 | * @param src source string | ||
37 | * @return converted result | ||
38 | */ | ||
39 | char * | ||
40 | GNUNET_NAMESTORE_normalize_string (const char *src); | ||
41 | |||
42 | /** | ||
35 | * Convert a short hash to a string (for printing debug messages). | 43 | * Convert a short hash to a string (for printing debug messages). |
36 | * This is one of the very few calls in the entire API that is | 44 | * This is one of the very few calls in the entire API that is |
37 | * NOT reentrant! | 45 | * NOT reentrant! |
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c index 47029b73b..403374809 100644 --- a/src/namestore/namestore_common.c +++ b/src/namestore/namestore_common.c | |||
@@ -71,6 +71,25 @@ struct NetworkRecord | |||
71 | 71 | ||
72 | GNUNET_NETWORK_STRUCT_END | 72 | GNUNET_NETWORK_STRUCT_END |
73 | 73 | ||
74 | /** | ||
75 | * Convert a string from to local codeset to UTF-8 lowercase | ||
76 | * @param src source string | ||
77 | * @return converted result | ||
78 | */ | ||
79 | char * | ||
80 | GNUNET_NAMESTORE_normalize_string (const char *src) | ||
81 | { | ||
82 | char *utf_8_str; | ||
83 | |||
84 | GNUNET_assert (NULL != src); | ||
85 | /* Convert to UTF8 */ | ||
86 | utf_8_str = GNUNET_STRINGS_to_utf8 (src, strlen (src), nl_langinfo (CODESET)); | ||
87 | GNUNET_assert (NULL != utf_8_str); | ||
88 | /* normalize */ | ||
89 | GNUNET_STRINGS_utf8_tolower(utf_8_str, &utf_8_str); | ||
90 | return utf_8_str; | ||
91 | } | ||
92 | |||
74 | 93 | ||
75 | /** | 94 | /** |
76 | * Convert a short hash to a string (for printing debug messages). | 95 | * Convert a short hash to a string (for printing debug messages). |
diff --git a/src/namestore/test_namestore_api.conf b/src/namestore/test_namestore_api.conf index 565805921..a685ab4dc 100644 --- a/src/namestore/test_namestore_api.conf +++ b/src/namestore/test_namestore_api.conf | |||
@@ -4,7 +4,7 @@ DEFAULTSERVICES = namestore | |||
4 | UNIXPATH = /tmp/gnunet-p1-service-arm.sock | 4 | UNIXPATH = /tmp/gnunet-p1-service-arm.sock |
5 | 5 | ||
6 | [namestore] | 6 | [namestore] |
7 | #PREFIX = valgrind --leak-check=full --track-origins=yes | 7 | #PREFIX = valgrind |
8 | AUTOSTART = YES | 8 | AUTOSTART = YES |
9 | UNIXPATH = /tmp/gnunet-service-namestore.sock | 9 | UNIXPATH = /tmp/gnunet-service-namestore.sock |
10 | UNIX_MATCH_UID = YES | 10 | UNIX_MATCH_UID = YES |
@@ -12,7 +12,7 @@ UNIX_MATCH_GID = YES | |||
12 | PORT = 2099 | 12 | PORT = 2099 |
13 | HOSTNAME = localhost | 13 | HOSTNAME = localhost |
14 | HOME = $SERVICEHOME | 14 | HOME = $SERVICEHOME |
15 | BINARY = gnunet-service-namestore | 15 | BINARY = gnunet-service-namestore2 |
16 | ACCEPT_FROM = 127.0.0.1; | 16 | ACCEPT_FROM = 127.0.0.1; |
17 | ACCEPT_FROM6 = ::1; | 17 | ACCEPT_FROM6 = ::1; |
18 | DATABASE = sqlite | 18 | DATABASE = sqlite |
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c index 583f78a01..63e403c06 100644 --- a/src/namestore/test_namestore_api_create.c +++ b/src/namestore/test_namestore_api_create.c | |||
@@ -84,6 +84,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
84 | if (privkey != NULL) | 84 | if (privkey != NULL) |
85 | GNUNET_CRYPTO_rsa_key_free (privkey); | 85 | GNUNET_CRYPTO_rsa_key_free (privkey); |
86 | privkey = NULL; | 86 | privkey = NULL; |
87 | GNUNET_free_non_null (s_name); | ||
87 | res = 1; | 88 | res = 1; |
88 | } | 89 | } |
89 | 90 | ||
@@ -99,6 +100,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
99 | GNUNET_free ((void *) s_first_record->data); | 100 | GNUNET_free ((void *) s_first_record->data); |
100 | GNUNET_free (s_first_record); | 101 | GNUNET_free (s_first_record); |
101 | GNUNET_free_non_null (s_second_record); | 102 | GNUNET_free_non_null (s_second_record); |
103 | GNUNET_free_non_null (s_name); | ||
102 | if (privkey != NULL) | 104 | if (privkey != NULL) |
103 | GNUNET_CRYPTO_rsa_key_free (privkey); | 105 | GNUNET_CRYPTO_rsa_key_free (privkey); |
104 | privkey = NULL; | 106 | privkey = NULL; |
@@ -361,7 +363,7 @@ run (void *cls, | |||
361 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 363 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
362 | 364 | ||
363 | /* create record */ | 365 | /* create record */ |
364 | s_name = "dummy.dummy.gnunet"; | 366 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
365 | s_first_record = create_record (1); | 367 | s_first_record = create_record (1); |
366 | 368 | ||
367 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, s_first_record); | 369 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, s_first_record); |
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c index 1601b39d8..8998cabab 100644 --- a/src/namestore/test_namestore_api_create_update.c +++ b/src/namestore/test_namestore_api_create_update.c | |||
@@ -82,6 +82,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
82 | if (privkey != NULL) | 82 | if (privkey != NULL) |
83 | GNUNET_CRYPTO_rsa_key_free (privkey); | 83 | GNUNET_CRYPTO_rsa_key_free (privkey); |
84 | privkey = NULL; | 84 | privkey = NULL; |
85 | GNUNET_free_non_null (s_name); | ||
85 | res = 1; | 86 | res = 1; |
86 | } | 87 | } |
87 | 88 | ||
@@ -103,6 +104,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
103 | if (nsh != NULL) | 104 | if (nsh != NULL) |
104 | GNUNET_NAMESTORE_disconnect (nsh); | 105 | GNUNET_NAMESTORE_disconnect (nsh); |
105 | nsh = NULL; | 106 | nsh = NULL; |
107 | GNUNET_free_non_null (s_name); | ||
106 | } | 108 | } |
107 | 109 | ||
108 | 110 | ||
@@ -213,7 +215,7 @@ run (void *cls, | |||
213 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 215 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
214 | 216 | ||
215 | /* create record */ | 217 | /* create record */ |
216 | s_name = "dummy.dummy.gnunet"; | 218 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
217 | s_first_record = create_record (1); | 219 | s_first_record = create_record (1); |
218 | 220 | ||
219 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, s_first_record); | 221 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, s_first_record); |
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c index c60354e9e..53e4626e5 100644 --- a/src/namestore/test_namestore_api_lookup.c +++ b/src/namestore/test_namestore_api_lookup.c | |||
@@ -228,7 +228,7 @@ run (void *cls, | |||
228 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 228 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
229 | 229 | ||
230 | /* create record */ | 230 | /* create record */ |
231 | s_name = "dummy.dummy.gnunet"; | 231 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
232 | s_rd = create_record (RECORDS); | 232 | s_rd = create_record (RECORDS); |
233 | 233 | ||
234 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); | 234 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); |
diff --git a/src/namestore/test_namestore_api_lookup_specific_type.c b/src/namestore/test_namestore_api_lookup_specific_type.c index 793e55c1e..be45d938e 100644 --- a/src/namestore/test_namestore_api_lookup_specific_type.c +++ b/src/namestore/test_namestore_api_lookup_specific_type.c | |||
@@ -78,6 +78,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
78 | if (privkey != NULL) | 78 | if (privkey != NULL) |
79 | GNUNET_CRYPTO_rsa_key_free (privkey); | 79 | GNUNET_CRYPTO_rsa_key_free (privkey); |
80 | privkey = NULL; | 80 | privkey = NULL; |
81 | GNUNET_free_non_null (s_name); | ||
81 | res = 1; | 82 | res = 1; |
82 | } | 83 | } |
83 | 84 | ||
@@ -97,7 +98,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
97 | GNUNET_free_non_null((void *) s_rd[c].data); | 98 | GNUNET_free_non_null((void *) s_rd[c].data); |
98 | } | 99 | } |
99 | GNUNET_free (s_rd); | 100 | GNUNET_free (s_rd); |
100 | 101 | GNUNET_free_non_null (s_name); | |
101 | if (privkey != NULL) | 102 | if (privkey != NULL) |
102 | GNUNET_CRYPTO_rsa_key_free (privkey); | 103 | GNUNET_CRYPTO_rsa_key_free (privkey); |
103 | privkey = NULL; | 104 | privkey = NULL; |
@@ -286,7 +287,7 @@ run (void *cls, | |||
286 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 287 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
287 | 288 | ||
288 | /* create record */ | 289 | /* create record */ |
289 | s_name = "dummy.dummy.gnunet"; | 290 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
290 | s_rd = create_record (RECORDS); | 291 | s_rd = create_record (RECORDS); |
291 | 292 | ||
292 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); | 293 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); |
diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c index 3cf1b465b..d15d22f31 100644 --- a/src/namestore/test_namestore_api_put.c +++ b/src/namestore/test_namestore_api_put.c | |||
@@ -137,7 +137,7 @@ run (void *cls, | |||
137 | struct GNUNET_TESTING_Peer *peer) | 137 | struct GNUNET_TESTING_Peer *peer) |
138 | { | 138 | { |
139 | struct GNUNET_CRYPTO_RsaSignature *signature; | 139 | struct GNUNET_CRYPTO_RsaSignature *signature; |
140 | const char * s_name = "dummy.dummy.gnunet"; | 140 | char * s_name; |
141 | int c; | 141 | int c; |
142 | char *hostkey_file; | 142 | char *hostkey_file; |
143 | struct GNUNET_TIME_Absolute et; | 143 | struct GNUNET_TIME_Absolute et; |
@@ -155,6 +155,7 @@ run (void *cls, | |||
155 | nsh = GNUNET_NAMESTORE_connect (cfg); | 155 | nsh = GNUNET_NAMESTORE_connect (cfg); |
156 | GNUNET_break (NULL != nsh); | 156 | GNUNET_break (NULL != nsh); |
157 | /* create record */ | 157 | /* create record */ |
158 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); | ||
158 | s_rd = create_record (RECORDS); | 159 | s_rd = create_record (RECORDS); |
159 | et.abs_value = s_rd[0].expiration_time; | 160 | et.abs_value = s_rd[0].expiration_time; |
160 | signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); | 161 | signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_rd, RECORDS); |
@@ -167,6 +168,7 @@ run (void *cls, | |||
167 | for (c = 0; c < RECORDS; c++) | 168 | for (c = 0; c < RECORDS; c++) |
168 | GNUNET_free_non_null((void *) s_rd[c].data); | 169 | GNUNET_free_non_null((void *) s_rd[c].data); |
169 | GNUNET_free (s_rd); | 170 | GNUNET_free (s_rd); |
171 | GNUNET_free (s_name); | ||
170 | } | 172 | } |
171 | 173 | ||
172 | 174 | ||
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 87303bc49..f2bcf0e66 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -79,6 +79,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
79 | if (privkey != NULL) | 79 | if (privkey != NULL) |
80 | GNUNET_CRYPTO_rsa_key_free (privkey); | 80 | GNUNET_CRYPTO_rsa_key_free (privkey); |
81 | privkey = NULL; | 81 | privkey = NULL; |
82 | GNUNET_free_non_null (s_name); | ||
82 | res = 1; | 83 | res = 1; |
83 | } | 84 | } |
84 | 85 | ||
@@ -102,6 +103,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
102 | if (nsh != NULL) | 103 | if (nsh != NULL) |
103 | GNUNET_NAMESTORE_disconnect (nsh); | 104 | GNUNET_NAMESTORE_disconnect (nsh); |
104 | nsh = NULL; | 105 | nsh = NULL; |
106 | GNUNET_free_non_null (s_name); | ||
105 | } | 107 | } |
106 | 108 | ||
107 | 109 | ||
@@ -259,7 +261,7 @@ run (void *cls, | |||
259 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 261 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
260 | 262 | ||
261 | /* create record */ | 263 | /* create record */ |
262 | s_name = "dummy.dummy.gnunet"; | 264 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
263 | s_rd = create_record (RECORDS); | 265 | s_rd = create_record (RECORDS); |
264 | 266 | ||
265 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); | 267 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); |
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index 472ddbdfe..54a273b9b 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -79,6 +79,7 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
79 | if (privkey != NULL) | 79 | if (privkey != NULL) |
80 | GNUNET_CRYPTO_rsa_key_free (privkey); | 80 | GNUNET_CRYPTO_rsa_key_free (privkey); |
81 | privkey = NULL; | 81 | privkey = NULL; |
82 | GNUNET_free_non_null (s_name); | ||
82 | res = 1; | 83 | res = 1; |
83 | } | 84 | } |
84 | 85 | ||
@@ -103,6 +104,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
103 | if (nsh != NULL) | 104 | if (nsh != NULL) |
104 | GNUNET_NAMESTORE_disconnect (nsh); | 105 | GNUNET_NAMESTORE_disconnect (nsh); |
105 | nsh = NULL; | 106 | nsh = NULL; |
107 | GNUNET_free_non_null (s_name); | ||
106 | } | 108 | } |
107 | 109 | ||
108 | 110 | ||
@@ -195,7 +197,7 @@ run (void *cls, | |||
195 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); | 197 | GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey); |
196 | 198 | ||
197 | /* create record */ | 199 | /* create record */ |
198 | s_name = "dummy.dummy.gnunet"; | 200 | s_name = GNUNET_NAMESTORE_normalize_string ("DUMMY.dummy.gnunet"); |
199 | s_rd = create_record (RECORDS); | 201 | s_rd = create_record (RECORDS); |
200 | 202 | ||
201 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); | 203 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); |
diff --git a/src/namestore/test_namestore_api_sign_verify.c b/src/namestore/test_namestore_api_sign_verify.c index fe7425ebf..10be25bb4 100644 --- a/src/namestore/test_namestore_api_sign_verify.c +++ b/src/namestore/test_namestore_api_sign_verify.c | |||
@@ -94,7 +94,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
94 | int res_w; | 94 | int res_w; |
95 | 95 | ||
96 | /* create record */ | 96 | /* create record */ |
97 | s_name = "dummy.dummy.gnunet"; | 97 | s_name = "DUMMY.dummy.gnunet"; |
98 | s_rd = create_record (RECORDS); | 98 | s_rd = create_record (RECORDS); |
99 | 99 | ||
100 | signature = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, s_rd, RECORDS); | 100 | signature = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, s_rd, RECORDS); |