diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-30 19:40:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-30 19:40:14 +0000 |
commit | c644917564f9a76b47b8c0d531e95020da9e282c (patch) | |
tree | c188c2911518f74f6b5405d781440590736291a1 /src/namestore/test_namestore_api_create.c | |
parent | 17de5c9d798109f55059190c886609ba377e4eb6 (diff) | |
download | gnunet-c644917564f9a76b47b8c0d531e95020da9e282c.tar.gz gnunet-c644917564f9a76b47b8c0d531e95020da9e282c.zip |
-fixing some namestore tests
Diffstat (limited to 'src/namestore/test_namestore_api_create.c')
-rw-r--r-- | src/namestore/test_namestore_api_create.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/src/namestore/test_namestore_api_create.c b/src/namestore/test_namestore_api_create.c index 0510a6c4b..aba18c192 100644 --- a/src/namestore/test_namestore_api_create.c +++ b/src/namestore/test_namestore_api_create.c | |||
@@ -54,10 +54,6 @@ static struct GNUNET_CRYPTO_EccPrivateKey * privkey; | |||
54 | 54 | ||
55 | static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; | 55 | static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey; |
56 | 56 | ||
57 | static struct GNUNET_CRYPTO_EccSignature *s_signature; | ||
58 | |||
59 | static struct GNUNET_CRYPTO_EccSignature *s_signature_updated; | ||
60 | |||
61 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; | 57 | static struct GNUNET_CRYPTO_ShortHashCode s_zone; |
62 | 58 | ||
63 | static struct GNUNET_NAMESTORE_RecordData *s_first_record; | 59 | static struct GNUNET_NAMESTORE_RecordData *s_first_record; |
@@ -166,18 +162,6 @@ name_lookup_second_proc (void *cls, | |||
166 | failed = GNUNET_YES; | 162 | failed = GNUNET_YES; |
167 | } | 163 | } |
168 | 164 | ||
169 | struct GNUNET_NAMESTORE_RecordData rd_new[2]; | ||
170 | rd_new[0] = *s_first_record; | ||
171 | rd_new[1] = *s_second_record; | ||
172 | rd_new[1].flags = 0; /* unset GNUNET_NAMESTORE_RF_AUTHORITY */ | ||
173 | s_signature_updated = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, rd_new, 2); | ||
174 | |||
175 | if (0 != memcmp (s_signature_updated, signature, sizeof (struct GNUNET_CRYPTO_EccSignature))) | ||
176 | { | ||
177 | GNUNET_break (0); | ||
178 | failed = GNUNET_YES; | ||
179 | } | ||
180 | |||
181 | found = GNUNET_YES; | 165 | found = GNUNET_YES; |
182 | if (failed == GNUNET_NO) | 166 | if (failed == GNUNET_NO) |
183 | res = 0; | 167 | res = 0; |
@@ -226,6 +210,7 @@ name_lookup_initial_proc (void *cls, | |||
226 | const struct GNUNET_NAMESTORE_RecordData *rd, | 210 | const struct GNUNET_NAMESTORE_RecordData *rd, |
227 | const struct GNUNET_CRYPTO_EccSignature *signature) | 211 | const struct GNUNET_CRYPTO_EccSignature *signature) |
228 | { | 212 | { |
213 | struct GNUNET_NAMESTORE_RecordData both_records[2]; | ||
229 | char * name = cls; | 214 | char * name = cls; |
230 | static int found = GNUNET_NO; | 215 | static int found = GNUNET_NO; |
231 | int failed = GNUNET_NO; | 216 | int failed = GNUNET_NO; |
@@ -267,12 +252,6 @@ name_lookup_initial_proc (void *cls, | |||
267 | failed = GNUNET_YES; | 252 | failed = GNUNET_YES; |
268 | } | 253 | } |
269 | 254 | ||
270 | if (0 != memcmp (s_signature, signature, sizeof (struct GNUNET_CRYPTO_EccSignature))) | ||
271 | { | ||
272 | GNUNET_break (0); | ||
273 | failed = GNUNET_YES; | ||
274 | } | ||
275 | |||
276 | found = GNUNET_YES; | 255 | found = GNUNET_YES; |
277 | if (failed == GNUNET_NO) | 256 | if (failed == GNUNET_NO) |
278 | res = 0; | 257 | res = 0; |
@@ -288,8 +267,10 @@ name_lookup_initial_proc (void *cls, | |||
288 | s_second_record->data_size = TEST_CREATE_RECORD_DATALEN; | 267 | s_second_record->data_size = TEST_CREATE_RECORD_DATALEN; |
289 | memset ((char *) s_second_record->data, TEST_CREATE_RECORD_DATA, TEST_CREATE_RECORD_DATALEN); | 268 | memset ((char *) s_second_record->data, TEST_CREATE_RECORD_DATA, TEST_CREATE_RECORD_DATALEN); |
290 | 269 | ||
270 | both_records[0] = *s_first_record; | ||
271 | both_records[1] = *s_second_record; | ||
291 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, name, | 272 | GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, name, |
292 | 1, s_second_record, | 273 | 2, both_records, |
293 | &create_second_cont, name); | 274 | &create_second_cont, name); |
294 | 275 | ||
295 | } | 276 | } |
@@ -352,7 +333,6 @@ run (void *cls, | |||
352 | { | 333 | { |
353 | size_t rd_ser_len; | 334 | size_t rd_ser_len; |
354 | char *hostkey_file; | 335 | char *hostkey_file; |
355 | struct GNUNET_TIME_Absolute et; | ||
356 | 336 | ||
357 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,endbadly, NULL); | 337 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,endbadly, NULL); |
358 | /* load privat key */ | 338 | /* load privat key */ |
@@ -371,8 +351,6 @@ run (void *cls, | |||
371 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, s_first_record); | 351 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, s_first_record); |
372 | char rd_ser[rd_ser_len]; | 352 | char rd_ser[rd_ser_len]; |
373 | GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser); | 353 | GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser); |
374 | et.abs_value = s_first_record->expiration_time; | ||
375 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1); | ||
376 | 354 | ||
377 | /* create random zone hash */ | 355 | /* create random zone hash */ |
378 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), &s_zone); | 356 | GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), &s_zone); |
@@ -402,7 +380,6 @@ main (int argc, char *argv[]) | |||
402 | &run, | 380 | &run, |
403 | NULL)) | 381 | NULL)) |
404 | return 1; | 382 | return 1; |
405 | GNUNET_free (s_signature); | ||
406 | return res; | 383 | return res; |
407 | } | 384 | } |
408 | 385 | ||