2 This file is part of GNUnet.
3 Copyright (C) 2013 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, 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 * - auto-initialze default egos; maybe trigger default
31 * initializations (such as gnunet-gns-import.sh?)
34 #include "gnunet_util_lib.h"
35 #include "gnunet_constants.h"
36 #include "gnunet_protocols.h"
37 #include "gnunet_statistics_service.h"
38 #include "gnunet_identity_service.h"
43 * Information we keep about each ego.
49 * We keep egos in a DLL.
54 * We keep egos in a DLL.
59 * Private key of the ego.
61 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
64 * String identifier for the ego.
72 * Handle to our current configuration.
74 static const struct GNUNET_CONFIGURATION_Handle *cfg;
77 * Handle to subsystem configuration which for each subsystem contains
78 * the name of the default ego.
80 static struct GNUNET_CONFIGURATION_Handle *subsystem_cfg;
83 * Handle to the statistics service.
85 static struct GNUNET_STATISTICS_Handle *stats;
88 * Notification context, simplifies client broadcasts.
90 static struct GNUNET_SERVER_NotificationContext *nc;
93 * Directory where we store the identities.
95 static char *ego_directory;
98 * Configuration file name where subsystem information is kept.
100 static char *subsystem_cfg_file;
103 * Head of DLL of all egos.
105 static struct Ego *ego_head;
108 * Tail of DLL of all egos.
110 static struct Ego *ego_tail;
114 * Get the name of the file we use to store a given ego.
116 * @param ego ego for which we need the filename
117 * @return full filename for the given ego
120 get_ego_filename (struct Ego *ego)
124 GNUNET_asprintf (&filename,
134 * Task run during shutdown.
139 shutdown_task (void *cls)
145 GNUNET_SERVER_notification_context_destroy (nc);
150 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
153 GNUNET_CONFIGURATION_destroy (subsystem_cfg);
154 subsystem_cfg = NULL;
155 GNUNET_free (subsystem_cfg_file);
156 subsystem_cfg_file = NULL;
157 GNUNET_free (ego_directory);
158 ego_directory = NULL;
159 while (NULL != (e = ego_head))
161 GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e);
163 GNUNET_free (e->identifier);
170 * Send a result code back to the client.
172 * @param client client that should receive the result code
173 * @param result_code code to transmit
174 * @param emsg error message to include (or NULL for none)
177 send_result_code (struct GNUNET_SERVER_Client *client,
178 uint32_t result_code,
181 struct GNUNET_IDENTITY_ResultCodeMessage *rcm;
187 elen = strlen (emsg) + 1;
188 rcm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
189 rcm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE);
190 rcm->header.size = htons (sizeof (struct GNUNET_IDENTITY_ResultCodeMessage) + elen);
191 rcm->result_code = htonl (result_code);
193 GNUNET_memcpy (&rcm[1], emsg, elen);
194 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
195 "Sending result %d (%s) to client\n",
198 GNUNET_SERVER_notification_context_unicast (nc, client, &rcm->header, GNUNET_NO);
204 * Create an update message with information about the current state of an ego.
206 * @param ego ego to create message for
207 * @return corresponding update message
209 static struct GNUNET_IDENTITY_UpdateMessage *
210 create_update_message (struct Ego *ego)
212 struct GNUNET_IDENTITY_UpdateMessage *um;
215 name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1);
216 um = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + name_len);
217 um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
218 um->header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage) + name_len);
219 um->name_len = htons (name_len);
220 um->end_of_list = htons (GNUNET_NO);
221 um->private_key = *ego->pk;
222 GNUNET_memcpy (&um[1], ego->identifier, name_len);
228 * Create a set default message with information about the current state of an ego.
230 * @param ego ego to create message for
231 * @param servicename name of the service to provide in the message
232 * @return corresponding set default message
234 static struct GNUNET_IDENTITY_SetDefaultMessage *
235 create_set_default_message (struct Ego *ego,
236 const char *servicename)
238 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
241 name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1);
242 sdm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + name_len);
243 sdm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT);
244 sdm->header.size = htons (sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) + name_len);
245 sdm->name_len = htons (name_len);
246 sdm->reserved = htons (0);
247 sdm->private_key = *ego->pk;
248 GNUNET_memcpy (&sdm[1], servicename, name_len);
254 * Handler for START message from client, sends information
255 * about all identities to the client immediately and
256 * adds the client to the notification context for future
260 * @param client who sent the message
261 * @param message the message received
264 handle_start_message (void *cls, struct GNUNET_SERVER_Client *client,
265 const struct GNUNET_MessageHeader *message)
267 struct GNUNET_IDENTITY_UpdateMessage *um;
268 struct GNUNET_IDENTITY_UpdateMessage ume;
271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
272 "Received START message from client\n");
273 GNUNET_SERVER_notification_context_add (nc, client);
274 for (ego = ego_head; NULL != ego; ego = ego->next)
276 um = create_update_message (ego);
277 GNUNET_SERVER_notification_context_unicast (nc, client, &um->header, GNUNET_NO);
280 memset (&ume, 0, sizeof (ume));
281 ume.header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE);
282 ume.header.size = htons (sizeof (struct GNUNET_IDENTITY_UpdateMessage));
283 ume.end_of_list = htons (GNUNET_YES);
284 ume.name_len = htons (0);
285 GNUNET_SERVER_notification_context_unicast (nc, client, &ume.header, GNUNET_NO);
286 GNUNET_SERVER_receive_done (client, GNUNET_OK);
291 * Handler for GET_DEFAULT message from client, returns
292 * default identity for some service.
295 * @param client who sent the message
296 * @param message the message received
299 handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client,
300 const struct GNUNET_MessageHeader *message)
302 const struct GNUNET_IDENTITY_GetDefaultMessage *gdm;
303 struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
310 size = ntohs (message->size);
311 if (size <= sizeof (struct GNUNET_IDENTITY_GetDefaultMessage))
314 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
317 gdm = (const struct GNUNET_IDENTITY_GetDefaultMessage *) message;
318 name = (const char *) &gdm[1];
319 name_len = ntohs (gdm->name_len);
320 if ( (name_len + sizeof (struct GNUNET_IDENTITY_GetDefaultMessage) != size) ||
321 (0 != ntohs (gdm->reserved)) ||
322 ('\0' != name[name_len - 1]) )
325 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
328 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
329 "Received GET_DEFAULT for service `%s' from client\n",
332 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
334 "DEFAULT_IDENTIFIER",
337 send_result_code (client, 1, gettext_noop ("no default known"));
338 GNUNET_SERVER_receive_done (client, GNUNET_OK);
341 for (ego = ego_head; NULL != ego; ego = ego->next)
343 if (0 == strcmp (ego->identifier,
346 sdm = create_set_default_message (ego,
348 GNUNET_SERVER_notification_context_unicast (nc, client,
349 &sdm->header, GNUNET_NO);
351 GNUNET_SERVER_receive_done (client, GNUNET_OK);
352 GNUNET_free (identifier);
356 GNUNET_free (identifier);
357 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
358 "Failed to find ego `%s'\n",
360 send_result_code (client, 1,
361 gettext_noop ("default configured, but ego unknown (internal error)"));
362 GNUNET_SERVER_receive_done (client, GNUNET_OK);
367 * Compare the given two private keys for equality.
369 * @param pk1 one private key
370 * @param pk2 another private key
371 * @return 0 if the keys are equal
374 key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1,
375 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2)
377 return memcmp (pk1, pk2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
382 * Handler for SET_DEFAULT message from client, updates
383 * default identity for some service.
386 * @param client who sent the message
387 * @param message the message received
390 handle_set_default_message (void *cls, struct GNUNET_SERVER_Client *client,
391 const struct GNUNET_MessageHeader *message)
393 const struct GNUNET_IDENTITY_SetDefaultMessage *sdm;
399 size = ntohs (message->size);
400 if (size <= sizeof (struct GNUNET_IDENTITY_SetDefaultMessage))
403 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
406 sdm = (const struct GNUNET_IDENTITY_SetDefaultMessage *) message;
407 name_len = ntohs (sdm->name_len);
408 GNUNET_break (0 == ntohs (sdm->reserved));
409 if (name_len + sizeof (struct GNUNET_IDENTITY_SetDefaultMessage) != size)
412 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
415 str = (const char *) &sdm[1];
416 if ('\0' != str[name_len - 1])
419 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
422 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
423 "Received SET_DEFAULT for service `%s' from client\n",
425 for (ego = ego_head; NULL != ego; ego = ego->next)
427 if (0 == key_cmp (ego->pk,
430 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
432 "DEFAULT_IDENTIFIER",
435 GNUNET_CONFIGURATION_write (subsystem_cfg,
437 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
438 _("Failed to write subsystem default identifier map to `%s'.\n"),
440 send_result_code (client, 0, NULL);
441 GNUNET_SERVER_receive_done (client, GNUNET_OK);
445 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
446 GNUNET_SERVER_receive_done (client, GNUNET_OK);
451 * Send an updated message for the given ego to all listeners.
453 * @param ego ego to send the update for
456 notify_listeners (struct Ego *ego)
458 struct GNUNET_IDENTITY_UpdateMessage *um;
460 um = create_update_message (ego);
461 GNUNET_SERVER_notification_context_broadcast (nc, &um->header, GNUNET_NO);
467 * Handler for CREATE message from client, creates
471 * @param client who sent the message
472 * @param message the message received
475 handle_create_message (void *cls, struct GNUNET_SERVER_Client *client,
476 const struct GNUNET_MessageHeader *message)
478 const struct GNUNET_IDENTITY_CreateRequestMessage *crm;
485 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
486 "Received CREATE message from client\n");
487 size = ntohs (message->size);
488 if (size <= sizeof (struct GNUNET_IDENTITY_CreateRequestMessage))
491 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
494 crm = (const struct GNUNET_IDENTITY_CreateRequestMessage *) message;
495 name_len = ntohs (crm->name_len);
496 GNUNET_break (0 == ntohs (crm->reserved));
497 if (name_len + sizeof (struct GNUNET_IDENTITY_CreateRequestMessage) != size)
500 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
503 str = (const char *) &crm[1];
504 if ('\0' != str[name_len - 1])
507 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
510 for (ego = ego_head; NULL != ego; ego = ego->next)
512 if (0 == strcmp (ego->identifier,
515 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego"));
516 GNUNET_SERVER_receive_done (client, GNUNET_OK);
520 ego = GNUNET_new (struct Ego);
521 ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
522 *ego->pk = crm->private_key;
523 ego->identifier = GNUNET_strdup (str);
524 GNUNET_CONTAINER_DLL_insert (ego_head,
527 send_result_code (client, 0, NULL);
528 fn = get_ego_filename (ego);
529 (void) GNUNET_DISK_directory_create_for_file (fn);
530 if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) !=
531 GNUNET_DISK_fn_write (fn,
533 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
534 GNUNET_DISK_PERM_USER_READ |
535 GNUNET_DISK_PERM_USER_WRITE))
536 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
539 notify_listeners (ego);
540 GNUNET_SERVER_receive_done (client, GNUNET_OK);
545 * Closure for 'handle_ego_rename'.
552 const char *old_name;
557 const char *new_name;
562 * An ego was renamed; rename it in all subsystems where it is
563 * currently set as the default.
565 * @param cls the 'struct RenameContext'
566 * @param section a section in the configuration to process
569 handle_ego_rename (void *cls,
572 struct RenameContext *rc = cls;
576 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
578 "DEFAULT_IDENTIFIER",
581 if (0 != strcmp (id, rc->old_name))
586 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
588 "DEFAULT_IDENTIFIER",
595 * Handler for RENAME message from client, creates
599 * @param client who sent the message
600 * @param message the message received
603 handle_rename_message (void *cls, struct GNUNET_SERVER_Client *client,
604 const struct GNUNET_MessageHeader *message)
606 const struct GNUNET_IDENTITY_RenameMessage *rm;
608 uint16_t old_name_len;
609 uint16_t new_name_len;
611 const char *old_name;
612 const char *new_name;
613 struct RenameContext rename_ctx;
617 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
618 "Received RENAME message from client\n");
619 size = ntohs (message->size);
620 if (size <= sizeof (struct GNUNET_IDENTITY_RenameMessage))
623 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
626 rm = (const struct GNUNET_IDENTITY_RenameMessage *) message;
627 old_name_len = ntohs (rm->old_name_len);
628 new_name_len = ntohs (rm->new_name_len);
629 old_name = (const char *) &rm[1];
630 new_name = &old_name[old_name_len];
631 if ( (old_name_len + new_name_len + sizeof (struct GNUNET_IDENTITY_RenameMessage) != size) ||
632 ('\0' != old_name[old_name_len - 1]) ||
633 ('\0' != new_name[new_name_len - 1]) )
636 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
640 /* check if new name is already in use */
641 for (ego = ego_head; NULL != ego; ego = ego->next)
643 if (0 == strcmp (ego->identifier,
646 send_result_code (client, 1, gettext_noop ("target name already exists"));
647 GNUNET_SERVER_receive_done (client, GNUNET_OK);
652 /* locate old name and, if found, perform rename */
653 for (ego = ego_head; NULL != ego; ego = ego->next)
655 if (0 == strcmp (ego->identifier,
658 fn_old = get_ego_filename (ego);
659 GNUNET_free (ego->identifier);
660 rename_ctx.old_name = old_name;
661 rename_ctx.new_name = new_name;
662 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
666 GNUNET_CONFIGURATION_write (subsystem_cfg,
668 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
669 _("Failed to write subsystem default identifier map to `%s'.\n"),
671 ego->identifier = GNUNET_strdup (new_name);
672 fn_new = get_ego_filename (ego);
673 if (0 != RENAME (fn_old, fn_new))
674 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
675 GNUNET_free (fn_old);
676 GNUNET_free (fn_new);
677 notify_listeners (ego);
678 send_result_code (client, 0, NULL);
679 GNUNET_SERVER_receive_done (client, GNUNET_OK);
684 /* failed to locate old name */
685 send_result_code (client, 1, gettext_noop ("no matching ego found"));
686 GNUNET_SERVER_receive_done (client, GNUNET_OK);
691 * An ego was removed, remove it from all subsystems where it is
692 * currently set as the default.
694 * @param cls name of the removed ego (const char *)
695 * @param section a section in the configuration to process
698 handle_ego_delete (void *cls,
701 const char *identifier = cls;
705 GNUNET_CONFIGURATION_get_value_string (subsystem_cfg,
707 "DEFAULT_IDENTIFIER",
710 if (0 != strcmp (id, identifier))
715 GNUNET_CONFIGURATION_set_value_string (subsystem_cfg,
717 "DEFAULT_IDENTIFIER",
724 * Handler for DELETE message from client, creates
728 * @param client who sent the message
729 * @param message the message received
732 handle_delete_message (void *cls, struct GNUNET_SERVER_Client *client,
733 const struct GNUNET_MessageHeader *message)
735 const struct GNUNET_IDENTITY_DeleteMessage *dm;
742 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
743 "Received DELETE message from client\n");
744 size = ntohs (message->size);
745 if (size <= sizeof (struct GNUNET_IDENTITY_DeleteMessage))
748 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
751 dm = (const struct GNUNET_IDENTITY_DeleteMessage *) message;
752 name = (const char *) &dm[1];
753 name_len = ntohs (dm->name_len);
754 if ( (name_len + sizeof (struct GNUNET_IDENTITY_DeleteMessage) != size) ||
755 (0 != ntohs (dm->reserved)) ||
756 ('\0' != name[name_len - 1]) )
759 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
762 for (ego = ego_head; NULL != ego; ego = ego->next)
764 if (0 == strcmp (ego->identifier,
767 GNUNET_CONTAINER_DLL_remove (ego_head,
770 GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg,
774 GNUNET_CONFIGURATION_write (subsystem_cfg,
776 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
777 _("Failed to write subsystem default identifier map to `%s'.\n"),
779 fn = get_ego_filename (ego);
780 if (0 != UNLINK (fn))
781 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
783 GNUNET_free (ego->identifier);
784 ego->identifier = NULL;
785 notify_listeners (ego);
786 GNUNET_free (ego->pk);
788 send_result_code (client, 0, NULL);
789 GNUNET_SERVER_receive_done (client, GNUNET_OK);
794 send_result_code (client, 1, gettext_noop ("no matching ego found"));
795 GNUNET_SERVER_receive_done (client, GNUNET_OK);
800 * Process the given file from the "EGODIR". Parses the file
801 * and creates the respective 'struct Ego' in memory.
804 * @param filename name of the file to parse
805 * @return #GNUNET_OK to continue to iterate,
806 * #GNUNET_NO to stop iteration with no error,
807 * #GNUNET_SYSERR to abort iteration with error!
810 process_ego_file (void *cls,
811 const char *filename)
816 fn = strrchr (filename, (int) DIR_SEPARATOR);
822 ego = GNUNET_new (struct Ego);
823 ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file (filename);
827 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
828 _("Failed to parse ego information in `%s'\n"),
832 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
835 ego->identifier = GNUNET_strdup (fn + 1);
836 GNUNET_CONTAINER_DLL_insert (ego_head,
844 * Handle network size estimate clients.
847 * @param server the initialized server
848 * @param c configuration to use
852 struct GNUNET_SERVER_Handle *server,
853 const struct GNUNET_CONFIGURATION_Handle *c)
855 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
856 {&handle_start_message, NULL,
857 GNUNET_MESSAGE_TYPE_IDENTITY_START, sizeof (struct GNUNET_MessageHeader)},
858 {&handle_get_default_message, NULL,
859 GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, 0},
860 {&handle_set_default_message, NULL,
861 GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, 0},
862 {&handle_create_message, NULL,
863 GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, 0},
864 {&handle_rename_message, NULL,
865 GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, 0},
866 {&handle_delete_message, NULL,
867 GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, 0},
873 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
877 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR");
878 GNUNET_SCHEDULER_shutdown ();
882 GNUNET_CONFIGURATION_get_value_filename (cfg, "identity",
884 &subsystem_cfg_file))
886 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "SUBSYSTEM_CFG");
887 GNUNET_SCHEDULER_shutdown ();
890 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
891 "Loading subsystem configuration `%s'\n",
893 subsystem_cfg = GNUNET_CONFIGURATION_create ();
895 GNUNET_DISK_file_test (subsystem_cfg_file)) &&
897 GNUNET_CONFIGURATION_parse (subsystem_cfg,
898 subsystem_cfg_file)) )
900 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
901 _("Failed to parse subsystem identity configuration file `%s'\n"),
903 GNUNET_SCHEDULER_shutdown ();
906 stats = GNUNET_STATISTICS_create ("identity", cfg);
907 GNUNET_SERVER_add_handlers (server, handlers);
908 nc = GNUNET_SERVER_notification_context_create (server, 1);
910 GNUNET_DISK_directory_create (ego_directory))
912 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
913 _("Failed to create directory `%s' for storing egos\n"),
916 GNUNET_DISK_directory_scan (ego_directory,
919 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
925 * The main function for the network size estimation service.
927 * @param argc number of arguments from the command line
928 * @param argv command line arguments
929 * @return 0 ok, 1 on error
932 main (int argc, char *const *argv)
935 GNUNET_SERVICE_run (argc, argv, "identity",
936 GNUNET_SERVICE_OPTION_NONE,
937 &run, NULL)) ? 0 : 1;
941 /* end of gnunet-service-identity.c */