diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-12-04 17:10:54 +0100 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-12-04 17:10:54 +0100 |
commit | 02861d7594513ad336f86ff20162a861489f20b1 (patch) | |
tree | fc0012b8fe929db38815724c99b0a5455b38c752 /src | |
parent | f485d0399e8ef0c388a321bbad7ae424935752bc (diff) | |
download | gnunet-02861d7594513ad336f86ff20162a861489f20b1.tar.gz gnunet-02861d7594513ad336f86ff20162a861489f20b1.zip |
-fix
Diffstat (limited to 'src')
-rw-r--r-- | src/identity-attribute/identity_attribute.c | 6 | ||||
-rw-r--r-- | src/identity-attribute/plugin_identity_attribute_gnuid.c | 4 | ||||
-rw-r--r-- | src/identity-provider/gnunet-idp.c | 40 | ||||
-rw-r--r-- | src/include/gnunet_identity_attribute_lib.h | 4 |
4 files changed, 38 insertions, 16 deletions
diff --git a/src/identity-attribute/identity_attribute.c b/src/identity-attribute/identity_attribute.c index 05cdcdaf0..a8aae6ced 100644 --- a/src/identity-attribute/identity_attribute.c +++ b/src/identity-attribute/identity_attribute.c | |||
@@ -88,7 +88,7 @@ init() | |||
88 | if (GNUNET_YES == initialized) | 88 | if (GNUNET_YES == initialized) |
89 | return; | 89 | return; |
90 | initialized = GNUNET_YES; | 90 | initialized = GNUNET_YES; |
91 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_attribute_", NULL, | 91 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_identity_attribute_", NULL, |
92 | &add_plugin, NULL); | 92 | &add_plugin, NULL); |
93 | } | 93 | } |
94 | 94 | ||
@@ -151,7 +151,7 @@ GNUNET_IDENTITY_ATTRIBUTE_number_to_typename (uint32_t type) | |||
151 | * @return #GNUNET_OK on success | 151 | * @return #GNUNET_OK on success |
152 | */ | 152 | */ |
153 | int | 153 | int |
154 | GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type, | 154 | GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type, |
155 | const char *s, | 155 | const char *s, |
156 | void **data, | 156 | void **data, |
157 | size_t *data_size) | 157 | size_t *data_size) |
@@ -182,7 +182,7 @@ GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type, | |||
182 | * @return NULL on error, otherwise human-readable representation of the claim | 182 | * @return NULL on error, otherwise human-readable representation of the claim |
183 | */ | 183 | */ |
184 | char * | 184 | char * |
185 | GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (uint32_t type, | 185 | GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type, |
186 | const void* data, | 186 | const void* data, |
187 | size_t data_size) | 187 | size_t data_size) |
188 | { | 188 | { |
diff --git a/src/identity-attribute/plugin_identity_attribute_gnuid.c b/src/identity-attribute/plugin_identity_attribute_gnuid.c index ba460d0a5..0ff44d199 100644 --- a/src/identity-attribute/plugin_identity_attribute_gnuid.c +++ b/src/identity-attribute/plugin_identity_attribute_gnuid.c | |||
@@ -153,7 +153,7 @@ gnuid_number_to_typename (void *cls, | |||
153 | * @return the exported block API | 153 | * @return the exported block API |
154 | */ | 154 | */ |
155 | void * | 155 | void * |
156 | libgnunet_plugin_attribute_type_gnuid_init (void *cls) | 156 | libgnunet_plugin_identity_attribute_gnuid_init (void *cls) |
157 | { | 157 | { |
158 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api; | 158 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api; |
159 | 159 | ||
@@ -173,7 +173,7 @@ libgnunet_plugin_attribute_type_gnuid_init (void *cls) | |||
173 | * @return NULL | 173 | * @return NULL |
174 | */ | 174 | */ |
175 | void * | 175 | void * |
176 | libgnunet_plugin_attribute_type_gnuid_done (void *cls) | 176 | libgnunet_plugin_identity_attribute_gnuid_done (void *cls) |
177 | { | 177 | { |
178 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = cls; | 178 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = cls; |
179 | 179 | ||
diff --git a/src/identity-provider/gnunet-idp.c b/src/identity-provider/gnunet-idp.c index 78da1cb4d..62f07842b 100644 --- a/src/identity-provider/gnunet-idp.c +++ b/src/identity-provider/gnunet-idp.c | |||
@@ -67,6 +67,11 @@ static char* issue_attrs; | |||
67 | static char* consume_ticket; | 67 | static char* consume_ticket; |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Attribute type | ||
71 | */ | ||
72 | static char* type_str; | ||
73 | |||
74 | /** | ||
70 | * Ticket to revoke | 75 | * Ticket to revoke |
71 | */ | 76 | */ |
72 | static char* revoke_ticket; | 77 | static char* revoke_ticket; |
@@ -168,7 +173,7 @@ process_attrs (void *cls, | |||
168 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 173 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
169 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) | 174 | const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) |
170 | { | 175 | { |
171 | char *claim; | 176 | char *value_str; |
172 | if (NULL == identity) | 177 | if (NULL == identity) |
173 | { | 178 | { |
174 | GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 179 | GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
@@ -179,11 +184,11 @@ process_attrs (void *cls, | |||
179 | ret = 1; | 184 | ret = 1; |
180 | return; | 185 | return; |
181 | } | 186 | } |
182 | claim = GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (attr->type, | 187 | value_str = GNUNET_IDENTITY_ATTRIBUTE_value_to_string (attr->type, |
183 | attr->data, | 188 | attr->data, |
184 | attr->data_size); | 189 | attr->data_size); |
185 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 190 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
186 | "%s: %s\n", attr->name, claim); | 191 | "%s: %s\n", attr->name, value_str); |
187 | } | 192 | } |
188 | 193 | ||
189 | 194 | ||
@@ -211,7 +216,10 @@ process_rvk (void *cls, int success, const char* msg) | |||
211 | static void | 216 | static void |
212 | iter_finished (void *cls) | 217 | iter_finished (void *cls) |
213 | { | 218 | { |
214 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; | 219 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim; |
220 | char *data; | ||
221 | size_t data_size; | ||
222 | int type; | ||
215 | 223 | ||
216 | attr_iterator = NULL; | 224 | attr_iterator = NULL; |
217 | if (list) | 225 | if (list) |
@@ -248,13 +256,22 @@ iter_finished (void *cls) | |||
248 | NULL); | 256 | NULL); |
249 | return; | 257 | return; |
250 | } | 258 | } |
251 | attr = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name, | 259 | if (NULL == type_str) |
252 | GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING, | 260 | type = GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING; |
253 | attr_value, | 261 | else |
254 | strlen (attr_value) + 1); | 262 | type = GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (type_str); |
263 | |||
264 | GNUNET_assert (GNUNET_SYSERR != GNUNET_IDENTITY_ATTRIBUTE_string_to_value (type, | ||
265 | attr_value, | ||
266 | (void**)&data, | ||
267 | &data_size)); | ||
268 | claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name, | ||
269 | type, | ||
270 | data, | ||
271 | data_size); | ||
255 | idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (idp_handle, | 272 | idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (idp_handle, |
256 | pkey, | 273 | pkey, |
257 | attr, | 274 | claim, |
258 | &store_attr_cont, | 275 | &store_attr_cont, |
259 | NULL); | 276 | NULL); |
260 | 277 | ||
@@ -408,6 +425,11 @@ main(int argc, char *const argv[]) | |||
408 | NULL, | 425 | NULL, |
409 | gettext_noop ("Revoke a ticket"), | 426 | gettext_noop ("Revoke a ticket"), |
410 | &revoke_ticket), | 427 | &revoke_ticket), |
428 | GNUNET_GETOPT_option_string ('t', | ||
429 | "type", | ||
430 | NULL, | ||
431 | gettext_noop ("Type of attribute"), | ||
432 | &type_str), | ||
411 | GNUNET_GETOPT_OPTION_END | 433 | GNUNET_GETOPT_OPTION_END |
412 | }; | 434 | }; |
413 | GNUNET_PROGRAM_run (argc, argv, "ct", | 435 | GNUNET_PROGRAM_run (argc, argv, "ct", |
diff --git a/src/include/gnunet_identity_attribute_lib.h b/src/include/gnunet_identity_attribute_lib.h index 4e32c2ae1..a43b509da 100644 --- a/src/include/gnunet_identity_attribute_lib.h +++ b/src/include/gnunet_identity_attribute_lib.h | |||
@@ -233,7 +233,7 @@ GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (const char *typename); | |||
233 | * @return #GNUNET_OK on success | 233 | * @return #GNUNET_OK on success |
234 | */ | 234 | */ |
235 | int | 235 | int |
236 | GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type, | 236 | GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type, |
237 | const char *s, | 237 | const char *s, |
238 | void **data, | 238 | void **data, |
239 | size_t *data_size); | 239 | size_t *data_size); |
@@ -247,7 +247,7 @@ GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type, | |||
247 | * @return NULL on error, otherwise human-readable representation of the claim | 247 | * @return NULL on error, otherwise human-readable representation of the claim |
248 | */ | 248 | */ |
249 | char * | 249 | char * |
250 | GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (uint32_t type, | 250 | GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type, |
251 | const void* data, | 251 | const void* data, |
252 | size_t data_size); | 252 | size_t data_size); |
253 | 253 | ||