gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: fix changes in identities


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: fix changes in identities
Date: Fri, 11 Oct 2019 11:08:41 +0200

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 3b80c8d9d fix changes in identities
3b80c8d9d is described below

commit 3b80c8d9daddaeaf033d0b0d3f6cda842a939c8d
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Fri Oct 11 11:06:24 2019 +0200

    fix changes in identities
---
 src/identity/plugin_rest_identity.c | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/identity/plugin_rest_identity.c 
b/src/identity/plugin_rest_identity.c
index 247d09282..e052ac6b3 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -1234,11 +1234,46 @@ init_egos (void *cls,
     GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
     ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
     ego_entry->ego = ego;
-    GNUNET_asprintf (&ego_entry->identifier, "%s", identifier);
+    ego_entry->identifier = GNUNET_strdup (identifier);
     GNUNET_CONTAINER_DLL_insert_tail (handle->ego_head,
                                       handle->ego_tail,
                                       ego_entry);
+    return;
+  }
+  // Check if ego exists
+  for (ego_entry = handle->ego_head; NULL != ego_entry;)
+  {
+    struct EgoEntry *tmp = ego_entry;
+    ego_entry = ego_entry->next;
+    if (ego != tmp->ego)
+      continue;
+    // Deleted
+    if (NULL == identifier)
+    {
+      GNUNET_CONTAINER_DLL_remove (handle->ego_head,
+                                   handle->ego_tail,
+                                   tmp);
+      GNUNET_free (tmp->keystring);
+      GNUNET_free (tmp->identifier);
+      GNUNET_free (tmp);
+    }
+    else {
+      // Renamed
+      GNUNET_free (tmp->identifier);
+      tmp->identifier = GNUNET_strdup (identifier);
+    }
+    return;
   }
+  // New ego
+  ego_entry = GNUNET_new (struct EgoEntry);
+  GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
+  ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
+  ego_entry->ego = ego;
+  GNUNET_asprintf (&ego_entry->identifier, "%s", identifier);
+  GNUNET_CONTAINER_DLL_insert_tail (handle->ego_head,
+                                    handle->ego_tail,
+                                    ego_entry);
+
 }
 
 /**

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



reply via email to

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