aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 76997918f..6e0fa5c4b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,7 +28,7 @@ if HAVE_EXPERIMENTAL
28endif 28endif
29 29
30if HAVE_REST 30if HAVE_REST
31 EXP_DIR += identity-token 31 EXP_DIR += identity-provider
32endif 32endif
33 33
34if BUILD_PULSE_HELPERS 34if BUILD_PULSE_HELPERS
diff --git a/src/identity-token/Makefile.am b/src/identity-provider/Makefile.am
index a9338ba59..a9338ba59 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 ad4aae78a..ad4aae78a 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 039d1c7e0..039d1c7e0 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 a9f210b14..a9f210b14 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 f29f6cdf3..f29f6cdf3 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 d2c1b6c5d..d2c1b6c5d 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 a23629b41..fd689490a 100644
--- a/src/identity/plugin_gnsrecord_identity.c
+++ b/src/identity/plugin_gnsrecord_identity.c
@@ -44,11 +44,31 @@ value_to_string (void *cls,
44 const void *data, 44 const void *data,
45 size_t data_size) 45 size_t data_size)
46{ 46{
47 const struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
48 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience_pubkey;
49 const char *scopes;
50 char *ecdhe_str;
51 char *aud_str;
52 char *result;
53
47 switch (type) 54 switch (type)
48 { 55 {
49 case GNUNET_GNSRECORD_TYPE_ID_ATTR: 56 case GNUNET_GNSRECORD_TYPE_ID_ATTR:
50 case GNUNET_GNSRECORD_TYPE_ID_TOKEN: 57 case GNUNET_GNSRECORD_TYPE_ID_TOKEN:
51 return GNUNET_strndup (data, data_size); 58 return GNUNET_strndup (data, data_size);
59 case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA:
60 ecdhe_privkey = data;
61 audience_pubkey = data+sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
62 scopes = (char*) audience_pubkey+(sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
63 ecdhe_str = GNUNET_STRINGS_data_to_string_alloc (ecdhe_privkey,
64 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
65 aud_str = GNUNET_STRINGS_data_to_string_alloc (audience_pubkey,
66 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
67 GNUNET_asprintf (&result,
68 "%s;%s;%s",
69 ecdhe_str, aud_str, scopes);
70 return result;
71
52 default: 72 default:
53 return NULL; 73 return NULL;
54 } 74 }
@@ -73,6 +93,12 @@ string_to_value (void *cls,
73 void **data, 93 void **data,
74 size_t *data_size) 94 size_t *data_size)
75{ 95{
96 char* ecdhe_str;
97 char* aud_keystr;
98 char* write_ptr;
99 char* tmp_tok;
100 char* str;
101
76 if (NULL == s) 102 if (NULL == s)
77 return GNUNET_SYSERR; 103 return GNUNET_SYSERR;
78 switch (type) 104 switch (type)
@@ -82,6 +108,46 @@ string_to_value (void *cls,
82 *data = GNUNET_strdup (s); 108 *data = GNUNET_strdup (s);
83 *data_size = strlen (s); 109 *data_size = strlen (s);
84 return GNUNET_OK; 110 return GNUNET_OK;
111 case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA:
112 tmp_tok = GNUNET_strdup (s);
113 ecdhe_str = strtok (tmp_tok, ";");
114 if (NULL == ecdhe_str)
115 {
116 GNUNET_free (tmp_tok);
117 return GNUNET_SYSERR;
118 }
119 aud_keystr = strtok (NULL, ";");
120 if (NULL == aud_keystr)
121 {
122 GNUNET_free (tmp_tok);
123 return GNUNET_SYSERR;
124 }
125 str = strtok (NULL, ";");
126 if (NULL == str)
127 {
128 GNUNET_free (tmp_tok);
129 return GNUNET_SYSERR;
130 }
131 *data_size = strlen (str) + 1
132 +sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)
133 +sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
134 *data = GNUNET_malloc (*data_size);
135
136 write_ptr = *data;
137 GNUNET_STRINGS_string_to_data (ecdhe_str,
138 strlen (ecdhe_str),
139 write_ptr,
140 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
141 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
142 GNUNET_STRINGS_string_to_data (aud_keystr,
143 strlen (aud_keystr),
144 write_ptr,
145 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
146 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
147 memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator
148 GNUNET_free (tmp_tok);
149 return GNUNET_OK;
150
85 default: 151 default:
86 return GNUNET_SYSERR; 152 return GNUNET_SYSERR;
87 } 153 }
@@ -92,14 +158,15 @@ string_to_value (void *cls,
92 * Mapping of record type numbers to human-readable 158 * Mapping of record type numbers to human-readable
93 * record type names. 159 * record type names.
94 */ 160 */
95static struct { 161 static struct {
96 const char *name; 162 const char *name;
97 uint32_t number; 163 uint32_t number;
98} name_map[] = { 164 } name_map[] = {
99 { "ID_ATTR", GNUNET_GNSRECORD_TYPE_ID_ATTR }, 165 { "ID_ATTR", GNUNET_GNSRECORD_TYPE_ID_ATTR },
100 { "ID_TOKEN", GNUNET_GNSRECORD_TYPE_ID_TOKEN }, 166 { "ID_TOKEN", GNUNET_GNSRECORD_TYPE_ID_TOKEN },
101 { NULL, UINT32_MAX } 167 { "ID_TOKEN_METADATA", GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA },
102}; 168 { NULL, UINT32_MAX }
169 };
103 170
104 171
105/** 172/**
diff --git a/src/identity-token/identity-token.h b/src/include/gnunet_identity_provider_lib.h
index 6e41a009d..6e41a009d 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 dd6afbec5..95d570b54 100644
--- a/src/include/gnunet_signatures.h
+++ b/src/include/gnunet_signatures.h
@@ -182,9 +182,9 @@ extern "C"
182#define GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN 26 182#define GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN 26
183 183
184/** 184/**
185 * Signature for a GNUid Token Reference 185 * Signature for a GNUid Ticket
186 */ 186 */
187#define GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN_CODE 27 187#define GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET 27
188 188
189#if 0 /* keep Emacsens' auto-indent happy */ 189#if 0 /* keep Emacsens' auto-indent happy */
190{ 190{
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index ba18c5dfa..0e7213b64 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -464,15 +464,8 @@ schedule_httpd ()
464 } 464 }
465 if (NULL != httpd_task) 465 if (NULL != httpd_task)
466 GNUNET_SCHEDULER_cancel (httpd_task); 466 GNUNET_SCHEDULER_cancel (httpd_task);
467 if ( (MHD_YES != haveto) && 467 if ( (MHD_YES == haveto) ||
468 (-1 == max)) 468 (-1 != max))
469 {
470 /* daemon is idle, kill after timeout */
471 httpd_task = GNUNET_SCHEDULER_add_delayed (MHD_CACHE_TIMEOUT,
472 &kill_httpd_task,
473 NULL);
474 }
475 else
476 { 469 {
477 httpd_task = 470 httpd_task =
478 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 471 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,