aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/identity-provider/Makefile.am (renamed from src/identity-token/Makefile.am)0
-rw-r--r--src/identity-provider/gnunet-identity-token.c (renamed from src/identity-token/gnunet-identity-token.c)0
-rw-r--r--src/identity-provider/gnunet-service-identity-token.c (renamed from src/identity-token/gnunet-service-identity-token.c)0
-rw-r--r--src/identity-provider/identity-token.c (renamed from src/identity-token/identity-token.c)0
-rw-r--r--src/identity-provider/identity-token.conf (renamed from src/identity-token/identity-token.conf)0
-rw-r--r--src/identity-provider/plugin_rest_identity_token.c (renamed from src/identity-token/plugin_rest_identity_token.c)0
-rw-r--r--src/identity/plugin_gnsrecord_identity.c83
-rw-r--r--src/include/gnunet_identity_provider_lib.h (renamed from src/identity-token/identity-token.h)0
-rw-r--r--src/include/gnunet_signatures.h4
-rw-r--r--src/rest/gnunet-rest-server.c11
11 files changed, 80 insertions, 20 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 76997918fa..6e0fa5c4b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,7 +28,7 @@ if HAVE_EXPERIMENTAL
endif
if HAVE_REST
- EXP_DIR += identity-token
+ EXP_DIR += identity-provider
endif
if BUILD_PULSE_HELPERS
diff --git a/src/identity-token/Makefile.am b/src/identity-provider/Makefile.am
index a9338ba59f..a9338ba59f 100644
--- a/src/identity-token/Makefile.am
+++ b/src/identity-provider/Makefile.am
diff --git a/src/identity-token/gnunet-identity-token.c b/src/identity-provider/gnunet-identity-token.c
index ad4aae78a9..ad4aae78a9 100644
--- a/src/identity-token/gnunet-identity-token.c
+++ b/src/identity-provider/gnunet-identity-token.c
diff --git a/src/identity-token/gnunet-service-identity-token.c b/src/identity-provider/gnunet-service-identity-token.c
index 039d1c7e04..039d1c7e04 100644
--- a/src/identity-token/gnunet-service-identity-token.c
+++ b/src/identity-provider/gnunet-service-identity-token.c
diff --git a/src/identity-token/identity-token.c b/src/identity-provider/identity-token.c
index a9f210b149..a9f210b149 100644
--- a/src/identity-token/identity-token.c
+++ b/src/identity-provider/identity-token.c
diff --git a/src/identity-token/identity-token.conf b/src/identity-provider/identity-token.conf
index f29f6cdf31..f29f6cdf31 100644
--- a/src/identity-token/identity-token.conf
+++ b/src/identity-provider/identity-token.conf
diff --git a/src/identity-token/plugin_rest_identity_token.c b/src/identity-provider/plugin_rest_identity_token.c
index d2c1b6c5dd..d2c1b6c5dd 100644
--- a/src/identity-token/plugin_rest_identity_token.c
+++ b/src/identity-provider/plugin_rest_identity_token.c
diff --git a/src/identity/plugin_gnsrecord_identity.c b/src/identity/plugin_gnsrecord_identity.c
index a23629b41f..fd689490a0 100644
--- a/src/identity/plugin_gnsrecord_identity.c
+++ b/src/identity/plugin_gnsrecord_identity.c
@@ -44,11 +44,31 @@ value_to_string (void *cls,
const void *data,
size_t data_size)
{
+ const struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *audience_pubkey;
+ const char *scopes;
+ char *ecdhe_str;
+ char *aud_str;
+ char *result;
+
switch (type)
{
case GNUNET_GNSRECORD_TYPE_ID_ATTR:
case GNUNET_GNSRECORD_TYPE_ID_TOKEN:
return GNUNET_strndup (data, data_size);
+ case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA:
+ ecdhe_privkey = data;
+ audience_pubkey = data+sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
+ scopes = (char*) audience_pubkey+(sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ ecdhe_str = GNUNET_STRINGS_data_to_string_alloc (ecdhe_privkey,
+ sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
+ aud_str = GNUNET_STRINGS_data_to_string_alloc (audience_pubkey,
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ GNUNET_asprintf (&result,
+ "%s;%s;%s",
+ ecdhe_str, aud_str, scopes);
+ return result;
+
default:
return NULL;
}
@@ -73,6 +93,12 @@ string_to_value (void *cls,
void **data,
size_t *data_size)
{
+ char* ecdhe_str;
+ char* aud_keystr;
+ char* write_ptr;
+ char* tmp_tok;
+ char* str;
+
if (NULL == s)
return GNUNET_SYSERR;
switch (type)
@@ -82,6 +108,46 @@ string_to_value (void *cls,
*data = GNUNET_strdup (s);
*data_size = strlen (s);
return GNUNET_OK;
+ case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA:
+ tmp_tok = GNUNET_strdup (s);
+ ecdhe_str = strtok (tmp_tok, ";");
+ if (NULL == ecdhe_str)
+ {
+ GNUNET_free (tmp_tok);
+ return GNUNET_SYSERR;
+ }
+ aud_keystr = strtok (NULL, ";");
+ if (NULL == aud_keystr)
+ {
+ GNUNET_free (tmp_tok);
+ return GNUNET_SYSERR;
+ }
+ str = strtok (NULL, ";");
+ if (NULL == str)
+ {
+ GNUNET_free (tmp_tok);
+ return GNUNET_SYSERR;
+ }
+ *data_size = strlen (str) + 1
+ +sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)
+ +sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
+ *data = GNUNET_malloc (*data_size);
+
+ write_ptr = *data;
+ GNUNET_STRINGS_string_to_data (ecdhe_str,
+ strlen (ecdhe_str),
+ write_ptr,
+ sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
+ write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
+ GNUNET_STRINGS_string_to_data (aud_keystr,
+ strlen (aud_keystr),
+ write_ptr,
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
+ memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator
+ GNUNET_free (tmp_tok);
+ return GNUNET_OK;
+
default:
return GNUNET_SYSERR;
}
@@ -92,14 +158,15 @@ string_to_value (void *cls,
* Mapping of record type numbers to human-readable
* record type names.
*/
-static struct {
- const char *name;
- uint32_t number;
-} name_map[] = {
- { "ID_ATTR", GNUNET_GNSRECORD_TYPE_ID_ATTR },
- { "ID_TOKEN", GNUNET_GNSRECORD_TYPE_ID_TOKEN },
- { NULL, UINT32_MAX }
-};
+ static struct {
+ const char *name;
+ uint32_t number;
+ } name_map[] = {
+ { "ID_ATTR", GNUNET_GNSRECORD_TYPE_ID_ATTR },
+ { "ID_TOKEN", GNUNET_GNSRECORD_TYPE_ID_TOKEN },
+ { "ID_TOKEN_METADATA", GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA },
+ { NULL, UINT32_MAX }
+ };
/**
diff --git a/src/identity-token/identity-token.h b/src/include/gnunet_identity_provider_lib.h
index 6e41a009d9..6e41a009d9 100644
--- a/src/identity-token/identity-token.h
+++ b/src/include/gnunet_identity_provider_lib.h
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h
index dd6afbec59..95d570b546 100644
--- a/src/include/gnunet_signatures.h
+++ b/src/include/gnunet_signatures.h
@@ -182,9 +182,9 @@ extern "C"
#define GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN 26
/**
- * Signature for a GNUid Token Reference
+ * Signature for a GNUid Ticket
*/
-#define GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN_CODE 27
+#define GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET 27
#if 0 /* keep Emacsens' auto-indent happy */
{
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index ba18c5dfa9..0e7213b64d 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -464,15 +464,8 @@ schedule_httpd ()
}
if (NULL != httpd_task)
GNUNET_SCHEDULER_cancel (httpd_task);
- if ( (MHD_YES != haveto) &&
- (-1 == max))
- {
- /* daemon is idle, kill after timeout */
- httpd_task = GNUNET_SCHEDULER_add_delayed (MHD_CACHE_TIMEOUT,
- &kill_httpd_task,
- NULL);
- }
- else
+ if ( (MHD_YES == haveto) ||
+ (-1 != max))
{
httpd_task =
GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,