diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-05-30 16:31:24 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-05-30 16:31:24 +0200 |
commit | 7b25787a4b8ac0a0b3cbc2174ba3cac9c564346a (patch) | |
tree | 60e9259939dca8f9bb9ad2539d594fb15e67a170 /src/auditor | |
parent | 7f902c0fc9bc7e0832d01169e6f580ab671fbf08 (diff) | |
download | exchange-7b25787a4b8ac0a0b3cbc2174ba3cac9c564346a.tar.xz |
-generate 404 on non-existing accounts for fakebank, use payto://-URIs with receiver-name in tests
Diffstat (limited to 'src/auditor')
-rw-r--r-- | src/auditor/taler-auditor.in | 15 | ||||
-rw-r--r-- | src/auditor/taler-helper-auditor-wire.c | 22 |
2 files changed, 29 insertions, 8 deletions
diff --git a/src/auditor/taler-auditor.in b/src/auditor/taler-auditor.in index c8ea6b0c9..6a8e88daa 100644 --- a/src/auditor/taler-auditor.in +++ b/src/auditor/taler-auditor.in @@ -11,6 +11,7 @@ Arguments mandatory for long options are also mandatory for short options. -h, --help print this help -i, --internal perform checks only applicable for exchange-internal audits + -I, --ignore-not-found ignore problems with the exchange bank account not existing -L, --log=LOGLEVEL configure logging to use LOGLEVEL -l, --logfile=FILENAME configure logging to write logs to FILENAME -m, --exchange-key=KEY public key of the exchange (Crockford base32 @@ -28,7 +29,7 @@ EOF function optcheck { -TEMP=`getopt -o c:hiL:l:m:T:v --long config:,help,internal,log:,logfile:exchange-key:,timetravel:,version -n 'taler-auditor' -- "$@"` +TEMP=`getopt -o c:hiIL:l:m:T:v --long config:,help,internal,ignore-not-found,log:,logfile:exchange-key:,timetravel:,version -n 'taler-auditor' -- "$@"` if [ $? != 0 ] ; then @@ -43,6 +44,7 @@ DEBUG=false MEMORY= DEBUGFILE= JAVA_MISC_OPT= +INF= while true; do case "$1" in -c | --config ) shift 2 ;; @@ -51,6 +53,7 @@ while true; do exit 0 ;; -i | --internal ) shift ;; + -I | --ignore-not-found ) INF="-I"; shift ;; -L | --log ) shift 2;; -l | --logfile ) shift ;; -m | --exchange-key ) shift 2 ;; @@ -74,16 +77,20 @@ done } # End of function 'optcheck' - optcheck "$@" +# Remove "-I" from $@ if present, store result in $ARGS. +ARGS=("$@") +ARGS=(${ARGS[@]/$INF}) DIR=`mktemp -d reportXXXXXX` -for n in aggregation coins deposits reserves wire +for n in aggregation coins deposits reserves do - taler-helper-auditor-$n "$@" > ${DIR}/$n.json + taler-helper-auditor-$n ${ARGS[*]} > ${DIR}/$n.json done +taler-helper-auditor-wire $INF ${ARGS[*]} > ${DIR}/wire.json + taler-helper-auditor-render.py \ ${DIR}/aggregation.json \ ${DIR}/coins.json \ diff --git a/src/auditor/taler-helper-auditor-wire.c b/src/auditor/taler-helper-auditor-wire.c index 274344ff6..2cc70a940 100644 --- a/src/auditor/taler-helper-auditor-wire.c +++ b/src/auditor/taler-helper-auditor-wire.c @@ -304,6 +304,12 @@ static struct GNUNET_CURL_RescheduleContext *rc; */ static int internal_checks; +/** + * Should we ignore if the bank does not know our bank + * account? + */ +static int ignore_account_404; + /* ***************************** Shutdown **************************** */ /** @@ -1166,7 +1172,7 @@ check_rc_matches (void *cls, * @param value the `struct ReserveOutInfo` to report * @return #GNUNET_OK */ -static int +static enum GNUNET_GenericReturnValue complain_out_not_found (void *cls, const struct GNUNET_HashCode *key, void *value) @@ -1275,7 +1281,7 @@ check_exchange_wire_out (struct WireAccount *wa) * @param json original response in JSON format * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration */ -static int +static enum GNUNET_GenericReturnValue history_debit_cb (void *cls, unsigned int http_status_code, enum TALER_ErrorCode ec, @@ -1291,7 +1297,9 @@ history_debit_cb (void *cls, if (NULL == details) { wa->dhh = NULL; - if (TALER_EC_NONE != ec) + if ( (TALER_EC_NONE != ec) && + ( (! ignore_account_404) || + (MHD_HTTP_NOT_FOUND != http_status_code) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error fetching debit history of account %s: %u/%u!\n", @@ -1584,7 +1592,9 @@ history_credit_cb (void *cls, if (NULL == details) { wa->chh = NULL; - if (TALER_EC_NONE != ec) + if ( (TALER_EC_NONE != ec) && + ( (! ignore_account_404) || + (MHD_HTTP_NOT_FOUND != http_status) ) ) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error fetching credit history of account %s: %u/%s!\n", @@ -2177,6 +2187,10 @@ main (int argc, "internal", "perform checks only applicable for exchange-internal audits", &internal_checks), + GNUNET_GETOPT_option_flag ('I', + "ignore-not-found", + "continue, even if the bank account of the exchange was not found", + &ignore_account_404), GNUNET_GETOPT_option_base32_auto ('m', "exchange-key", "KEY", |