[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 161/171: -fix
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 161/171: -fix |
Date: |
Thu, 04 Jan 2018 16:11:09 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 02861d7594513ad336f86ff20162a861489f20b1
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Dec 4 17:10:54 2017 +0100
-fix
---
src/identity-attribute/identity_attribute.c | 6 ++--
.../plugin_identity_attribute_gnuid.c | 4 +--
src/identity-provider/gnunet-idp.c | 40 +++++++++++++++++-----
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()
if (GNUNET_YES == initialized)
return;
initialized = GNUNET_YES;
- GNUNET_PLUGIN_load_all ("libgnunet_plugin_attribute_", NULL,
+ GNUNET_PLUGIN_load_all ("libgnunet_plugin_identity_attribute_", NULL,
&add_plugin, NULL);
}
@@ -151,7 +151,7 @@ GNUNET_IDENTITY_ATTRIBUTE_number_to_typename (uint32_t type)
* @return #GNUNET_OK on success
*/
int
-GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type,
const char *s,
void **data,
size_t *data_size)
@@ -182,7 +182,7 @@ GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type,
* @return NULL on error, otherwise human-readable representation of the claim
*/
char *
-GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type,
const void* data,
size_t data_size)
{
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,
* @return the exported block API
*/
void *
-libgnunet_plugin_attribute_type_gnuid_init (void *cls)
+libgnunet_plugin_identity_attribute_gnuid_init (void *cls)
{
struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api;
@@ -173,7 +173,7 @@ libgnunet_plugin_attribute_type_gnuid_init (void *cls)
* @return NULL
*/
void *
-libgnunet_plugin_attribute_type_gnuid_done (void *cls)
+libgnunet_plugin_identity_attribute_gnuid_done (void *cls)
{
struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = cls;
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;
static char* consume_ticket;
/**
+ * Attribute type
+ */
+static char* type_str;
+
+/**
* Ticket to revoke
*/
static char* revoke_ticket;
@@ -168,7 +173,7 @@ process_attrs (void *cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr)
{
- char *claim;
+ char *value_str;
if (NULL == identity)
{
GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
@@ -179,11 +184,11 @@ process_attrs (void *cls,
ret = 1;
return;
}
- claim = GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (attr->type,
+ value_str = GNUNET_IDENTITY_ATTRIBUTE_value_to_string (attr->type,
attr->data,
attr->data_size);
GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- "%s: %s\n", attr->name, claim);
+ "%s: %s\n", attr->name, value_str);
}
@@ -211,7 +216,10 @@ process_rvk (void *cls, int success, const char* msg)
static void
iter_finished (void *cls)
{
- struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr;
+ struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim;
+ char *data;
+ size_t data_size;
+ int type;
attr_iterator = NULL;
if (list)
@@ -248,13 +256,22 @@ iter_finished (void *cls)
NULL);
return;
}
- attr = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name,
-
GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING,
- attr_value,
- strlen (attr_value) + 1);
+ if (NULL == type_str)
+ type = GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING;
+ else
+ type = GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (type_str);
+
+ GNUNET_assert (GNUNET_SYSERR != GNUNET_IDENTITY_ATTRIBUTE_string_to_value
(type,
+ attr_value,
+ (void**)&data,
+ &data_size));
+ claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name,
+ type,
+ data,
+ data_size);
idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (idp_handle,
pkey,
- attr,
+ claim,
&store_attr_cont,
NULL);
@@ -408,6 +425,11 @@ main(int argc, char *const argv[])
NULL,
gettext_noop ("Revoke a ticket"),
&revoke_ticket),
+ GNUNET_GETOPT_option_string ('t',
+ "type",
+ NULL,
+ gettext_noop ("Type of attribute"),
+ &type_str),
GNUNET_GETOPT_OPTION_END
};
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);
* @return #GNUNET_OK on success
*/
int
-GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type,
const char *s,
void **data,
size_t *data_size);
@@ -247,7 +247,7 @@ GNUNET_IDENTITY_ATTRIBUTE_string_to_claim (uint32_t type,
* @return NULL on error, otherwise human-readable representation of the claim
*/
char *
-GNUNET_IDENTITY_ATTRIBUTE_claim_to_string (uint32_t type,
+GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type,
const void* data,
size_t data_size);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 150/171: -add dockerfile, (continued)
- [GNUnet-SVN] [gnunet] 150/171: -add dockerfile, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 159/171: Merge remote-tracking branch 'origin/master' into identity_abe, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 164/171: Merge remote-tracking branch 'origin/master' into identity_abe, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 166/171: -move idp experimental, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 168/171: -move abe functionality out of util; prepare for release, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 156/171: -add stats, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 126/171: -remove deprecated, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 154/171: -fixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 152/171: -add docker entrypoint, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 129/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 161/171: -fix,
gnunet <=
- [GNUnet-SVN] [gnunet] 162/171: -start jwt, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 118/171: -minor fixed, start consume, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 141/171: -add attribute store API, fixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 139/171: -add ticket listing for rest, bugfixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 147/171: -add consume rest api, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 167/171: -merge, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 145/171: -bugfixes, fix memleaks, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 143/171: -improve revocation handling, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 160/171: -fix makefile, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 146/171: -add tests, gnunet, 2018/01/04