aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/plugin_escrow_plaintext.c
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-07-19 14:05:32 +0200
committerjospaeth <spaethj@in.tum.de>2020-07-19 14:05:32 +0200
commit3a4b9fedc88c8c30e25a32336c512c387e00436e (patch)
tree7d610109b04d9b0bc7dfcc348a6d17e38c56d5e6 /src/escrow/plugin_escrow_plaintext.c
parent15ad508b20fbca46d8b9a8682a723b34098545bf (diff)
downloadgnunet-3a4b9fedc88c8c30e25a32336c512c387e00436e.tar.gz
gnunet-3a4b9fedc88c8c30e25a32336c512c387e00436e.zip
fix plaintext escrow
Diffstat (limited to 'src/escrow/plugin_escrow_plaintext.c')
-rw-r--r--src/escrow/plugin_escrow_plaintext.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
index c3680b625..d6f224330 100644
--- a/src/escrow/plugin_escrow_plaintext.c
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -122,8 +122,20 @@ verify_plaintext_key_escrow (struct GNUNET_ESCROW_Operation *op,
122} 122}
123 123
124 124
125void
126ego_created (const struct GNUNET_IDENTITY_Ego *ego)
127{
128 ph.ego_create_cont = NULL;
129 ph.curr_op->cb_get (ph.curr_op->cb_cls, ego);
130 ph.curr_op = NULL;
131}
132
133
125/** 134/**
126 * Creation operation finished. 135 * Creation operation finished.
136 * This method only handles errors that may have occured. On success,
137 * the callback is executed by the ESCROW_list_ego function, as the
138 * new ego is in our ego list only after ESCROW_list_ego has added it.
127 * 139 *
128 * @param cls pointer to operation handle 140 * @param cls pointer to operation handle
129 * @param pk private key of the ego, or NULL on error 141 * @param pk private key of the ego, or NULL on error
@@ -135,29 +147,23 @@ create_finished (void *cls,
135 const char *emsg) 147 const char *emsg)
136{ 148{
137 struct GNUNET_ESCROW_Operation *op = cls; 149 struct GNUNET_ESCROW_Operation *op = cls;
138 struct EgoEntry *ego_list;
139 150
140 if (NULL == pk) 151 if (NULL == pk)
141 { 152 {
142 fprintf (stderr, _ ("Failed to create ego: %s\n"), emsg); 153 if (NULL != emsg)
154 fprintf (stderr,
155 "Identity create operation returned with error: %s\n",
156 emsg);
157 else
158 fprintf (stderr, "Failed to create ego!");
159 op->cb_get (op->cb_cls, NULL);
143 return; 160 return;
144 } 161 }
145 162
146 /* find the ego in our ego list */ 163 /* no error occured, op->cb_get will be called from ESCROW_list_ego after
147 ego_list = ph.ego_head; 164 adding the new ego to our list */
148 while (NULL != ego_list) 165 ph.ego_create_cont = &ego_created;
149 { 166 ph.curr_op = op;
150 if (&ego_list->ego->pk == pk)
151 {
152 /* ego found */
153 op->cb_get (op->cb_cls, ego_list->ego);
154 return;
155 }
156 ego_list = ego_list->next;
157 }
158
159 /* ego not found (should not happen!) */
160 op->cb_get (op->cb_cls, NULL);
161} 167}
162 168
163 169
@@ -278,7 +284,7 @@ libgnunet_plugin_escrow_plaintext_init (void *cls)
278 api->anchor_string_to_data = &plaintext_anchor_string_to_data; 284 api->anchor_string_to_data = &plaintext_anchor_string_to_data;
279 api->anchor_data_to_string = &plaintext_anchor_data_to_string; 285 api->anchor_data_to_string = &plaintext_anchor_data_to_string;
280 286
281 ph.cont = &plaintext_cont_init; 287 ph.id_init_cont = &plaintext_cont_init;
282 288
283 identity_handle = GNUNET_IDENTITY_connect (cfg, 289 identity_handle = GNUNET_IDENTITY_connect (cfg,
284 &ESCROW_list_ego, 290 &ESCROW_list_ego,