diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-26 17:21:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-26 17:21:22 +0000 |
commit | 3999807382f98843cdde19211fc94484d0793087 (patch) | |
tree | eab97299e72edbfdd5d6f409db0729d9780d3e5e /src/regex/gnunet-service-regex.c | |
parent | abc1a0ea19b7dc199b83749d31e32622c7469ded (diff) | |
download | gnunet-3999807382f98843cdde19211fc94484d0793087.tar.gz gnunet-3999807382f98843cdde19211fc94484d0793087.zip |
-introducing signing of regex accept states, removing PID from regex API
Diffstat (limited to 'src/regex/gnunet-service-regex.c')
-rw-r--r-- | src/regex/gnunet-service-regex.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c index 697b04a36..96a6b82b1 100644 --- a/src/regex/gnunet-service-regex.c +++ b/src/regex/gnunet-service-regex.c | |||
@@ -99,6 +99,11 @@ static struct ClientEntry *client_tail; | |||
99 | */ | 99 | */ |
100 | static struct GNUNET_SERVER_NotificationContext *nc; | 100 | static struct GNUNET_SERVER_NotificationContext *nc; |
101 | 101 | ||
102 | /** | ||
103 | * Private key for this peer. | ||
104 | */ | ||
105 | static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; | ||
106 | |||
102 | 107 | ||
103 | /** | 108 | /** |
104 | * Task run during shutdown. | 109 | * Task run during shutdown. |
@@ -115,6 +120,8 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
115 | stats = NULL; | 120 | stats = NULL; |
116 | GNUNET_SERVER_notification_context_destroy (nc); | 121 | GNUNET_SERVER_notification_context_destroy (nc); |
117 | nc = NULL; | 122 | nc = NULL; |
123 | GNUNET_CRYPTO_ecc_key_free (my_private_key); | ||
124 | my_private_key = NULL; | ||
118 | } | 125 | } |
119 | 126 | ||
120 | 127 | ||
@@ -208,10 +215,10 @@ handle_announce (void *cls, | |||
208 | ce = GNUNET_new (struct ClientEntry); | 215 | ce = GNUNET_new (struct ClientEntry); |
209 | ce->client = client; | 216 | ce->client = client; |
210 | ce->ah = REGEX_INTERNAL_announce (dht, | 217 | ce->ah = REGEX_INTERNAL_announce (dht, |
211 | &am->pid, | 218 | my_private_key, |
212 | regex, | 219 | regex, |
213 | ntohs (am->compression), | 220 | ntohs (am->compression), |
214 | stats); | 221 | stats); |
215 | if (NULL == ce->ah) | 222 | if (NULL == ce->ah) |
216 | { | 223 | { |
217 | GNUNET_break (0); | 224 | GNUNET_break (0); |
@@ -347,9 +354,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
347 | {&handle_search, NULL, GNUNET_MESSAGE_TYPE_REGEX_SEARCH, 0}, | 354 | {&handle_search, NULL, GNUNET_MESSAGE_TYPE_REGEX_SEARCH, 0}, |
348 | {NULL, NULL, 0, 0} | 355 | {NULL, NULL, 0, 0} |
349 | }; | 356 | }; |
357 | |||
358 | my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); | ||
359 | if (NULL == my_private_key) | ||
360 | { | ||
361 | GNUNET_SCHEDULER_shutdown (); | ||
362 | return; | ||
363 | } | ||
350 | dht = GNUNET_DHT_connect (cfg, 1024); | 364 | dht = GNUNET_DHT_connect (cfg, 1024); |
351 | if (NULL == dht) | 365 | if (NULL == dht) |
352 | { | 366 | { |
367 | GNUNET_CRYPTO_ecc_key_free (my_private_key); | ||
368 | my_private_key = NULL; | ||
353 | GNUNET_SCHEDULER_shutdown (); | 369 | GNUNET_SCHEDULER_shutdown (); |
354 | return; | 370 | return; |
355 | } | 371 | } |