summaryrefslogtreecommitdiff
path: root/src/restclient/anastasis_api_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/restclient/anastasis_api_config.c')
-rw-r--r--src/restclient/anastasis_api_config.c56
1 files changed, 20 insertions, 36 deletions
diff --git a/src/restclient/anastasis_api_config.c b/src/restclient/anastasis_api_config.c
index f82cd9e..fff4774 100644
--- a/src/restclient/anastasis_api_config.c
+++ b/src/restclient/anastasis_api_config.c
@@ -104,6 +104,7 @@ handle_config_finished (void *cls,
{
const char *name;
const json_t *methods;
+ struct TALER_JSON_ProtocolVersion pv;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("name",
&name),
@@ -111,6 +112,8 @@ handle_config_finished (void *cls,
&acfg.details.ok.business_name),
GNUNET_JSON_spec_string ("version",
&acfg.details.ok.version),
+ TALER_JSON_spec_version ("version",
+ &pv),
GNUNET_JSON_spec_array_const ("methods",
&methods),
GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
@@ -147,43 +150,24 @@ handle_config_finished (void *cls,
acfg.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
break;
}
+ if ( (ANASTASIS_PROTOCOL_CURRENT < pv.current) &&
+ (ANASTASIS_PROTOCOL_CURRENT < pv.current - pv.age) )
{
- unsigned int age;
- unsigned int revision;
- unsigned int current;
- char dummy;
-
- if (3 != sscanf (acfg.details.ok.version,
- "%u:%u:%u%c",
- &current,
- &revision,
- &age,
- &dummy))
- {
- GNUNET_break_op (0);
- acfg.http_status = 0;
- acfg.ec = TALER_EC_GENERIC_VERSION_MALFORMED;
- break;
- }
- if ( (ANASTASIS_PROTOCOL_CURRENT < current) &&
- (ANASTASIS_PROTOCOL_CURRENT < current - age) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Provider protocol version too new\n");
- acfg.http_status = 0;
- acfg.ec = TALER_EC_GENERIC_VERSION_MALFORMED;
- break;
- }
- if ( (ANASTASIS_PROTOCOL_CURRENT > current) &&
- (ANASTASIS_PROTOCOL_CURRENT - ANASTASIS_PROTOCOL_AGE > current) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Provider protocol version too old\n");
- GNUNET_break_op (0);
- acfg.http_status = 0;
- acfg.ec = TALER_EC_GENERIC_VERSION_MALFORMED;
- break;
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Provider protocol version too new\n");
+ acfg.http_status = 0;
+ acfg.ec = TALER_EC_GENERIC_VERSION_MALFORMED;
+ break;
+ }
+ if ( (ANASTASIS_PROTOCOL_CURRENT > pv.current) &&
+ (ANASTASIS_PROTOCOL_CURRENT - ANASTASIS_PROTOCOL_AGE > pv.current) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Provider protocol version too old\n");
+ GNUNET_break_op (0);
+ acfg.http_status = 0;
+ acfg.ec = TALER_EC_GENERIC_VERSION_MALFORMED;
+ break;
}
acfg.details.ok.methods_length = json_array_size (methods);
{