gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 36/171: -fix


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 36/171: -fix
Date: Thu, 04 Jan 2018 16:09:04 +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 14045cba92ab8167e1371f2e2447a5bcdd71f12a
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Tue Dec 6 10:58:37 2016 +0100

    -fix
---
 src/credential/plugin_gnsrecord_credential.c | 23 ++++++++++++++---------
 src/credential/test_credential_issue.sh      | 12 ++++++++++--
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/credential/plugin_gnsrecord_credential.c 
b/src/credential/plugin_gnsrecord_credential.c
index 60b677a4e..93d8b8e83 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -29,6 +29,7 @@
 #include "gnunet_gnsrecord_lib.h"
 #include "gnunet_credential_service.h"
 #include "gnunet_gnsrecord_plugin.h"
+#include "gnunet_signatures.h"
 
 
 /**
@@ -96,12 +97,12 @@ credential_value_to_string (void *cls,
                                    sizeof (struct 
GNUNET_CRYPTO_EcdsaSignature),
                                    &signature);
      GNUNET_asprintf (&cred_str,
-                      "%s.%s -> %s exp:%s sig:%s",
+                      "%s.%s -> %s | %s | %s",
                       issuer_pkey,
                       &cdata[sizeof (cred)],
                       subject_pkey,
-                      expiration,
-                      signature);
+                      signature,
+                      expiration);
      GNUNET_free (subject_pkey);
      GNUNET_free (issuer_pkey);
      GNUNET_free (signature);
@@ -153,18 +154,21 @@ credential_string_to_value (void *cls,
         struct GNUNET_TIME_Absolute etime_abs;
 
         if (5 != SSCANF (s,
-                         "%52s.%253s -> %52s exp:%255s sig:%127s",
+                         "%52s.%253s -> %52s | %s | %255[0-9a-zA-Z: ]",
                          issuer_pkey,
                          name,
                          subject_pkey,
-                         expiration,
-                         signature))
+                         signature,
+                         expiration))
         {
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                       _("Unable to parse CRED record string `%s'\n"),
                       s);
           return GNUNET_SYSERR;
         }
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Found %s, %s, %s, %s, %s\n",
+                    issuer_pkey, name, subject_pkey, signature, expiration);
         *data_size = sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData) + 
strlen (name) + 1;
         *data = cred = GNUNET_malloc (*data_size);
         GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pkey,
@@ -179,15 +183,16 @@ credential_string_to_value (void *cls,
                                       strlen (signature),
                                       (char**)&sig);
         cred->sig = *sig;
-        cred->expiration = htonl (etime_abs.abs_value_us);
+        cred->expiration = GNUNET_htonll (etime_abs.abs_value_us);
+        cred->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL);
+        cred->purpose.size = strlen (name) + 1 + sizeof (struct 
GNUNET_CRYPTO_EccSignaturePurpose) +
+                             sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + 
sizeof (uint64_t);
         GNUNET_free (sig);
         GNUNET_memcpy (&cred[1],
                        name,
                        strlen (name));
 
 
-        *data = GNUNET_strdup (s);
-        *data_size = strlen (s);
         return GNUNET_OK;
       }
     default:
diff --git a/src/credential/test_credential_issue.sh 
b/src/credential/test_credential_issue.sh
index 4d1ba67c7..b2ced204a 100755
--- a/src/credential/test_credential_issue.sh
+++ b/src/credential/test_credential_issue.sh
@@ -29,8 +29,16 @@ gnunet-identity -C testsubject -c test_credential_lookup.conf
 SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep 
testsubject | awk '{print $3}')
 ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep 
testissuer | awk '{print $3}')
 #TODO1 Get credential and store it with subject (3)
-$DO_TIMEOUT valgrind gnunet-credential --issue --ego=testissuer 
--subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c 
test_credential_lookup.conf
+CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer 
--subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c 
test_credential_lookup.conf`
 STATUS=$?
 
+if test $? != 0
+then
+  echo "Error issuing..."
+  exit 1
+fi
+#Try import
+$DO_TIMEOUT gnunet-namestore -a -z testsubject -n c1 -t CRED -V "$CRED" -e 5m 
-c test_credential_lookup.conf
+
 gnunet-arm -e -c test_credential_lookup.conf
-exit $STATUS
+exit $?

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



reply via email to

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