diff options
author | Andreas Ebner <a.e.bner@web.de> | 2019-09-14 16:58:39 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-10-07 12:17:29 +0200 |
commit | 5be14856a356b087ad97b479efd9b06172fdfd2f (patch) | |
tree | 724a52f386be772cd8605224c47017f3b4d64e20 /src/credential/gnunet-credential.c | |
parent | d4790594a33a4688641f66841f05533b3c0956b9 (diff) | |
download | gnunet-5be14856a356b087ad97b479efd9b06172fdfd2f.tar.gz gnunet-5be14856a356b087ad97b479efd9b06172fdfd2f.zip |
Bugfixes, changed test reporting behavior, modified intermediate result reporting:
- fixed a memory error when serializing the delegations
- all tests now handle the returned error code from the gnunet-credential.c via "ret" variable
- intermediate reporting excluded during collect message
- intermediate reporting now contains the direction (bw/fw)
Diffstat (limited to 'src/credential/gnunet-credential.c')
-rw-r--r-- | src/credential/gnunet-credential.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c index aa9828d4b..0d742d1ef 100644 --- a/src/credential/gnunet-credential.c +++ b/src/credential/gnunet-credential.c | |||
@@ -76,6 +76,11 @@ static struct GNUNET_CREDENTIAL_Request *collect_request; | |||
76 | static struct GNUNET_SCHEDULER_Task *tt; | 76 | static struct GNUNET_SCHEDULER_Task *tt; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Return value of the commandline. | ||
80 | */ | ||
81 | static int ret = 0; | ||
82 | |||
83 | /** | ||
79 | * Subject pubkey string | 84 | * Subject pubkey string |
80 | */ | 85 | */ |
81 | static char *subject; | 86 | static char *subject; |
@@ -265,9 +270,18 @@ do_timeout (void *cls) | |||
265 | 270 | ||
266 | static void | 271 | static void |
267 | handle_intermediate_result(void *cls, | 272 | handle_intermediate_result(void *cls, |
268 | struct GNUNET_CREDENTIAL_Delegation *dd) | 273 | struct GNUNET_CREDENTIAL_Delegation *dd, |
274 | bool is_bw) | ||
269 | { | 275 | { |
270 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Intermediate result: %s.%s <- %s.%s\n", | 276 | char *prefix = ""; |
277 | // TODO change to printf | ||
278 | if(is_bw) | ||
279 | prefix = "Backward -"; | ||
280 | else | ||
281 | prefix = "Forward -"; | ||
282 | |||
283 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s Intermediate result: %s.%s <- %s.%s\n", | ||
284 | prefix, | ||
271 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), | 285 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), |
272 | dd->issuer_attribute, | 286 | dd->issuer_attribute, |
273 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), | 287 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), |
@@ -316,7 +330,7 @@ handle_verify_result (void *cls, | |||
316 | 330 | ||
317 | verify_request = NULL; | 331 | verify_request = NULL; |
318 | if (NULL == dele) | 332 | if (NULL == dele) |
319 | printf ("Failed.\n"); | 333 | ret = 1; |
320 | else | 334 | else |
321 | { | 335 | { |
322 | printf ("Delegation Chain:\n"); | 336 | printf ("Delegation Chain:\n"); |
@@ -1032,22 +1046,21 @@ main (int argc, char *const *argv) | |||
1032 | "Indicates that the collect/verify process is done via forward search."), | 1046 | "Indicates that the collect/verify process is done via forward search."), |
1033 | &backward), | 1047 | &backward), |
1034 | GNUNET_GETOPT_OPTION_END}; | 1048 | GNUNET_GETOPT_OPTION_END}; |
1035 | int ret; | 1049 | |
1036 | 1050 | ||
1037 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1051 | timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
1038 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 1052 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
1039 | return 2; | 1053 | return 2; |
1040 | 1054 | ||
1041 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); | 1055 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); |
1042 | ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc, | 1056 | if (GNUNET_OK == GNUNET_PROGRAM_run (argc, |
1043 | argv, | 1057 | argv, |
1044 | "gnunet-credential", | 1058 | "gnunet-credential", |
1045 | _ ("GNUnet credential resolver tool"), | 1059 | _ ("GNUnet credential resolver tool"), |
1046 | options, | 1060 | options, |
1047 | &run, | 1061 | &run, |
1048 | NULL)) | 1062 | NULL)) |
1049 | ? 0 | 1063 | ret = 1; |
1050 | : 1; | ||
1051 | GNUNET_free ((void *) argv); | 1064 | GNUNET_free ((void *) argv); |
1052 | return ret; | 1065 | return ret; |
1053 | } | 1066 | } |