aboutsummaryrefslogtreecommitdiff
path: root/src/credential
diff options
context:
space:
mode:
Diffstat (limited to 'src/credential')
-rw-r--r--src/credential/credential.conf.in4
-rw-r--r--src/credential/credential.h18
-rw-r--r--src/credential/credential_api.c18
-rw-r--r--src/credential/credential_misc.c18
-rw-r--r--src/credential/credential_misc.h18
-rw-r--r--src/credential/credential_serialization.c18
-rw-r--r--src/credential/credential_serialization.h18
-rw-r--r--src/credential/gnunet-credential.c18
-rw-r--r--src/credential/gnunet-service-credential.c66
-rw-r--r--src/credential/plugin_gnsrecord_credential.c28
-rw-r--r--src/credential/plugin_rest_credential.c54
-rw-r--r--src/credential/test_credential_defaults.conf4
-rw-r--r--src/credential/test_credential_lookup.conf12
13 files changed, 139 insertions, 155 deletions
diff --git a/src/credential/credential.conf.in b/src/credential/credential.conf.in
index 71f3066ca..d5a0b1c88 100644
--- a/src/credential/credential.conf.in
+++ b/src/credential/credential.conf.in
@@ -1,5 +1,5 @@
1[credential] 1[credential]
2BINARY = gnunet-service-credential 2BINARY = gnunet-service-credential
3UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-credential.sock 3UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-credential.sock
4USER_SERVICE = YES 4RUN_PER_USER = YES
5OPTIONS = -L DEBUG \ No newline at end of file 5OPTIONS = -L DEBUG
diff --git a/src/credential/credential.h b/src/credential/credential.h
index 66a4636fc..dbb73d3f6 100644
--- a/src/credential/credential.h
+++ b/src/credential/credential.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2012-2013 GNUnet e.V. 3 Copyright (C) 2012-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */ 17 */
20/** 18/**
21 * @file credential/credential.h 19 * @file credential/credential.h
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c
index 677cb9ad4..0c4105085 100644
--- a/src/credential/credential_api.c
+++ b/src/credential/credential_api.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file credential/credential_api.c 19 * @file credential/credential_api.c
diff --git a/src/credential/credential_misc.c b/src/credential/credential_misc.c
index 2575f1de8..ce22e8d17 100644
--- a/src/credential/credential_misc.c
+++ b/src/credential/credential_misc.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21 19
diff --git a/src/credential/credential_misc.h b/src/credential/credential_misc.h
index c3aa8c214..236e8913d 100644
--- a/src/credential/credential_misc.h
+++ b/src/credential/credential_misc.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2012-2013 GNUnet e.V. 3 Copyright (C) 2012-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */ 17 */
20/** 18/**
21 * @file credential/credential_misc.h 19 * @file credential/credential_misc.h
diff --git a/src/credential/credential_serialization.c b/src/credential/credential_serialization.c
index 2bbf3bfb8..fc5ef4304 100644
--- a/src/credential/credential_serialization.c
+++ b/src/credential/credential_serialization.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21 19
diff --git a/src/credential/credential_serialization.h b/src/credential/credential_serialization.h
index b870d47dc..15dc81967 100644
--- a/src/credential/credential_serialization.h
+++ b/src/credential/credential_serialization.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21 19
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c
index b5bcc4d43..0f4fdbd77 100644
--- a/src/credential/gnunet-credential.c
+++ b/src/credential/gnunet-credential.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012-2013 GNUnet e.V. 3 Copyright (C) 2012-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gnunet-credential.c 19 * @file gnunet-credential.c
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c
index 399371a2e..a6468c47e 100644
--- a/src/credential/gnunet-service-credential.c
+++ b/src/credential/gnunet-service-credential.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2011-2013 GNUnet e.V. 3 Copyright (C) 2011-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file credential/gnunet-service-credential.c 19 * @file credential/gnunet-service-credential.c
@@ -61,17 +59,17 @@ struct DelegationChainEntry
61 * The issuer 59 * The issuer
62 */ 60 */
63 struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key; 61 struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
64 62
65 /** 63 /**
66 * The subject 64 * The subject
67 */ 65 */
68 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key; 66 struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
69 67
70 /** 68 /**
71 * The issued attribute 69 * The issued attribute
72 */ 70 */
73 char *issuer_attribute; 71 char *issuer_attribute;
74 72
75 /** 73 /**
76 * The delegated attribute 74 * The delegated attribute
77 */ 75 */
@@ -92,7 +90,7 @@ struct CredentialRecordEntry
92 * DLL 90 * DLL
93 */ 91 */
94 struct CredentialRecordEntry *prev; 92 struct CredentialRecordEntry *prev;
95 93
96 /** 94 /**
97 * Number of references in delegation chains 95 * Number of references in delegation chains
98 */ 96 */
@@ -409,7 +407,7 @@ cleanup_handle (struct VerifyRequestHandle *vrh)
409 } 407 }
410 cleanup_delegation_set (vrh->root_set); 408 cleanup_delegation_set (vrh->root_set);
411 GNUNET_free_non_null (vrh->issuer_attribute); 409 GNUNET_free_non_null (vrh->issuer_attribute);
412 for (cr_entry = vrh->cred_chain_head; 410 for (cr_entry = vrh->cred_chain_head;
413 NULL != vrh->cred_chain_head; 411 NULL != vrh->cred_chain_head;
414 cr_entry = vrh->cred_chain_head) 412 cr_entry = vrh->cred_chain_head)
415 { 413 {
@@ -543,7 +541,7 @@ send_lookup_response (struct VerifyRequestHandle *vrh)
543 else 541 else
544 rmsg->cred_found = htonl (GNUNET_NO); 542 rmsg->cred_found = htonl (GNUNET_NO);
545 543
546 GNUNET_assert (-1 != 544 GNUNET_assert (-1 !=
547 GNUNET_CREDENTIAL_delegation_chain_serialize (vrh->delegation_chain_size, 545 GNUNET_CREDENTIAL_delegation_chain_serialize (vrh->delegation_chain_size,
548 dd, 546 dd,
549 vrh->cred_chain_size, 547 vrh->cred_chain_size,
@@ -587,7 +585,7 @@ backward_resolution (void* cls,
587 "Got %d attrs\n", rd_count); 585 "Got %d attrs\n", rd_count);
588 586
589 // Each OR 587 // Each OR
590 for (uint32_t i=0; i < rd_count; i++) 588 for (uint32_t i=0; i < rd_count; i++)
591 { 589 {
592 if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type) 590 if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type)
593 continue; 591 continue;
@@ -665,10 +663,10 @@ backward_resolution (void* cls,
665 /** 663 /**
666 * Check if this delegation already matches one of our credentials 664 * Check if this delegation already matches one of our credentials
667 */ 665 */
668 for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL; 666 for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL;
669 cred_pointer = cred_pointer->next) 667 cred_pointer = cred_pointer->next)
670 { 668 {
671 if(0 != memcmp (&set->subject_key, 669 if(0 != memcmp (&set->subject_key,
672 &cred_pointer->credential->issuer_key, 670 &cred_pointer->credential->issuer_key,
673 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) 671 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
674 continue; 672 continue;
@@ -769,7 +767,7 @@ backward_resolution (void* cls,
769 return; 767 return;
770 768
771 } 769 }
772} 770}
773 771
774 772
775/** 773/**
@@ -809,7 +807,7 @@ delegation_chain_resolution_start (void* cls)
809 } 807 }
810 808
811 /** 809 /**
812 * Check for attributes from the issuer and follow the chain 810 * Check for attributes from the issuer and follow the chain
813 * till you get the required subject's attributes 811 * till you get the required subject's attributes
814 */ 812 */
815 char issuer_attribute_name[strlen (vrh->issuer_attribute) + strlen (".gnu") + 1]; 813 char issuer_attribute_name[strlen (vrh->issuer_attribute) + strlen (".gnu") + 1];
@@ -821,9 +819,9 @@ delegation_chain_resolution_start (void* cls)
821 "Looking up %s\n", issuer_attribute_name); 819 "Looking up %s\n", issuer_attribute_name);
822 ds_entry = GNUNET_new (struct DelegationSetQueueEntry); 820 ds_entry = GNUNET_new (struct DelegationSetQueueEntry);
823 ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); 821 ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
824 memcpy (ds_entry->issuer_key, 822 GNUNET_memcpy (ds_entry->issuer_key,
825 &vrh->issuer_key, 823 &vrh->issuer_key,
826 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); 824 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
827 ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute); 825 ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute);
828 ds_entry->handle = vrh; 826 ds_entry->handle = vrh;
829 ds_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute); 827 ds_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute);
@@ -869,7 +867,7 @@ check_verify (void *cls,
869 867
870static void 868static void
871handle_verify (void *cls, 869handle_verify (void *cls,
872 const struct VerifyMessage *v_msg) 870 const struct VerifyMessage *v_msg)
873{ 871{
874 struct VerifyRequestHandle *vrh; 872 struct VerifyRequestHandle *vrh;
875 struct GNUNET_SERVICE_Client *client = cls; 873 struct GNUNET_SERVICE_Client *client = cls;
@@ -886,7 +884,9 @@ handle_verify (void *cls,
886 "Received VERIFY message\n"); 884 "Received VERIFY message\n");
887 utf_in = (const char *) &v_msg[1]; 885 utf_in = (const char *) &v_msg[1];
888 GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); 886 GNUNET_STRINGS_utf8_tolower (utf_in, attrptr);
889 GNUNET_memcpy (issuer_attribute, attr, ntohs (v_msg->issuer_attribute_len)); 887 GNUNET_memcpy (issuer_attribute,
888 attr,
889 ntohs (v_msg->issuer_attribute_len));
890 issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0'; 890 issuer_attribute[ntohs (v_msg->issuer_attribute_len)] = '\0';
891 vrh = GNUNET_new (struct VerifyRequestHandle); 891 vrh = GNUNET_new (struct VerifyRequestHandle);
892 GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); 892 GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh);
@@ -897,7 +897,7 @@ handle_verify (void *cls,
897 vrh->issuer_attribute = GNUNET_strdup (issuer_attribute); 897 vrh->issuer_attribute = GNUNET_strdup (issuer_attribute);
898 if (0 == strlen (issuer_attribute)) 898 if (0 == strlen (issuer_attribute))
899 { 899 {
900 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 900 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
901 "No issuer attribute provided!\n"); 901 "No issuer attribute provided!\n");
902 send_lookup_response (vrh); 902 send_lookup_response (vrh);
903 return; 903 return;
@@ -907,7 +907,7 @@ handle_verify (void *cls,
907 * TODO: cleanup! 907 * TODO: cleanup!
908 */ 908 */
909 credentials_count = ntohl(v_msg->c_count); 909 credentials_count = ntohl(v_msg->c_count);
910 credential_data_size = ntohs (v_msg->header.size) 910 credential_data_size = ntohs (v_msg->header.size)
911 - sizeof (struct VerifyMessage) 911 - sizeof (struct VerifyMessage)
912 - ntohs (v_msg->issuer_attribute_len) 912 - ntohs (v_msg->issuer_attribute_len)
913 - 1; 913 - 1;
@@ -918,7 +918,7 @@ handle_verify (void *cls,
918 credentials_count, 918 credentials_count,
919 credentials)) 919 credentials))
920 { 920 {
921 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 921 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
922 "Cannot deserialize credentials!\n"); 922 "Cannot deserialize credentials!\n");
923 send_lookup_response (vrh); 923 send_lookup_response (vrh);
924 return; 924 return;
@@ -1015,7 +1015,7 @@ handle_cred_collection_finished_cb (void *cls)
1015 1015
1016static void 1016static void
1017handle_collect (void *cls, 1017handle_collect (void *cls,
1018 const struct CollectMessage *c_msg) 1018 const struct CollectMessage *c_msg)
1019{ 1019{
1020 char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; 1020 char attr[GNUNET_CREDENTIAL_MAX_LENGTH + 1];
1021 char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1]; 1021 char issuer_attribute[GNUNET_CREDENTIAL_MAX_LENGTH + 1];
@@ -1030,7 +1030,9 @@ handle_collect (void *cls,
1030 utf_in = (const char *) &c_msg[1]; 1030 utf_in = (const char *) &c_msg[1];
1031 GNUNET_STRINGS_utf8_tolower (utf_in, attrptr); 1031 GNUNET_STRINGS_utf8_tolower (utf_in, attrptr);
1032 1032
1033 GNUNET_memcpy (issuer_attribute, attr, ntohs (c_msg->issuer_attribute_len)); 1033 GNUNET_memcpy (issuer_attribute,
1034 attr,
1035 ntohs (c_msg->issuer_attribute_len));
1034 issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0'; 1036 issuer_attribute[ntohs (c_msg->issuer_attribute_len)] = '\0';
1035 vrh = GNUNET_new (struct VerifyRequestHandle); 1037 vrh = GNUNET_new (struct VerifyRequestHandle);
1036 GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh); 1038 GNUNET_CONTAINER_DLL_insert (vrh_head, vrh_tail, vrh);
@@ -1043,7 +1045,7 @@ handle_collect (void *cls,
1043 1045
1044 if (0 == strlen (issuer_attribute)) 1046 if (0 == strlen (issuer_attribute))
1045 { 1047 {
1046 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1048 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1047 "No issuer attribute provided!\n"); 1049 "No issuer attribute provided!\n");
1048 send_lookup_response (vrh); 1050 send_lookup_response (vrh);
1049 return; 1051 return;
diff --git a/src/credential/plugin_gnsrecord_credential.c b/src/credential/plugin_gnsrecord_credential.c
index ffb2857dc..72f174fca 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2013 GNUnet e.V. 3 Copyright (C) 2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
@@ -62,9 +60,9 @@ credential_value_to_string (void *cls,
62 int i; 60 int i;
63 if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecord)) 61 if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecord))
64 return NULL; /* malformed */ 62 return NULL; /* malformed */
65 memcpy (&sets, 63 GNUNET_memcpy (&sets,
66 data, 64 data,
67 sizeof (sets)); 65 sizeof (sets));
68 cdata = data; 66 cdata = data;
69 struct GNUNET_CREDENTIAL_DelegationSet set[ntohl(sets.set_count)]; 67 struct GNUNET_CREDENTIAL_DelegationSet set[ntohl(sets.set_count)];
70 if (GNUNET_OK != GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll (sets.data_size), 68 if (GNUNET_OK != GNUNET_CREDENTIAL_delegation_set_deserialize (GNUNET_ntohll (sets.data_size),
@@ -224,7 +222,7 @@ credential_string_to_value (void *cls,
224 } 222 }
225 tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries, 223 tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries,
226 set); 224 set);
227 225
228 if (-1 == tmp_data_size) 226 if (-1 == tmp_data_size)
229 { 227 {
230 GNUNET_free (tmp_str); 228 GNUNET_free (tmp_str);
@@ -248,7 +246,7 @@ credential_string_to_value (void *cls,
248 return GNUNET_OK; 246 return GNUNET_OK;
249 } 247 }
250 case GNUNET_GNSRECORD_TYPE_CREDENTIAL: 248 case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
251 { 249 {
252 struct GNUNET_CREDENTIAL_Credential *cred; 250 struct GNUNET_CREDENTIAL_Credential *cred;
253 cred = GNUNET_CREDENTIAL_credential_from_string (s); 251 cred = GNUNET_CREDENTIAL_credential_from_string (s);
254 252
diff --git a/src/credential/plugin_rest_credential.c b/src/credential/plugin_rest_credential.c
index 2e43139de..253378dfc 100644
--- a/src/credential/plugin_rest_credential.c
+++ b/src/credential/plugin_rest_credential.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012-2016 GNUnet e.V. 3 Copyright (C) 2012-2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */ 17 */
20/** 18/**
21 * @author Martin Schanzenbach 19 * @author Martin Schanzenbach
@@ -309,14 +307,14 @@ json_to_credential (json_t *res)
309 sig, 307 sig,
310 sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); 308 sizeof (struct GNUNET_CRYPTO_EcdsaSignature));
311 GNUNET_free (sig); 309 GNUNET_free (sig);
312 310
313 tmp = json_object_get (res, "expiration"); 311 tmp = json_object_get (res, "expiration");
314 if (0 == json_is_integer (tmp)) 312 if (0 == json_is_integer (tmp))
315 { 313 {
316 GNUNET_free (cred); 314 GNUNET_free (cred);
317 return NULL; 315 return NULL;
318 } 316 }
319 cred->expiration.abs_value_us = json_integer_value (tmp); 317 cred->expiration.abs_value_us = json_integer_value (tmp);
320 return cred; 318 return cred;
321} 319}
322 320
@@ -342,7 +340,7 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred)
342 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
343 "Issuer in credential malformed\n"); 341 "Issuer in credential malformed\n");
344 return NULL; 342 return NULL;
345 } 343 }
346 subject = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key); 344 subject = GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key);
347 if (NULL == subject) 345 if (NULL == subject)
348 { 346 {
@@ -354,9 +352,9 @@ credential_to_json (struct GNUNET_CREDENTIAL_Credential *cred)
354 GNUNET_STRINGS_base64_encode ((char*)&cred->signature, 352 GNUNET_STRINGS_base64_encode ((char*)&cred->signature,
355 sizeof (struct GNUNET_CRYPTO_EcdsaSignature), 353 sizeof (struct GNUNET_CRYPTO_EcdsaSignature),
356 &signature); 354 &signature);
357 memcpy (attribute, 355 GNUNET_memcpy (attribute,
358 cred->issuer_attribute, 356 cred->issuer_attribute,
359 cred->issuer_attribute_len); 357 cred->issuer_attribute_len);
360 attribute[cred->issuer_attribute_len] = '\0'; 358 attribute[cred->issuer_attribute_len] = '\0';
361 cred_obj = json_object (); 359 cred_obj = json_object ();
362 json_object_set_new (cred_obj, "issuer", json_string (issuer)); 360 json_object_set_new (cred_obj, "issuer", json_string (issuer));
@@ -570,7 +568,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
570 { 568 {
571 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 569 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
572 "Missing issuer attribute\n"); 570 "Missing issuer attribute\n");
573 GNUNET_SCHEDULER_add_now (&do_error, handle); 571 GNUNET_SCHEDULER_add_now (&do_error, handle);
574 return; 572 return;
575 } 573 }
576 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, 574 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
@@ -585,7 +583,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
585 GNUNET_SCHEDULER_add_now (&do_error, handle); 583 GNUNET_SCHEDULER_add_now (&do_error, handle);
586 return; 584 return;
587 } 585 }
588 if (GNUNET_OK != 586 if (GNUNET_OK !=
589 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, 587 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp,
590 strlen (tmp), 588 strlen (tmp),
591 &handle->issuer_key)) 589 &handle->issuer_key))
@@ -626,7 +624,7 @@ collect_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
626 { 624 {
627 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 625 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
628 "Malformed subject\n"); 626 "Malformed subject\n");
629 GNUNET_SCHEDULER_add_now (&do_error, handle); 627 GNUNET_SCHEDULER_add_now (&do_error, handle);
630 return; 628 return;
631 } 629 }
632 handle->ego_lookup = GNUNET_IDENTITY_ego_lookup (cfg, 630 handle->ego_lookup = GNUNET_IDENTITY_ego_lookup (cfg,
@@ -679,7 +677,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
679 { 677 {
680 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 678 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
681 "Missing issuer attribute\n"); 679 "Missing issuer attribute\n");
682 GNUNET_SCHEDULER_add_now (&do_error, handle); 680 GNUNET_SCHEDULER_add_now (&do_error, handle);
683 return; 681 return;
684 } 682 }
685 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, 683 tmp = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
@@ -694,7 +692,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
694 GNUNET_SCHEDULER_add_now (&do_error, handle); 692 GNUNET_SCHEDULER_add_now (&do_error, handle);
695 return; 693 return;
696 } 694 }
697 if (GNUNET_OK != 695 if (GNUNET_OK !=
698 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp, 696 GNUNET_CRYPTO_ecdsa_public_key_from_string (tmp,
699 strlen (tmp), 697 strlen (tmp),
700 &handle->issuer_key)) 698 &handle->issuer_key))
@@ -735,7 +733,7 @@ verify_cred_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
735 { 733 {
736 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 734 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
737 "Malformed subject\n"); 735 "Malformed subject\n");
738 GNUNET_SCHEDULER_add_now (&do_error, handle); 736 GNUNET_SCHEDULER_add_now (&do_error, handle);
739 return; 737 return;
740 } 738 }
741 if (GNUNET_OK != 739 if (GNUNET_OK !=
@@ -946,7 +944,7 @@ get_cred_issuer_cb (void *cls,
946 { 944 {
947 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 945 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
948 "Missing expiration\n"); 946 "Missing expiration\n");
949 GNUNET_SCHEDULER_add_now (&do_error, handle); 947 GNUNET_SCHEDULER_add_now (&do_error, handle);
950 return; 948 return;
951 } 949 }
952 expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, 950 expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map,
@@ -955,7 +953,7 @@ get_cred_issuer_cb (void *cls,
955 { 953 {
956 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 954 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
957 "Expiration malformed\n"); 955 "Expiration malformed\n");
958 GNUNET_SCHEDULER_add_now (&do_error, handle); 956 GNUNET_SCHEDULER_add_now (&do_error, handle);
959 return; 957 return;
960 } 958 }
961 959
@@ -968,7 +966,7 @@ get_cred_issuer_cb (void *cls,
968 { 966 {
969 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 967 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
970 "Malformed expiration: %s\n", expiration_str); 968 "Malformed expiration: %s\n", expiration_str);
971 GNUNET_SCHEDULER_add_now (&do_error, handle); 969 GNUNET_SCHEDULER_add_now (&do_error, handle);
972 return; 970 return;
973 } 971 }
974 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_ISSUER_ATTR, 972 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_ISSUER_ATTR,
@@ -980,10 +978,10 @@ get_cred_issuer_cb (void *cls,
980 { 978 {
981 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 979 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
982 "Missing issuer attribute\n"); 980 "Missing issuer attribute\n");
983 GNUNET_SCHEDULER_add_now (&do_error, handle); 981 GNUNET_SCHEDULER_add_now (&do_error, handle);
984 return; 982 return;
985 } 983 }
986 handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get 984 handle->issuer_attr = GNUNET_strdup(GNUNET_CONTAINER_multihashmap_get
987 (handle->rest_handle->url_param_map, 985 (handle->rest_handle->url_param_map,
988 &key)); 986 &key));
989 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_SUBJECT_KEY, 987 GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_CREDENTIAL_SUBJECT_KEY,
@@ -1004,7 +1002,7 @@ get_cred_issuer_cb (void *cls,
1004 { 1002 {
1005 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1003 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1006 "Malformed subject\n"); 1004 "Malformed subject\n");
1007 GNUNET_SCHEDULER_add_now (&do_error, handle); 1005 GNUNET_SCHEDULER_add_now (&do_error, handle);
1008 return; 1006 return;
1009 } 1007 }
1010 if (GNUNET_OK != 1008 if (GNUNET_OK !=
diff --git a/src/credential/test_credential_defaults.conf b/src/credential/test_credential_defaults.conf
index d157ddd43..39f82ad16 100644
--- a/src/credential/test_credential_defaults.conf
+++ b/src/credential/test_credential_defaults.conf
@@ -1,7 +1,7 @@
1@INLINE@ ../../contrib/no_forcestart.conf 1@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf
2 2
3[PATHS] 3[PATHS]
4GNUNET_TEST_HOME = /tmp/test-gnunet-credential-testing/ 4GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-credential-testing/
5 5
6[namestore-sqlite] 6[namestore-sqlite]
7FILENAME = $GNUNET_TEST_HOME/namestore/sqlite_test.db 7FILENAME = $GNUNET_TEST_HOME/namestore/sqlite_test.db
diff --git a/src/credential/test_credential_lookup.conf b/src/credential/test_credential_lookup.conf
index 3684063b1..39f68c944 100644
--- a/src/credential/test_credential_lookup.conf
+++ b/src/credential/test_credential_lookup.conf
@@ -1,24 +1,24 @@
1@INLINE@ test_credential_defaults.conf 1@INLINE@ test_credential_defaults.conf
2 2
3[PATHS] 3[PATHS]
4GNUNET_TEST_HOME = /tmp/test-gnunet-credential-peer-1/ 4GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-credential-peer-1/
5 5
6[dht] 6[dht]
7AUTOSTART = YES 7START_ON_DEMAND = YES
8 8
9[transport] 9[transport]
10PLUGINS = 10PLUGINS =
11 11
12[credential] 12[credential]
13AUTOSTART = YES 13START_ON_DEMAND = YES
14PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/credlog 14PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/credlog
15 15
16[rest] 16[rest]
17PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/restlog 17PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/restlog
18 18
19[gns] 19[gns]
20#PREFIX = valgrind --leak-check=full --track-origins=yes 20#PREFIX = valgrind --leak-check=full --track-origins=yes
21AUTOSTART = YES 21START_ON_DEMAND = YES
22AUTO_IMPORT_PKEY = YES 22AUTO_IMPORT_PKEY = YES
23MAX_PARALLEL_BACKGROUND_QUERIES = 10 23MAX_PARALLEL_BACKGROUND_QUERIES = 10
24DEFAULT_LOOKUP_TIMEOUT = 15 s 24DEFAULT_LOOKUP_TIMEOUT = 15 s