diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-02-19 12:50:22 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-19 12:50:22 +0100 |
commit | 901b2fcc56a618a0d3e9d3e65c8688f84e3e180c (patch) | |
tree | ffc60643f3d008a3c7e3d68546b1374c544a97a7 /src/gnsrecord | |
parent | 5b4ac38b55682277269bfe54324c15a6af1bb118 (diff) | |
download | gnunet-901b2fcc56a618a0d3e9d3e65c8688f84e3e180c.tar.gz gnunet-901b2fcc56a618a0d3e9d3e65c8688f84e3e180c.zip |
-fix merge issues
Diffstat (limited to 'src/gnsrecord')
-rw-r--r-- | src/gnsrecord/gnunet-gnsrecord-tvg.c | 76 |
1 files changed, 63 insertions, 13 deletions
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c index 2db301850..112a06a7d 100644 --- a/src/gnsrecord/gnunet-gnsrecord-tvg.c +++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c | |||
@@ -40,7 +40,8 @@ static char *d_pkey = | |||
40 | static char *d_edkey = | 40 | static char *d_edkey = |
41 | "5af7020ee19160328832352bbc6a68a8d71a7cbe1b929969a7c66d415a0d8f65"; | 41 | "5af7020ee19160328832352bbc6a68a8d71a7cbe1b929969a7c66d415a0d8f65"; |
42 | 42 | ||
43 | int | 43 | |
44 | static int | ||
44 | parsehex (char *src, char *dst, size_t dstlen, int invert) | 45 | parsehex (char *src, char *dst, size_t dstlen, int invert) |
45 | { | 46 | { |
46 | char *line = src; | 47 | char *line = src; |
@@ -124,9 +125,6 @@ static void | |||
124 | run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char *label) | 125 | run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char *label) |
125 | { | 126 | { |
126 | struct GNUNET_TIME_Absolute expire; | 127 | struct GNUNET_TIME_Absolute expire; |
127 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | ||
128 | struct GNUNET_TIME_Relative delta1; | ||
129 | struct GNUNET_TIME_Relative delta2; | ||
130 | struct GNUNET_GNSRECORD_Block *rrblock; | 128 | struct GNUNET_GNSRECORD_Block *rrblock; |
131 | char *bdata; | 129 | char *bdata; |
132 | struct GNUNET_IDENTITY_PrivateKey id_priv; | 130 | struct GNUNET_IDENTITY_PrivateKey id_priv; |
@@ -134,8 +132,6 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char *label) | |||
134 | struct GNUNET_IDENTITY_PrivateKey pkey_data_p; | 132 | struct GNUNET_IDENTITY_PrivateKey pkey_data_p; |
135 | struct GNUNET_IDENTITY_PublicKey pkey_data; | 133 | struct GNUNET_IDENTITY_PublicKey pkey_data; |
136 | struct GNUNET_HashCode query; | 134 | struct GNUNET_HashCode query; |
137 | void *data; | ||
138 | size_t data_size; | ||
139 | char *rdata; | 135 | char *rdata; |
140 | size_t rdata_size; | 136 | size_t rdata_size; |
141 | char ztld[128]; | 137 | char ztld[128]; |
@@ -244,9 +240,6 @@ static void | |||
244 | run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char*label) | 240 | run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char*label) |
245 | { | 241 | { |
246 | struct GNUNET_TIME_Absolute expire; | 242 | struct GNUNET_TIME_Absolute expire; |
247 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | ||
248 | struct GNUNET_TIME_Relative delta1; | ||
249 | struct GNUNET_TIME_Relative delta2; | ||
250 | struct GNUNET_GNSRECORD_Block *rrblock; | 243 | struct GNUNET_GNSRECORD_Block *rrblock; |
251 | char *bdata; | 244 | char *bdata; |
252 | struct GNUNET_IDENTITY_PrivateKey id_priv; | 245 | struct GNUNET_IDENTITY_PrivateKey id_priv; |
@@ -254,8 +247,6 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char*label) | |||
254 | struct GNUNET_IDENTITY_PrivateKey pkey_data_p; | 247 | struct GNUNET_IDENTITY_PrivateKey pkey_data_p; |
255 | struct GNUNET_IDENTITY_PublicKey pkey_data; | 248 | struct GNUNET_IDENTITY_PublicKey pkey_data; |
256 | struct GNUNET_HashCode query; | 249 | struct GNUNET_HashCode query; |
257 | void *data; | ||
258 | size_t data_size; | ||
259 | char *rdata; | 250 | char *rdata; |
260 | size_t rdata_size; | 251 | size_t rdata_size; |
261 | 252 | ||
@@ -373,8 +364,67 @@ run (void *cls, | |||
373 | const char *cfgfile, | 364 | const char *cfgfile, |
374 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 365 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
375 | { | 366 | { |
376 | run_pkey (); | 367 | struct GNUNET_GNSRECORD_Data rd_pkey; |
377 | run_edkey (); | 368 | struct GNUNET_GNSRECORD_Data rd[3]; |
369 | struct GNUNET_TIME_Absolute exp1; | ||
370 | struct GNUNET_TIME_Absolute exp2; | ||
371 | struct GNUNET_TIME_Relative exp3; | ||
372 | size_t pkey_data_size; | ||
373 | size_t ip_data_size; | ||
374 | char *pkey_data; | ||
375 | char *ip_data; | ||
376 | |||
377 | /* | ||
378 | * Make different expiration times | ||
379 | */ | ||
380 | GNUNET_STRINGS_fancy_time_to_absolute ("2048-01-23 10:51:34", | ||
381 | &exp1); | ||
382 | GNUNET_STRINGS_fancy_time_to_absolute ("3540-05-22 07:55:01", | ||
383 | &exp2); | ||
384 | GNUNET_STRINGS_fancy_time_to_relative ("100y", | ||
385 | &exp3); | ||
386 | |||
387 | |||
388 | memset (&rd_pkey, 0, sizeof (struct GNUNET_GNSRECORD_Data)); | ||
389 | GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_string_to_value ( | ||
390 | GNUNET_GNSRECORD_TYPE_PKEY, | ||
391 | "000G0011WESGZY9VRV9NNJ66W3GKNZFZF56BFD2BQF3MHMJST2G2GKDYGG", | ||
392 | (void**) &pkey_data, | ||
393 | &pkey_data_size)); | ||
394 | rd_pkey.data = pkey_data; | ||
395 | rd_pkey.data_size = pkey_data_size; | ||
396 | rd_pkey.expiration_time = exp1.abs_value_us; | ||
397 | rd_pkey.record_type = GNUNET_GNSRECORD_TYPE_PKEY; | ||
398 | rd_pkey.flags = GNUNET_GNSRECORD_RF_CRITICAL; | ||
399 | GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_string_to_value ( | ||
400 | GNUNET_DNSPARSER_TYPE_AAAA, | ||
401 | "::dead:beef", | ||
402 | (void**) &ip_data, | ||
403 | &ip_data_size)); | ||
404 | |||
405 | rd[0].data = ip_data; | ||
406 | rd[0].data_size = ip_data_size; | ||
407 | rd[0].expiration_time = exp1.abs_value_us; | ||
408 | rd[0].record_type = GNUNET_DNSPARSER_TYPE_AAAA; | ||
409 | rd[0].flags = GNUNET_GNSRECORD_RF_NONE; | ||
410 | |||
411 | rd[1].data = "\u611b\u79f0"; | ||
412 | rd[1].data_size = strlen (rd[1].data); | ||
413 | rd[1].expiration_time = exp2.abs_value_us; | ||
414 | rd[1].record_type = GNUNET_GNSRECORD_TYPE_NICK; | ||
415 | rd[1].flags = GNUNET_GNSRECORD_RF_PRIVATE; | ||
416 | |||
417 | rd[2].data = "Hello World"; | ||
418 | rd[2].data_size = strlen (rd[2].data); | ||
419 | rd[2].expiration_time = exp3.rel_value_us; | ||
420 | rd[2].record_type = GNUNET_DNSPARSER_TYPE_TXT; | ||
421 | rd[2].flags = GNUNET_GNSRECORD_RF_SUPPLEMENTAL | ||
422 | | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | ||
423 | |||
424 | run_pkey (&rd_pkey, 1, "testdelegation"); | ||
425 | run_pkey (rd, 3, "namesystem"); | ||
426 | run_edkey (&rd_pkey, 1, "testdelegation"); | ||
427 | run_edkey (rd, 3, "namesystem"); | ||
378 | } | 428 | } |
379 | 429 | ||
380 | 430 | ||