diff options
Diffstat (limited to 'src/backend/anastasis-httpd_policy-meta.c')
-rw-r--r-- | src/backend/anastasis-httpd_policy-meta.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/backend/anastasis-httpd_policy-meta.c b/src/backend/anastasis-httpd_policy-meta.c index 7d143ef..a62a21e 100644 --- a/src/backend/anastasis-httpd_policy-meta.c +++ b/src/backend/anastasis-httpd_policy-meta.c @@ -86,7 +86,7 @@ return_policy_meta ( const struct ANASTASIS_CRYPTO_AccountPublicKeyP *account_pub) { enum GNUNET_DB_QueryStatus qs; - uint32_t max_version; + uint32_t max_version = INT32_MAX; /* Postgres is using signed ints... */ json_t *result; { @@ -109,6 +109,8 @@ return_policy_meta ( TALER_EC_GENERIC_PARAMETER_MALFORMED, "version"); } + if (max_version > INT32_MAX) + max_version = INT32_MAX; /* cap to signed range */ } } result = json_object (); @@ -156,7 +158,6 @@ AH_policy_meta_get ( { struct GNUNET_HashCode recovery_data_hash; enum ANASTASIS_DB_AccountStatus as; - MHD_RESULT ret; uint32_t version; struct GNUNET_TIME_Timestamp expiration; @@ -170,8 +171,8 @@ AH_policy_meta_get ( case ANASTASIS_DB_ACCOUNT_STATUS_PAYMENT_REQUIRED: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_SYNC_ACCOUNT_UNKNOWN, - NULL); + TALER_EC_ANASTASIS_POLICY_NOT_FOUND, + "account expired: payment required"); case ANASTASIS_DB_ACCOUNT_STATUS_HARD_ERROR: GNUNET_break (0); return TALER_MHD_reply_with_error (connection, @@ -179,19 +180,10 @@ AH_policy_meta_get ( TALER_EC_GENERIC_DB_FETCH_FAILED, "lookup account"); case ANASTASIS_DB_ACCOUNT_STATUS_NO_RESULTS: - { - struct MHD_Response *resp; - - resp = MHD_create_response_from_buffer (0, - NULL, - MHD_RESPMEM_PERSISTENT); - TALER_MHD_add_global_headers (resp); - ret = MHD_queue_response (connection, - MHD_HTTP_NO_CONTENT, - resp); - MHD_destroy_response (resp); - } - return ret; + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_ANASTASIS_POLICY_NOT_FOUND, + "no such account"); case ANASTASIS_DB_ACCOUNT_STATUS_VALID_HASH_RETURNED: /* We have results, should fetch and return them! */ break; |