aboutsummaryrefslogtreecommitdiff
path: root/src/credential/plugin_rest_credential.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/credential/plugin_rest_credential.c')
-rw-r--r--src/credential/plugin_rest_credential.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/credential/plugin_rest_credential.c b/src/credential/plugin_rest_credential.c
index 798f76049..cdd0e86e9 100644
--- a/src/credential/plugin_rest_credential.c
+++ b/src/credential/plugin_rest_credential.c
@@ -190,8 +190,6 @@ attribute_delegation_to_json (struct GNUNET_CREDENTIAL_Delegation *delegation_ch
190{ 190{
191 char *subject; 191 char *subject;
192 char *issuer; 192 char *issuer;
193 char iss_attribute[delegation_chain_entry->issuer_attribute_len];
194 char sub_attribute[delegation_chain_entry->subject_attribute_len];
195 json_t *attr_obj; 193 json_t *attr_obj;
196 194
197 issuer = GNUNET_CRYPTO_ecdsa_public_key_to_string (&delegation_chain_entry->issuer_key); 195 issuer = GNUNET_CRYPTO_ecdsa_public_key_to_string (&delegation_chain_entry->issuer_key);
@@ -208,22 +206,16 @@ attribute_delegation_to_json (struct GNUNET_CREDENTIAL_Delegation *delegation_ch
208 return NULL; 206 return NULL;
209 } 207 }
210 attr_obj = json_object (); 208 attr_obj = json_object ();
211 memcpy (iss_attribute,
212 delegation_chain_entry->issuer_attribute,
213 delegation_chain_entry->issuer_attribute_len);
214 iss_attribute[delegation_chain_entry->issuer_attribute_len] = '\0';
215 209
216 json_object_set_new (attr_obj, "subject", json_string (subject)); 210 json_object_set_new (attr_obj, "subject", json_string (subject));
217 json_object_set_new (attr_obj, "issuer", json_string (issuer)); 211 json_object_set_new (attr_obj, "issuer", json_string (issuer));
218 json_object_set_new (attr_obj, "issuer_attribute", json_string (iss_attribute)); 212 json_object_set_new (attr_obj, "issuer_attribute",
213 json_string (delegation_chain_entry->issuer_attribute));
219 214
220 if (0 < delegation_chain_entry->subject_attribute_len) 215 if (0 < delegation_chain_entry->subject_attribute_len)
221 { 216 {
222 memcpy (sub_attribute, 217 json_object_set_new (attr_obj, "subject_attribute",
223 delegation_chain_entry->subject_attribute, 218 json_string (delegation_chain_entry->subject_attribute));
224 delegation_chain_entry->subject_attribute_len);
225 sub_attribute[delegation_chain_entry->subject_attribute_len] = '\0';
226 json_object_set_new (attr_obj, "subject_attribute", json_string (sub_attribute));
227 } 219 }
228 GNUNET_free (subject); 220 GNUNET_free (subject);
229 return attr_obj; 221 return attr_obj;