/*
This file is part of GNUnet.
- Copyright (C) 2012-2015 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2012-2015 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
#include "gnunet_signatures.h"
#include "identity_provider.h"
#include "identity_token.h"
+#include <inttypes.h>
/**
* First pass state
if (0 == strcmp (attr->name, "exp"))
{
sscanf (attr->val_head->value,
- "%lu",
+ "%"SCNu64,
&token_exp.abs_value_us);
} else if (0 == strcmp (attr->name, "nbf")) {
sscanf (attr->val_head->value,
- "%lu",
+ "%"SCNu64,
&token_nbf.abs_value_us);
}
}
static struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage*
create_exchange_result_message (const char* token,
- const char* label)
+ const char* label,
+ uint64_t ticket_nonce)
{
struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage *erm;
uint16_t token_len = strlen (token) + 1;
erm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_EXCHANGE_RESULT);
erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage)
+ token_len);
+ erm->ticket_nonce = htonl (ticket_nonce);
memcpy (&erm[1], token, token_len);
return erm;
}
//Remote nonce
nonce_str = NULL;
- GNUNET_asprintf (&nonce_str, "%d", handle->nonce);
+ GNUNET_asprintf (&nonce_str, "%lu", handle->nonce);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request nonce: %s\n", nonce_str);
GNUNET_CRYPTO_ecdsa_key_get_public (&handle->iss_key,
&pub_key);
- handle->ticket = ticket_create (nonce_str,
+ handle->ticket = ticket_create (handle->nonce,
&pub_key,
handle->label,
&handle->aud_key);
&token_str));
erm = create_exchange_result_message (token_str,
- handle->label);
+ handle->label,
+ handle->ticket->payload->nonce);
GNUNET_SERVER_notification_context_unicast (nc,
handle->client,
&erm->header,
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Looking for token under %s\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking for token under %s\n",
xchange_handle->ticket->payload->label);
GNUNET_asprintf (&lookup_query,
"%s.gnu",
char *tmp = GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA,
token_metadata_record->data,
token_metadata_record->data_size);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Token does not match audience %s vs %s. Moving on\n",
tmp2,
tmp);
if ((NULL != handle->attr_map) &&
(GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains (handle->attr_map, &key)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Issued token does not include `%s'. Moving on\n", scope);
GNUNET_free (tmp_scopes);
GNUNET_NAMESTORE_zone_iterator_next (handle->ns_it);