2 This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file identity/gnunet-service-identity.c
23 * @brief identity management service
24 * @author Christian Grothoff
26 * The purpose of this service is to manage private keys that
27 * represent the various egos/pseudonyms/identities of a GNUnet user.
30 #include "gnunet_util_lib.h"
31 #include "gnunet_constants.h"
32 #include "gnunet_protocols.h"
33 #include "gnunet_statistics_service.h"
34 #include "gnunet_identity_service.h"
39 * Information we keep about each ego.
45 * We keep egos in a DLL.
50 * We keep egos in a DLL.
55 * Private key of the ego.
57 struct GNUNET_CRYPTO_EccPrivateKey *pk;
60 * String identifier for the ego.
68 * Handle to our current configuration.
70 static const struct GNUNET_CONFIGURATION_Handle *cfg;
73 * Handle to subsystem configuration which for each subsystem contains
74 * the name of the default ego.
76 static struct GNUNET_CONFIGURATION_Handle *subsystem_cfg;
79 * Handle to the statistics service.
81 static struct GNUNET_STATISTICS_Handle *stats;
84 * Notification context, simplifies client broadcasts.
86 static struct GNUNET_SERVER_NotificationContext *nc;
89 * Directory where we store the identities.
91 static char *ego_directory;
94 * Configuration file name where subsystem information is kept.
96 static char *subsystem_cfg_file;
99 * Head of DLL of all egos.
101 static struct Ego *ego_head;
104 * Tail of DLL of all egos.
106 static struct Ego *ego_tail;
110 * Get the name of the file we use to store a given ego.
112 * @param ego ego for which we need the filename
113 * @return full filename for the given ego
116 get_ego_filename (struct Ego *ego)
120 GNUNET_asprintf (&filename,
130 * Task run during shutdown.
136 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
142 GNUNET_SERVER_notification_context_destroy (nc);
147 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
150 GNUNET_CONFIGURATION_destroy (subsystem_cfg);
151 subsystem_cfg = NULL;
152 GNUNET_free (subsystem_cfg_file);
153 subsystem_cfg_file = NULL;
154 GNUNET_free (ego_directory);
155 ego_directory = NULL;
156 while (NULL != (e = ego_head))
158 GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e);
159 GNUNET_CRYPTO_ecc_key_free (e->pk);
166 * Send a result code back to the client.
168 * @param client client that should receive the result code
169 * @param result_code code to transmit
170 * @param emsg error message to include (or NULL for none)
173 send_result_code (struct GNUNET_SERVER_Client *client,
174 uint32_t result_code,
177 struct GNUNET_IDENTITY_ResultCodeMessage *rcm;
183 elen = strlen (emsg) + 1;
184 rcm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
185 rcm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
186 rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
187 rcm->result_code = htonl (result_code);
188 memcpy (&rcm[1], emsg, elen);
189 GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_YES);
195 * Create an update message with information about the current state of an ego.
197 * @param ego ego to create message for
198 * @return corresponding update message
200 static struct GNUNET_IDENTITY_UpdateMessage *
201 create_update_message (struct Ego *ego)
203 struct GNUNET_IDENTITY_UpdateMessage *um;
207 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
209 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
210 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk);
211 pk_len = ntohs (enc->size);
212 um = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + pk_len + name_len);
213 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
214 um->header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + pk_len + name_len);
215 um->name_len = htons (name_len);
216 um->pk_len = htons (pk_len);
217 str = (char *) &um[1];
218 memcpy (str, enc, pk_len);
219 memcpy (&str[pk_len], ego->identifier, name_len);
226 * Create a set default message with information about the current state of an ego.
228 * @param ego ego to create message for
229 * @param servicename name of the service to provide in the message
230 * @return corresponding set default message
232 static struct GNUNET_IDENTITY_SetDefaultMessage *
233 create_set_default_message (struct Ego *ego,
234 const char *servicename)
236 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
240 struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded *enc;
242 name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
243 enc = GNUNET_CRYPTO_ecc_encode_key (ego->pk);
244 pk_len = ntohs (enc->size);
245 sdm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len);
246 sdm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
247 sdm->header.size = htons (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + pk_len + name_len);
248 sdm->name_len = htons (name_len);
249 sdm->pk_len = htons (pk_len);
250 str = (char *) &sdm[1];
251 memcpy (str, enc, pk_len);
252 memcpy (&str[pk_len], servicename, name_len);
259 * Handler for START message from client, sends information
260 * about all identities to the client immediately and
261 * adds the client to the notification context for future
265 * @param client who sent the message
266 * @param message the message received
269 handle_start_message (void *cls, struct GNUNET_SERVER_Client *client,
270 const struct GNUNET_MessageHeader *message)
272 struct GNUNET_IDENTITY_UpdateMessage *um;
273 struct GNUNET_IDENTITY_UpdateMessage ume;
276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
277 "Received START message from client\n");
278 GNUNET_SERVER_notification_context_add (nc, client);
279 for (ego = ego_head; NULL != ego; ego = ego->next)
281 um = create_update_message (ego);
282 GNUNET_SERVER_notification_context_unicast (nc, client, &um->header, GNUNET_YES);
285 ume.header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
286 ume.header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage));
287 ume.pk_len = htons (0);
288 ume.name_len = htons (0);
289 GNUNET_SERVER_notification_context_unicast (nc, client, &ume.header, GNUNET_YES);
290 GNUNET_SERVER_receive_done (client, GNUNET_OK);
295 * Handler for GET_DEFAULT message from client, returns
296 * default identity for some service.
299 * @param client who sent the message
300 * @param message the message received
303 handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
304 const struct GNUNET_MessageHeader *message)
306 const struct GNUNET_IDENTITY_GetDefaultMessage *gdm;
307 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
314 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
315 "Received GET_DEFAULT message from client\n");
316 size = ntohs (message->size);
317 if (size <= sizeof (struct GNUNET_IDENTITY_GetDefaultMessage))
320 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
323 gdm = (const struct GNUNET_IDENTITY_GetDefaultMessage *) message;
324 name = (const char *) &gdm[1];
325 name_len = ntohs (gdm->name_len);
326 if ( (name_len + sizeof (struct GNUNET_IDENTITY_GetDefaultMessage) != size) ||
327 (0 != ntohs (gdm->reserved)) ||
328 ('\0' != name[name_len - 1]) )
331 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
335 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
337 "DEFAULT_IDENTIFIER",
340 send_result_code (client, 1, gettext_noop ("no default known"));
341 GNUNET_SERVER_receive_done (client, GNUNET_OK);
344 for (ego = ego_head; NULL != ego; ego = ego->next)
346 if (0 == strcmp (ego->identifier,
349 sdm = create_set_default_message (ego,
351 GNUNET_SERVER_notification_context_broadcast (nc, &sdm->header, GNUNET_YES);
353 GNUNET_SERVER_receive_done (client, GNUNET_OK);
357 send_result_code (client, 1,
358 gettext_noop ("default configured, but ego unknown (internal error)"));
359 GNUNET_SERVER_receive_done (client, GNUNET_OK);
364 * Compare the given two private keys for equality.
366 * @param pk1 one private key
367 * @param pk2 another private key
368 * @return 0 if the keys are equal
371 key_cmp (const struct GNUNET_CRYPTO_EccPrivateKey *pk1,
372 const struct GNUNET_CRYPTO_EccPrivateKey *pk2)
374 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded p1;
375 struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded p2;
377 GNUNET_CRYPTO_ecc_key_get_public (pk1, &p1);
378 GNUNET_CRYPTO_ecc_key_get_public (pk2, &p2);
379 return memcmp (&p1, &p2, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded));
384 * Handler for SET_DEFAULT message from client, updates
385 * default identity for some service.
388 * @param client who sent the message
389 * @param message the message received
392 handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
393 const struct GNUNET_MessageHeader *message)
395 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
401 struct GNUNET_CRYPTO_EccPrivateKey *pk;
403 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
404 "Received SET_DEFAULT message from client\n");
405 size = ntohs (message->size);
406 if (size <= sizeof (struct GNUNET_IDENTITY_SetDefaultMessage))
409 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
412 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) message;
413 name_len = ntohs (sdm->name_len);
414 pk_len = ntohs (sdm->pk_len);
415 str = (const char *) &sdm[1];
416 if ( (name_len + pk_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size) ||
417 (NULL == (pk = GNUNET_CRYPTO_ecc_decode_key (str, pk_len, GNUNET_YES))) )
420 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
424 if ('\0' != str[name_len - 1])
427 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
430 for (ego = ego_head; NULL != ego; ego = ego->next)
432 if (0 == key_cmp (ego->pk,
435 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
437 "DEFAULT_IDENTIFIER",
440 GNUNET_CONFIGURATION_write (subsystem_cfg,
442 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
443 _("Failed to write subsystem default identifier map to `%s'.\n"),
445 send_result_code (client, 0, NULL);
446 GNUNET_SERVER_receive_done (client, GNUNET_OK);
447 GNUNET_CRYPTO_ecc_key_free (pk);
451 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
452 GNUNET_SERVER_receive_done (client, GNUNET_OK);
453 GNUNET_CRYPTO_ecc_key_free (pk);
458 * Send an updated message for the given ego to all listeners.
460 * @param ego ego to send the update for
463 notify_listeners (struct Ego *ego)
465 struct GNUNET_IDENTITY_UpdateMessage *um;
467 um = create_update_message (ego);
468 GNUNET_SERVER_notification_context_broadcast (nc, &um->header, GNUNET_YES);
474 * Handler for CREATE message from client, creates
478 * @param client who sent the message
479 * @param message the message received
482 handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
483 const struct GNUNET_MessageHeader *message)
485 const struct GNUNET_IDENTITY_CreateRequestMessage *crm;
492 struct GNUNET_CRYPTO_EccPrivateKey *pk;
495 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
496 "Received CREATE message from client\n");
497 size = ntohs (message->size);
498 if (size <= sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
501 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
504 crm = (const struct GNUNET_IDENTITY_CreateRequestMessage *) message;
505 name_len = ntohs (crm->name_len);
506 pk_len = ntohs (crm->pk_len);
507 pks = (const char *) &crm[1];
508 if ( (name_len + pk_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size) ||
509 (NULL == (pk = GNUNET_CRYPTO_ecc_decode_key (pks, pk_len, GNUNET_YES))) )
512 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
516 if ('\0' != str[name_len - 1])
519 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
522 for (ego = ego_head; NULL != ego; ego = ego->next)
524 if (0 == strcmp (ego->identifier,
527 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego"));
528 GNUNET_SERVER_receive_done (client, GNUNET_OK);
529 GNUNET_CRYPTO_ecc_key_free (pk);
533 ego = GNUNET_new (struct Ego);
535 ego->identifier = GNUNET_strdup (str);
536 GNUNET_CONTAINER_DLL_insert (ego_head,
539 send_result_code (client, 0, NULL);
540 fn = get_ego_filename (ego);
541 (void) GNUNET_DISK_directory_create_for_file (fn);
543 GNUNET_DISK_fn_write (fn, pks, pk_len,
544 GNUNET_DISK_PERM_USER_READ |
545 GNUNET_DISK_PERM_USER_WRITE))
546 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
549 notify_listeners (ego);
550 GNUNET_SERVER_receive_done (client, GNUNET_OK);
555 * Closure for 'handle_ego_rename'.
562 const char *old_name;
567 const char *new_name;
572 * An ego was renamed; rename it in all subsystems where it is
573 * currently set as the default.
575 * @param cls the 'struct RenameContext'
576 * @param section a section in the configuration to process
579 handle_ego_rename (void *cls,
582 struct RenameContext *rc = cls;
586 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
588 "DEFAULT_IDENTIFIER",
591 if (0 != strcmp (id, rc->old_name))
596 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
598 "DEFAULT_IDENTIFIER",
605 * Handler for RENAME message from client, creates
609 * @param client who sent the message
610 * @param message the message received
613 handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client,
614 const struct GNUNET_MessageHeader *message)
616 const struct GNUNET_IDENTITY_RenameMessage *rm;
618 uint16_t old_name_len;
619 uint16_t new_name_len;
621 const char *old_name;
622 const char *new_name;
623 struct RenameContext rename_ctx;
627 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
628 "Received RENAME message from client\n");
629 size = ntohs (message->size);
630 if (size <= sizeof (struct GNUNET_IDENTITY_RenameMessage))
633 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
636 rm = (const struct GNUNET_IDENTITY_RenameMessage *) message;
637 old_name_len = ntohs (rm->old_name_len);
638 new_name_len = ntohs (rm->new_name_len);
639 old_name = (const char *) &rm[1];
640 new_name = &old_name[old_name_len];
641 if ( (old_name_len + new_name_len + sizeof (struct GNUNET_IDENTITY_RenameMessage) != size) ||
642 ('\0' != old_name[old_name_len - 1]) ||
643 ('\0' != new_name[new_name_len - 1]) )
646 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
650 /* check if new name is already in use */
651 for (ego = ego_head; NULL != ego; ego = ego->next)
653 if (0 == strcmp (ego->identifier,
656 send_result_code (client, 1, gettext_noop ("target name already exists"));
657 GNUNET_SERVER_receive_done (client, GNUNET_OK);
662 /* locate old name and, if found, perform rename */
663 for (ego = ego_head; NULL != ego; ego = ego->next)
665 if (0 == strcmp (ego->identifier,
668 fn_old = get_ego_filename (ego);
669 GNUNET_free (ego->identifier);
670 rename_ctx.old_name = old_name;
671 rename_ctx.new_name = new_name;
672 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
676 GNUNET_CONFIGURATION_write (subsystem_cfg,
678 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
679 _("Failed to write subsystem default identifier map to `%s'.\n"),
681 ego->identifier = GNUNET_strdup (new_name);
682 fn_new = get_ego_filename (ego);
683 if (0 != RENAME (fn_old, fn_new))
684 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
685 GNUNET_free (fn_old);
686 GNUNET_free (fn_new);
687 notify_listeners (ego);
688 send_result_code (client, 0, NULL);
689 GNUNET_SERVER_receive_done (client, GNUNET_OK);
694 /* failed to locate old name */
695 send_result_code (client, 1, gettext_noop ("no matching ego found"));
696 GNUNET_SERVER_receive_done (client, GNUNET_OK);
701 * An ego was removed, remove it from all subsystems where it is
702 * currently set as the default.
704 * @param cls name of the removed ego (const char *)
705 * @param section a section in the configuration to process
708 handle_ego_delete (void *cls,
711 const char *identifier = cls;
715 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
717 "DEFAULT_IDENTIFIER",
720 if (0 != strcmp (id, identifier))
725 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
727 "DEFAULT_IDENTIFIER",
734 * Handler for DELETE message from client, creates
738 * @param client who sent the message
739 * @param message the message received
742 handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client,
743 const struct GNUNET_MessageHeader *message)
745 const struct GNUNET_IDENTITY_DeleteMessage *dm;
752 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
753 "Received DELETE message from client\n");
754 size = ntohs (message->size);
755 if (size <= sizeof (struct GNUNET_IDENTITY_DeleteMessage))
758 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
761 dm = (const struct GNUNET_IDENTITY_DeleteMessage *) message;
762 name = (const char *) &dm[1];
763 name_len = ntohs (dm->name_len);
764 if ( (name_len + sizeof (struct GNUNET_IDENTITY_DeleteMessage) != size) ||
765 (0 != ntohs (dm->reserved)) ||
766 ('\0' != name[name_len - 1]) )
769 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
772 for (ego = ego_head; NULL != ego; ego = ego->next)
774 if (0 == strcmp (ego->identifier,
777 GNUNET_CONTAINER_DLL_remove (ego_head,
780 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
784 GNUNET_CONFIGURATION_write (subsystem_cfg,
786 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
787 _("Failed to write subsystem default identifier map to `%s'.\n"),
789 fn = get_ego_filename (ego);
790 if (0 != UNLINK (fn))
791 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
793 GNUNET_free (ego->identifier);
794 ego->identifier = NULL;
795 notify_listeners (ego);
796 GNUNET_CRYPTO_ecc_key_free (ego->pk);
798 send_result_code (client, 0, NULL);
799 GNUNET_SERVER_receive_done (client, GNUNET_OK);
804 send_result_code (client, 1, gettext_noop ("no matching ego found"));
805 GNUNET_SERVER_receive_done (client, GNUNET_OK);
810 * Process the given file from the "EGODIR". Parses the file
811 * and creates the respective 'struct Ego' in memory.
814 * @param filename name of the file to parse
815 * @return GNUNET_OK to continue to iterate,
816 * GNUNET_NO to stop iteration with no error,
817 * GNUNET_SYSERR to abort iteration with error!
820 process_ego_file (void *cls,
821 const char *filename)
826 fn = strrchr (filename, (int) DIR_SEPARATOR);
832 ego = GNUNET_new (struct Ego);
833 ego->pk = GNUNET_CRYPTO_ecc_key_create_from_file (filename);
837 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
838 _("Failed to parse ego information in `%s'\n"),
843 ego->identifier = GNUNET_strdup (fn);
844 GNUNET_CONTAINER_DLL_insert (ego_head,
852 * Handle network size estimate clients.
855 * @param server the initialized server
856 * @param c configuration to use
860 struct GNUNET_SERVER_Handle *server,
861 const struct GNUNET_CONFIGURATION_Handle *c)
863 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
864 {&handle_start_message, NULL,
865 GNUNET_MESSAGE_TYPE_IDENTITY_START, sizeof (struct GNUNET_MessageHeader)},
866 {&handle_get_default_message, NULL,
867 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, 0},
868 {&handle_set_default_message, NULL,
869 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, 0},
870 {&handle_create_message, NULL,
871 GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, 0},
872 {&handle_rename_message, NULL,
873 GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, 0},
874 {&handle_delete_message, NULL,
875 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, 0},
881 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
885 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR");
886 GNUNET_SCHEDULER_shutdown ();
890 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
892 &subsystem_cfg_file))
894 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "SUBSYSTEM_CFG");
895 GNUNET_SCHEDULER_shutdown ();
898 subsystem_cfg = GNUNET_CONFIGURATION_create ();
900 GNUNET_DISK_file_test (subsystem_cfg_file)) &&
902 GNUNET_CONFIGURATION_parse (subsystem_cfg,
903 subsystem_cfg_file)) )
905 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
906 _("Failed to parse subsystem identity configuration file `%s'\n"),
908 GNUNET_SCHEDULER_shutdown ();
911 stats = GNUNET_STATISTICS_create ("identity", cfg);
912 GNUNET_SERVER_add_handlers (server, handlers);
913 nc = GNUNET_SERVER_notification_context_create (server, 1);
914 GNUNET_DISK_directory_scan (ego_directory,
917 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
923 * The main function for the network size estimation service.
925 * @param argc number of arguments from the command line
926 * @param argv command line arguments
927 * @return 0 ok, 1 on error
930 main (int argc, char *const *argv)
933 GNUNET_SERVICE_run (argc, argv, "identity",
934 GNUNET_SERVICE_OPTION_NONE,
935 &run, NULL)) ? 0 : 1;
939 /* end of gnunet-service-identity.c */