[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -actually lock label of a zone, not all
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -actually lock label of a zone, not all labels |
Date: |
Wed, 16 Mar 2022 21:22:23 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 1128bfaca -actually lock label of a zone, not all labels
1128bfaca is described below
commit 1128bfacad7003d92fd2bafcde61a53c15894a7a
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Wed Mar 16 21:22:17 2022 +0100
-actually lock label of a zone, not all labels
---
src/namestore/gnunet-service-namestore.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/namestore/gnunet-service-namestore.c
b/src/namestore/gnunet-service-namestore.c
index 3f679cacd..5d43488a1 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1407,6 +1407,20 @@ check_record_lookup (void *cls, const struct
LabelLookupMessage *ll_msg)
return GNUNET_OK;
}
+static void
+calculate_lock_hash (const char *label,
+ const struct GNUNET_IDENTITY_PrivateKey *zone,
+ struct GNUNET_HashCode *result)
+{
+ struct GNUNET_HashContext *hctx;
+
+ hctx = GNUNET_CRYPTO_hash_context_start ();
+ GNUNET_CRYPTO_hash_context_read (hctx, label, strlen (label));
+ GNUNET_CRYPTO_hash_context_read (hctx, zone,
+ sizeof (*zone));
+ GNUNET_CRYPTO_hash_context_finish (hctx, result);
+}
+
/**
* Handles a #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP message
@@ -1447,7 +1461,7 @@ handle_record_lookup (void *cls, const struct
LabelLookupMessage *ll_msg)
name_len = strlen (conv_name) + 1;
if (GNUNET_YES == ntohl (ll_msg->locking))
{
- GNUNET_CRYPTO_hash (conv_name, strlen (conv_name), &label_hash);
+ calculate_lock_hash (conv_name, &ll_msg->zone, &label_hash);
for (lock = locks_head; NULL != lock; lock = lock->next)
if (0 == memcmp (&label_hash, &lock->label_hash, sizeof (label_hash)))
break;
@@ -1482,9 +1496,9 @@ handle_record_lookup (void *cls, const struct
LabelLookupMessage *ll_msg)
{
lock = GNUNET_new (struct RecordsLock);
lock->client = nc;
- GNUNET_CRYPTO_hash (conv_name,
- strlen (conv_name),
- &lock->label_hash);
+ memcpy (&lock->label_hash, &label_hash, sizeof (label_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Locking %s\n", GNUNET_h2s (&label_hash));
GNUNET_CONTAINER_DLL_insert (locks_head,
locks_tail,
lock);
@@ -1679,7 +1693,7 @@ handle_record_store (void *cls, const struct
RecordStoreMessage *rp_msg)
}
if (GNUNET_YES == ntohl (rp_msg->locking))
{
- GNUNET_CRYPTO_hash (conv_name, strlen (conv_name), &label_hash);
+ calculate_lock_hash (conv_name, &rp_msg->private_key, &label_hash);
for (lock = locks_head; NULL != lock; lock = lock->next)
if (0 == memcmp (&label_hash, &lock->label_hash, sizeof (label_hash)))
break;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -actually lock label of a zone, not all labels,
gnunet <=