gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 23/171: -add simple test


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 23/171: -add simple test
Date: Thu, 04 Jan 2018 16:08:51 +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 3e958fd99a5adeec8245005e44c349dd5be1b082
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Dec 5 19:57:16 2016 +0100

    -add simple test
---
 src/credential/credential_api.c              |  9 ++++++---
 src/credential/gnunet-credential.c           | 11 +++++++++--
 src/credential/plugin_gnsrecord_credential.c |  2 +-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c
index 88f5f4e17..344bb6e63 100644
--- a/src/credential/credential_api.c
+++ b/src/credential/credential_api.c
@@ -369,7 +369,7 @@ GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle 
*handle,
   struct GNUNET_CREDENTIAL_Request *vr;
   size_t nlen;
 
-  if (NULL == issuer_attribute)
+  if (NULL == issuer_attribute || NULL == subject_attribute)
   {
     GNUNET_break (0);
     return NULL;
@@ -378,7 +378,7 @@ GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle 
*handle,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Trying to verify `%s' in CREDENTIAL\n",
        issuer_attribute);
-  nlen = strlen (issuer_attribute) + 1;
+  nlen = strlen (issuer_attribute) + 1 + strlen (subject_attribute) + 1;
   if (nlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (*vr))
   {
     GNUNET_break (0);
@@ -396,8 +396,11 @@ GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle 
*handle,
   v_msg->subject_key = *subject_key;
   v_msg->issuer_key =  *issuer_key;
   GNUNET_memcpy (&v_msg[1],
+                 issuer_attribute,
+                 strlen (issuer_attribute));
+  GNUNET_memcpy (((char*)&v_msg[1]) + strlen (issuer_attribute) + 1,
                  subject_attribute,
-                 nlen);
+                 strlen (subject_attribute));
   GNUNET_CONTAINER_DLL_insert (handle->verify_head,
                                handle->verify_tail,
                                vr);
diff --git a/src/credential/gnunet-credential.c 
b/src/credential/gnunet-credential.c
index 874aa29cb..a7b92447b 100644
--- a/src/credential/gnunet-credential.c
+++ b/src/credential/gnunet-credential.c
@@ -280,7 +280,14 @@ run (void *cls,
     {
       fprintf (stderr,
                _("Failed to connect to CREDENTIAL\n"));
-      return;
+      GNUNET_SCHEDULER_shutdown ();
+    }
+
+    if (NULL == issuer_attr || NULL == subject_credential)
+    {
+      fprintf (stderr,
+               _("You must provide issuer and subject attributes\n"));
+      GNUNET_SCHEDULER_shutdown ();
     }
 
 
@@ -334,7 +341,7 @@ main (int argc, char *const *argv)
     {'s', "subject", "PKEY",
       gettext_noop ("The public key of the subject to lookup the credential 
for"), 1,
       &GNUNET_GETOPT_set_string, &subject_key},
-    {'c', "credential", "CRED",
+    {'b', "credential", "CRED",
       gettext_noop ("The name of the credential presented by the subject"), 1,
       &GNUNET_GETOPT_set_string, &subject_credential},
     {'i', "issuer", "PKEY",
diff --git a/src/credential/plugin_gnsrecord_credential.c 
b/src/credential/plugin_gnsrecord_credential.c
index 67fd32e49..721e19fdb 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -136,7 +136,7 @@ credential_string_to_value (void *cls,
         char issuer_pkey[enclen + 1];
         char name[253 + 1];
 
-        if (5 != SSCANF (s,
+        if (3 != SSCANF (s,
                          "%52s %52s %253s",
                          subject_pkey,
                          issuer_pkey,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]