aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/test_namestore_api_create_update.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-19 22:17:25 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-19 22:17:25 +0000
commit808ef8ab410b486c5cca7515389f608e965d53b1 (patch)
tree2a9476225227e3e550d95294db1c1b676bd23264 /src/namestore/test_namestore_api_create_update.c
parent50114769c42140782b3955e416d61837fe570d0b (diff)
downloadgnunet-808ef8ab410b486c5cca7515389f608e965d53b1.tar.gz
gnunet-808ef8ab410b486c5cca7515389f608e965d53b1.zip
-fixing testcases with new expiration code
Diffstat (limited to 'src/namestore/test_namestore_api_create_update.c')
-rw-r--r--src/namestore/test_namestore_api_create_update.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c
index e898a3050..e21ed4186 100644
--- a/src/namestore/test_namestore_api_create_update.c
+++ b/src/namestore/test_namestore_api_create_update.c
@@ -138,7 +138,7 @@ create_identical_cont (void *cls, int32_t success, const char *emsg)
138 if (success == GNUNET_NO) 138 if (success == GNUNET_NO)
139 { 139 {
140 res = 0; 140 res = 0;
141 s_first_record->expiration = GNUNET_TIME_absolute_get (); 141 s_first_record->expiration_time = GNUNET_TIME_absolute_get ().abs_value;
142 GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record, &create_updated_cont, s_name); 142 GNUNET_NAMESTORE_record_create (nsh, privkey, s_name, s_first_record, &create_updated_cont, s_name);
143 } 143 }
144 else 144 else
@@ -173,21 +173,20 @@ create_first_cont (void *cls, int32_t success, const char *emsg)
173 173
174 174
175static struct GNUNET_NAMESTORE_RecordData * 175static struct GNUNET_NAMESTORE_RecordData *
176create_record (int count) 176create_record (unsigned int count)
177{ 177{
178 int c; 178 unsigned int c;
179 struct GNUNET_NAMESTORE_RecordData * rd; 179 struct GNUNET_NAMESTORE_RecordData * rd;
180 rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
181 180
181 rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
182 for (c = 0; c < count; c++) 182 for (c = 0; c < count; c++)
183 { 183 {
184 rd[c].expiration = GNUNET_TIME_UNIT_ZERO_ABS; 184 rd[c].expiration_time = 0;
185 rd[c].record_type = TEST_RECORD_TYPE; 185 rd[c].record_type = TEST_RECORD_TYPE;
186 rd[c].data_size = TEST_RECORD_DATALEN; 186 rd[c].data_size = TEST_RECORD_DATALEN;
187 rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN); 187 rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
188 memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); 188 memset ((char *) rd[c].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
189 } 189 }
190
191 return rd; 190 return rd;
192} 191}
193 192
@@ -198,6 +197,7 @@ run (void *cls,
198{ 197{
199 size_t rd_ser_len; 198 size_t rd_ser_len;
200 char *hostkey_file; 199 char *hostkey_file;
200 struct GNUNET_TIME_Absolute et;
201 201
202 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); 202 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL);
203 203
@@ -219,7 +219,8 @@ run (void *cls,
219 char rd_ser[rd_ser_len]; 219 char rd_ser[rd_ser_len];
220 GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser); 220 GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser);
221 221
222 s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1); 222 et.abs_value = s_first_record->expiration_time;
223 s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1);
223 224
224 /* create random zone hash */ 225 /* create random zone hash */
225 GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); 226 GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);