diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gnsrecord/gnsrecord_misc.c | 32 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_to_name.c | 3 | ||||
-rwxr-xr-x | src/namestore/test_plugin_rest_namestore.sh | 21 |
3 files changed, 31 insertions, 25 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c index 2e00141a3..82c38f19a 100644 --- a/src/gnsrecord/gnsrecord_misc.c +++ b/src/gnsrecord/gnsrecord_misc.c | |||
@@ -107,8 +107,8 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, | |||
107 | { | 107 | { |
108 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 108 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
109 | "Expiration time %llu != %llu\n", | 109 | "Expiration time %llu != %llu\n", |
110 | a->expiration_time, | 110 | (unsigned long long) a->expiration_time, |
111 | b->expiration_time); | 111 | (unsigned long long) b->expiration_time); |
112 | return GNUNET_NO; | 112 | return GNUNET_NO; |
113 | } | 113 | } |
114 | if ((a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS) | 114 | if ((a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS) |
@@ -282,11 +282,13 @@ GNUNET_GNSRECORD_identity_from_data (const char *data, | |||
282 | return GNUNET_SYSERR; | 282 | return GNUNET_SYSERR; |
283 | if (data_size > sizeof (struct GNUNET_IDENTITY_PublicKey)) | 283 | if (data_size > sizeof (struct GNUNET_IDENTITY_PublicKey)) |
284 | return GNUNET_SYSERR; | 284 | return GNUNET_SYSERR; |
285 | return (GNUNET_IDENTITY_read_key_from_buffer(key, data, data_size) == data_size? | 285 | return (GNUNET_IDENTITY_read_key_from_buffer (key, data, data_size) == |
286 | GNUNET_OK : | 286 | data_size? |
287 | GNUNET_SYSERR); | 287 | GNUNET_OK : |
288 | GNUNET_SYSERR); | ||
288 | } | 289 | } |
289 | 290 | ||
291 | |||
290 | enum GNUNET_GenericReturnValue | 292 | enum GNUNET_GenericReturnValue |
291 | GNUNET_GNSRECORD_data_from_identity (const struct | 293 | GNUNET_GNSRECORD_data_from_identity (const struct |
292 | GNUNET_IDENTITY_PublicKey *key, | 294 | GNUNET_IDENTITY_PublicKey *key, |
@@ -294,14 +296,15 @@ GNUNET_GNSRECORD_data_from_identity (const struct | |||
294 | size_t *data_size, | 296 | size_t *data_size, |
295 | uint32_t *type) | 297 | uint32_t *type) |
296 | { | 298 | { |
297 | *type = key->type; | 299 | *type = ntohl (key->type); |
298 | *data_size = GNUNET_IDENTITY_key_get_length (key); | 300 | *data_size = GNUNET_IDENTITY_key_get_length (key); |
299 | if (0 == *data_size) | 301 | if (0 == *data_size) |
300 | return GNUNET_SYSERR; | 302 | return GNUNET_SYSERR; |
301 | *data = GNUNET_malloc (*data_size); | 303 | *data = GNUNET_malloc (*data_size); |
302 | return (GNUNET_IDENTITY_write_key_to_buffer(key, data, *data_size) == *data_size? | 304 | return (GNUNET_IDENTITY_write_key_to_buffer (key, *data, *data_size) == |
303 | GNUNET_OK : | 305 | *data_size? |
304 | GNUNET_SYSERR); | 306 | GNUNET_OK : |
307 | GNUNET_SYSERR); | ||
305 | } | 308 | } |
306 | 309 | ||
307 | 310 | ||
@@ -310,14 +313,15 @@ GNUNET_GNSRECORD_is_zonekey_type (uint32_t type) | |||
310 | { | 313 | { |
311 | switch (type) | 314 | switch (type) |
312 | { | 315 | { |
313 | case GNUNET_GNSRECORD_TYPE_PKEY: | 316 | case GNUNET_GNSRECORD_TYPE_PKEY: |
314 | case GNUNET_GNSRECORD_TYPE_EDKEY: | 317 | case GNUNET_GNSRECORD_TYPE_EDKEY: |
315 | return GNUNET_YES; | 318 | return GNUNET_YES; |
316 | default: | 319 | default: |
317 | return GNUNET_NO; | 320 | return GNUNET_NO; |
318 | } | 321 | } |
319 | } | 322 | } |
320 | 323 | ||
324 | |||
321 | size_t | 325 | size_t |
322 | GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block) | 326 | GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block) |
323 | { | 327 | { |
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index e5ede6bcd..3fd10e4a1 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c | |||
@@ -212,12 +212,13 @@ run (void *cls, | |||
212 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, | 212 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, |
213 | &s_zone_value, | 213 | &s_zone_value, |
214 | sizeof(s_zone_value)); | 214 | sizeof(s_zone_value)); |
215 | s_zone_value.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); | ||
215 | { | 216 | { |
216 | struct GNUNET_GNSRECORD_Data rd; | 217 | struct GNUNET_GNSRECORD_Data rd; |
217 | 218 | ||
218 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; | 219 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; |
219 | rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY; | 220 | rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY; |
220 | rd.data_size = sizeof(s_zone_value); | 221 | rd.data_size = GNUNET_IDENTITY_key_get_length (&s_zone_value); |
221 | rd.data = &s_zone_value; | 222 | rd.data = &s_zone_value; |
222 | rd.flags = 0; | 223 | rd.flags = 0; |
223 | 224 | ||
diff --git a/src/namestore/test_plugin_rest_namestore.sh b/src/namestore/test_plugin_rest_namestore.sh index 12a7fa50c..8a45cebf5 100755 --- a/src/namestore/test_plugin_rest_namestore.sh +++ b/src/namestore/test_plugin_rest_namestore.sh | |||
@@ -84,14 +84,15 @@ gnunet-identity -C $TEST_ID -c test_namestore_api.conf | |||
84 | test="$(gnunet-namestore -D -z $TEST_ID -c test_namestore_api.conf)" | 84 | test="$(gnunet-namestore -D -z $TEST_ID -c test_namestore_api.conf)" |
85 | name=$TEST_ID | 85 | name=$TEST_ID |
86 | public="$(gnunet-identity -d -c test_namestore_api.conf | grep $TEST_ID | awk 'NR==1{print $3}')" | 86 | public="$(gnunet-identity -d -c test_namestore_api.conf | grep $TEST_ID | awk 'NR==1{print $3}')" |
87 | gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG" -t "PKEY" -c test_namestore_api.conf | 87 | echo "$name $public" |
88 | valgrind gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY" -c test_namestore_api.conf | ||
88 | #curl_get "${namestore_link}" "HTTP/1.1 200 OK" | 89 | #curl_get "${namestore_link}" "HTTP/1.1 200 OK" |
89 | curl_get "${namestore_link}/$name" "HTTP/1.1 200 OK" | 90 | curl_get "${namestore_link}/$name" "HTTP/1.1 200 OK" |
90 | curl_get "${namestore_link}/$public" "error" | 91 | curl_get "${namestore_link}/$public" "error" |
91 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf | 92 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf |
92 | 93 | ||
93 | #Test POST with NAME | 94 | #Test POST with NAME |
94 | curl_post "${namestore_link}/$name" '{"data": [{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", "record_type":"PKEY", "expiration_time":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "HTTP/1.1 204 No Content" | 95 | curl_post "${namestore_link}/$name" '{"data": [{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", "record_type":"PKEY", "expiration_time":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "HTTP/1.1 204 No Content" |
95 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 96 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
96 | 97 | ||
97 | # invalid values | 98 | # invalid values |
@@ -106,29 +107,29 @@ curl_post "${namestore_link}/$name" '{"data": [{"record_type":"PKEY", "expiratio | |||
106 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 107 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
107 | 108 | ||
108 | #expirations | 109 | #expirations |
109 | curl_post "${namestore_link}/$name" '{"data": [{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", "record_type":"PKEY", "expiration_time":"0d","private": false, "relative_expiration": true, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "HTTP/1.1 204" | 110 | curl_post "${namestore_link}/$name" '{"data": [{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", "record_type":"PKEY", "expiration_time":"0d","private": false, "relative_expiration": true, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "HTTP/1.1 204" |
110 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 111 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
111 | 112 | ||
112 | curl_post "${namestore_link}/$name" '{"data": [{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", "record_type":"PKEY", "expiration_time":"10000d","private": false, "relative_expiration": true, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "HTTP/1.1 204" | 113 | curl_post "${namestore_link}/$name" '{"data": [{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", "record_type":"PKEY", "expiration_time":"10000d","private": false, "relative_expiration": true, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "HTTP/1.1 204" |
113 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 114 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
114 | 115 | ||
115 | curl_post "${namestore_link}/$name" '{"data": [{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", "record_type":"PKEY", "expiration_time":"now","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "error" | 116 | curl_post "${namestore_link}/$name" '{"data": [{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", "record_type":"PKEY", "expiration_time":"now","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "error" |
116 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 117 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
117 | 118 | ||
118 | curl_post "${namestore_link}/$name" '{"data": [{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", "record_type":"PKEY", "expiration_time_missing":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "error" | 119 | curl_post "${namestore_link}/$name" '{"data": [{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", "record_type":"PKEY", "expiration_time_missing":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":"test_entry"}' "error" |
119 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 120 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
120 | 121 | ||
121 | #record_name | 122 | #record_name |
122 | curl_post "${namestore_link}/$name" '{"data": [{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", "record_type":"PKEY", "expiration_time":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":""}' "error" | 123 | curl_post "${namestore_link}/$name" '{"data": [{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", "record_type":"PKEY", "expiration_time":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name":""}' "error" |
123 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 124 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
124 | curl_post "${namestore_link}/$name" '{"data": [{"value":"HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG", "record_type":"PKEY", "expiration_time":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name_missing":"test_entry"}' "error" | 125 | curl_post "${namestore_link}/$name" '{"data": [{"value":"000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8", "record_type":"PKEY", "expiration_time":"1d","private": false, "relative_expiration": false, "supplemental": false, "shadow": false}],"record_name_missing":"test_entry"}' "error" |
125 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 | 126 | gnunet-namestore -z $name -d -n "test_entry" -c test_namestore_api.conf > /dev/null 2>&1 |
126 | 127 | ||
127 | #Test DELETE | 128 | #Test DELETE |
128 | gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG" -t "PKEY" -c test_namestore_api.conf | 129 | gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY" -c test_namestore_api.conf |
129 | curl_delete "${namestore_link}/$name/test_entry" "HTTP/1.1 204" | 130 | curl_delete "${namestore_link}/$name/test_entry" "HTTP/1.1 204" |
130 | curl_delete "${namestore_link}/$name/test_entry" "error" | 131 | curl_delete "${namestore_link}/$name/test_entry" "error" |
131 | gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "HVX38H2CB7WJM0WCPWT9CFX6GASMYJVR65RN75SJSSKAYVYXHMRG" -t "PKEY" -c test_namestore_api.conf | 132 | gnunet-namestore -z $name -p -a -n "test_entry" -e "1d" -V "000G006WVZ8HQ5YTVFNX09HK0VJVVQ9ZCBYDSCH3ERT04N5ZRBKEB82EP8" -t "PKEY" -c test_namestore_api.conf |
132 | curl_delete "${namestore_link}/$public/test_entry" "error" | 133 | curl_delete "${namestore_link}/$public/test_entry" "error" |
133 | 134 | ||
134 | gnunet-arm -e -c test_namestore_api.conf | 135 | gnunet-arm -e -c test_namestore_api.conf |