2 This file is part of GNUnet.
3 (C) 2006, 2007, 2008, 2009 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 2, 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 src/util/configuration.c
23 * @brief configuration management
25 * @author Christian Grothoff
29 #include "gnunet_common.h"
30 #include "gnunet_configuration_lib.h"
31 #include "gnunet_crypto_lib.h"
32 #include "gnunet_disk_lib.h"
33 #include "gnunet_os_lib.h"
34 #include "gnunet_strings_lib.h"
38 * @brief configuration entry
44 * This is a linked list.
46 struct ConfigEntry *next;
54 * current, commited value
61 * @brief configuration section
66 * This is a linked list.
68 struct ConfigSection *next;
71 * entries in the section
73 struct ConfigEntry *entries;
83 * @brief configuration data
85 struct GNUNET_CONFIGURATION_Handle
88 * Configuration sections.
90 struct ConfigSection *sections;
93 * Modification indication since last save
94 * GNUNET_NO if clean, GNUNET_YES if dirty,
95 * GNUNET_SYSERR on error (i.e. last save failed)
102 * Used for diffing a configuration object against
105 struct GNUNNET_CONFIGURATION_Diff_Handle
107 struct GNUNET_CONFIGURATION_Handle *cfgNew;
108 struct GNUNET_CONFIGURATION_Handle *cfgDiff;
114 * Create a GNUNET_CONFIGURATION_Handle.
116 * @return fresh configuration object
118 struct GNUNET_CONFIGURATION_Handle *
119 GNUNET_CONFIGURATION_create ()
121 return GNUNET_malloc (sizeof (struct GNUNET_CONFIGURATION_Handle));
126 * Destroy configuration object.
128 * @param cfg configuration to destroy
131 GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg)
133 struct ConfigSection *sec;
134 struct ConfigEntry *ent;
136 while (NULL != (sec = cfg->sections))
138 cfg->sections = sec->next;
139 while (NULL != (ent = sec->entries))
141 sec->entries = ent->next;
142 GNUNET_free (ent->key);
143 GNUNET_free_non_null (ent->val);
146 GNUNET_free (sec->name);
154 * Parse a configuration file, add all of the options in the
155 * file to the configuration environment.
157 * @param cfg configuration to update
158 * @param filename name of the configuration file
159 * @return GNUNET_OK on success, GNUNET_SYSERR on error
162 GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
163 const char *filename)
177 fn = GNUNET_STRINGS_filename_expand (filename);
178 dirty = cfg->dirty; /* back up value! */
179 if (NULL == (fp = FOPEN (fn, "r")))
181 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fopen", fn);
183 return GNUNET_SYSERR;
187 section = GNUNET_strdup ("");
188 memset (line, 0, 256);
190 while (NULL != fgets (line, 255, fp))
193 for (i = 0; i < 255; i++)
196 if (line[0] == '\n' || line[0] == '#' || line[0] == '%' ||
200 for (i = 0; (i < 255 && line[i] != 0); i++)
201 if (line[i] != ' ' && line[i] != '\n' && line[i] != '\r')
205 /* remove tailing whitespace */
206 for (i = strlen (line) - 1; (i >= 0) && (isspace (line[i])); i--)
208 if (1 == sscanf (line, "@INLINE@ %191[^\n]", value))
211 if (0 != GNUNET_CONFIGURATION_parse (cfg, value))
212 ret = GNUNET_SYSERR; /* failed to parse included config */
214 else if (1 == sscanf (line, "[%99[^]]]", value))
217 GNUNET_free (section);
218 section = GNUNET_strdup (value);
220 else if (2 == sscanf (line, " %63[^= ] = %191[^\n]", tag, value))
224 i = strlen (value) - 1;
225 while ((i >= 0) && (isspace (value[i])))
232 while ((value[i] != '\0') && (value[i] != '"'))
242 GNUNET_CONFIGURATION_set_value_string (cfg,
243 section, tag, &value[i]);
245 else if (1 == sscanf (line, " %63[^= ] =[^\n]", tag))
248 GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, "");
253 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
255 ("Syntax error in configuration file `%s' at line %u.\n"),
261 GNUNET_assert (0 == fclose (fp));
262 /* restore dirty flag - anything we set in the meantime
265 GNUNET_free (section);
271 * Test if there are configuration options that were
272 * changed since the last save.
274 * @param cfg configuration to inspect
275 * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed)
278 GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg)
285 * Write configuration file.
287 * @param cfg configuration to write
288 * @param filename where to write the configuration
289 * @return GNUNET_OK on success, GNUNET_SYSERR on error
292 GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
293 const char *filename)
295 struct ConfigSection *sec;
296 struct ConfigEntry *ent;
303 fn = GNUNET_STRINGS_filename_expand (filename);
304 GNUNET_DISK_directory_create_for_file (fn);
305 if (NULL == (fp = FOPEN (fn, "w")))
307 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fopen", fn);
309 return GNUNET_SYSERR;
316 if (0 > fprintf (fp, "[%s]\n", sec->name))
324 if (ent->val != NULL)
326 val = GNUNET_malloc (strlen (ent->val) * 2 + 1);
327 strcpy (val, ent->val);
328 while (NULL != (pos = strstr (val, "\n")))
330 memmove (&pos[2], &pos[1], strlen (&pos[1]));
334 if (0 > fprintf (fp, "%s = %s\n", ent->key, val))
346 if (0 > fprintf (fp, "\n"))
354 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fprintf", filename);
355 GNUNET_assert (0 == fclose (fp));
358 cfg->dirty = GNUNET_SYSERR; /* last write failed */
359 return GNUNET_SYSERR;
361 cfg->dirty = GNUNET_NO; /* last write succeeded */
367 * Iterate over all options in the configuration.
369 * @param cfg configuration to inspect
370 * @param iter function to call on each option
371 * @param iter_cls closure for iter
374 GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
375 GNUNET_CONFIGURATION_Iterator iter,
378 struct ConfigSection *spos;
379 struct ConfigEntry *epos;
381 spos = cfg->sections;
384 epos = spos->entries;
387 iter (iter_cls, spos->name, epos->key, epos->val);
396 * Copy a configuration value to the given target configuration.
397 * Overwrites existing entries.
399 * @param cls the destination configuration (struct GNUNET_CONFIGURATION_Handle*)
400 * @param section section for the value
401 * @param option option name of the value
402 * @param value value to copy
405 copy_entry (void *cls,
406 const char *section, const char *option, const char *value)
408 struct GNUNET_CONFIGURATION_Handle *dst = cls;
409 GNUNET_CONFIGURATION_set_value_string (dst, section, option, value);
414 * Duplicate an existing configuration object.
416 * @param cfg configuration to duplicate
417 * @return duplicate configuration
419 struct GNUNET_CONFIGURATION_Handle *
420 GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg)
422 struct GNUNET_CONFIGURATION_Handle *ret;
424 ret = GNUNET_CONFIGURATION_create ();
425 GNUNET_CONFIGURATION_iterate (cfg, ©_entry, ret);
434 * @param section FIXME
435 * @return matching entry, NULL if not found
437 static struct ConfigSection *
438 findSection (const struct GNUNET_CONFIGURATION_Handle *cfg,
441 struct ConfigSection *pos;
444 while ((pos != NULL) && (0 != strcasecmp (section, pos->name)))
454 * @param section FIXME
456 * @return matching entry, NULL if not found
458 static struct ConfigEntry *
459 findEntry (const struct GNUNET_CONFIGURATION_Handle *cfg,
460 const char *section, const char *key)
462 struct ConfigSection *sec;
463 struct ConfigEntry *pos;
465 sec = findSection (cfg, section);
469 while ((pos != NULL) && (0 != strcasecmp (key, pos->key)))
476 * A callback function, compares entries from two configurations (default against a new configuration)
477 * and write the diffs in a diff-configuration object (the callback object).
478 * @param cls the diff configuration (ConfigurationDiffHandle*)
479 * @param section section for the value (of the default conf.)
480 * @param option option name of the value (of the default conf.)
481 * @param value value to copy (of the default conf.)
484 compareEntries (void *cls,
485 const char *section, const char *option, const char *value)
487 struct ConfigSection *secNew;
488 struct ConfigEntry *entNew;
489 struct GNUNNET_CONFIGURATION_Diff_Handle *cfgDiff =
490 (struct GNUNNET_CONFIGURATION_Diff_Handle *) cls;
492 secNew = findSection (cfgDiff->cfgNew, section);
493 entNew = findEntry (cfgDiff->cfgNew, section, option);
494 if (secNew && strcmp (entNew->val, value) != 0)
496 /* Value in the new configuration has been changed */
497 /* Add the changed value to the diff configuration object */
498 struct ConfigEntry *diffEntry = NULL;
499 struct ConfigSection *diffSection = NULL;
501 diffSection = cfgDiff->cfgDiff->sections;
502 if (diffSection == NULL)
505 diffSection = GNUNET_malloc (sizeof (struct ConfigSection));
506 memcpy (diffSection, secNew, sizeof (struct ConfigSection));
507 cfgDiff->cfgDiff->sections = diffSection;
508 diffSection->entries = NULL;
509 diffSection->next = NULL;
513 while ((strcmp (diffSection->name, secNew->name) != 0)
514 && (diffSection->next != NULL))
516 diffSection = diffSection->next;
518 if (strcmp (diffSection->name, secNew->name) != 0)
520 /* Section not found in diffs configuration */
522 GNUNET_malloc (sizeof (struct ConfigSection));
523 memcpy (diffSection->next, secNew,
524 sizeof (struct ConfigSection));
525 diffSection->next->entries = NULL;
526 diffSection->next->next = NULL;
530 diffEntry = diffSection->entries;
534 if (diffEntry == NULL)
537 diffEntry = GNUNET_malloc (sizeof (struct ConfigEntry));
538 memcpy (diffEntry, entNew, sizeof (struct ConfigEntry));
539 if (diffSection->next == NULL)
540 /* The first Entry of the first Section */
541 diffSection->entries = diffEntry;
543 /* The first entry of the non-first Section */
544 diffSection->next->entries = diffEntry;
545 diffEntry->next = NULL;
549 while (diffEntry->next != NULL)
551 diffEntry = diffEntry->next;
553 diffEntry->next = GNUNET_malloc (sizeof (struct ConfigEntry));
554 memcpy (diffEntry->next, entNew, sizeof (struct ConfigEntry));
555 diffEntry->next->next = NULL;
562 * Write only configuration entries that have been changed to configuration file
563 * @param cfgDefault default configuration
564 * @param cfgNew new configuration
565 * @param filename where to write the configuration diff between default and new
566 * @return GNUNET_OK on success, GNUNET_SYSERR on error
569 GNUNET_CONFIGURATION_write_diffs (struct GNUNET_CONFIGURATION_Handle
571 struct GNUNET_CONFIGURATION_Handle *cfgNew,
572 const char *filename)
575 struct GNUNNET_CONFIGURATION_Diff_Handle diffHandle;
576 diffHandle.cfgDiff = GNUNET_CONFIGURATION_create ();
577 diffHandle.cfgDiff->sections = NULL;
578 diffHandle.cfgNew = cfgNew;
579 GNUNET_CONFIGURATION_iterate (cfgDefault, compareEntries, &diffHandle);
581 ret = GNUNET_CONFIGURATION_write (diffHandle.cfgDiff, filename);
584 GNUNET_CONFIGURATION_destroy (diffHandle.cfgDiff);
590 * Set a configuration value that should be a string.
592 * @param cfg configuration to update
593 * @param section section of interest
594 * @param option option of interest
595 * @param value value to set
598 GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle
601 const char *option, const char *value)
603 struct ConfigSection *sec;
604 struct ConfigEntry *e;
606 e = findEntry (cfg, section, option);
609 GNUNET_free_non_null (e->val);
610 e->val = GNUNET_strdup (value);
613 sec = findSection (cfg, section);
616 sec = GNUNET_malloc (sizeof (struct ConfigSection));
617 sec->name = GNUNET_strdup (section);
618 sec->next = cfg->sections;
621 e = GNUNET_malloc (sizeof (struct ConfigEntry));
622 e->key = GNUNET_strdup (option);
623 e->val = GNUNET_strdup (value);
624 e->next = sec->entries;
630 * Set a configuration value that should be a number.
632 * @param cfg configuration to update
633 * @param section section of interest
634 * @param option option of interest
635 * @param number value to set
638 GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle
639 *cfg, const char *section,
641 unsigned long long number)
644 GNUNET_snprintf (s, 64, "%llu", number);
645 GNUNET_CONFIGURATION_set_value_string (cfg, section, option, s);
650 * Get a configuration value that should be a number.
652 * @param cfg configuration to inspect
653 * @param section section of interest
654 * @param option option of interest
655 * @param number where to store the numeric value of the option
656 * @return GNUNET_OK on success, GNUNET_SYSERR on error
659 GNUNET_CONFIGURATION_get_value_number (const struct
660 GNUNET_CONFIGURATION_Handle *cfg,
663 unsigned long long *number)
665 struct ConfigEntry *e;
667 e = findEntry (cfg, section, option);
669 return GNUNET_SYSERR;
670 if (1 != SSCANF (e->val, "%llu", number))
671 return GNUNET_SYSERR;
677 * Get a configuration value that should be a relative time.
679 * @param cfg configuration to inspect
680 * @param section section of interest
681 * @param option option of interest
682 * @param time set to the time value stored in the configuration
683 * @return GNUNET_OK on success, GNUNET_SYSERR on error
686 GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle
687 *cfg, const char *section,
689 struct GNUNET_TIME_Relative *time)
691 unsigned long long num;
694 ret = GNUNET_CONFIGURATION_get_value_number (cfg, section, option, &num);
695 if (ret == GNUNET_OK)
696 time->value = (uint64_t) num;
702 * Get a configuration value that should be a string.
704 * @param cfg configuration to inspect
705 * @param section section of interest
706 * @param option option of interest
707 * @param value will be set to a freshly allocated configuration
708 * value, or NULL if option is not specified
709 * @return GNUNET_OK on success, GNUNET_SYSERR on error
712 GNUNET_CONFIGURATION_get_value_string (const struct
713 GNUNET_CONFIGURATION_Handle *cfg,
715 const char *option, char **value)
717 struct ConfigEntry *e;
719 e = findEntry (cfg, section, option);
720 if ((e == NULL) || (e->val == NULL))
723 return GNUNET_SYSERR;
725 *value = GNUNET_strdup (e->val);
731 * Get a configuration value that should be in a set of
734 * @param cfg configuration to inspect
735 * @param section section of interest
736 * @param option option of interest
737 * @param choices NULL-terminated list of legal values
738 * @param value will be set to an entry in the legal list,
739 * or NULL if option is not specified and no default given
740 * @return GNUNET_OK on success, GNUNET_SYSERR on error
743 GNUNET_CONFIGURATION_get_value_choice (const struct
744 GNUNET_CONFIGURATION_Handle *cfg,
747 const char **choices,
750 struct ConfigEntry *e;
753 e = findEntry (cfg, section, option);
755 return GNUNET_SYSERR;
757 while (choices[i] != NULL)
759 if (0 == strcasecmp (choices[i], e->val))
763 if (choices[i] == NULL)
765 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
766 _("Configuration value '%s' for '%s'"
767 " in section '%s' is not in set of legal choices\n"),
768 e->val, option, section);
769 return GNUNET_SYSERR;
777 * Test if we have a value for a particular option
778 * @param cfg configuration to inspect
779 * @param section section of interest
780 * @param option option of interest
781 * @return GNUNET_YES if so, GNUNET_NO if not.
784 GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle
785 *cfg, const char *section,
788 struct ConfigEntry *e;
789 if ((NULL == (e = findEntry (cfg, section, option))) || (e->val == NULL))
796 * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
797 * where either in the "PATHS" section or the environtment
798 * "FOO" is set to "DIRECTORY".
800 * @param cfg configuration to use for path expansion
801 * @param orig string to $-expand (will be freed!)
802 * @return $-expanded string
805 GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
817 while ((orig[i] != '/') && (orig[i] != '\\') && (orig[i] != '\0'))
828 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
832 if (NULL == (env = getenv (&orig[1])))
834 orig[i] = DIR_SEPARATOR;
837 prefix = GNUNET_strdup (env);
839 result = GNUNET_malloc (strlen (prefix) + strlen (post) + 2);
840 strcpy (result, prefix);
841 if ((strlen (prefix) == 0) ||
842 ((prefix[strlen (prefix) - 1] != DIR_SEPARATOR) && (strlen (post) > 0)))
843 strcat (result, DIR_SEPARATOR_STR);
844 strcat (result, post);
845 GNUNET_free (prefix);
852 * Get a configuration value that should be a string.
854 * @param cfg configuration to inspect
855 * @param section section of interest
856 * @param option option of interest
857 * @param value will be set to a freshly allocated configuration
858 * value, or NULL if option is not specified
859 * @return GNUNET_OK on success, GNUNET_SYSERR on error
862 GNUNET_CONFIGURATION_get_value_filename (const struct
863 GNUNET_CONFIGURATION_Handle *cfg,
865 const char *option, char **value)
871 ret = GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp);
872 if (ret == GNUNET_SYSERR)
876 tmp = GNUNET_CONFIGURATION_expand_dollar (cfg, tmp);
877 *value = GNUNET_STRINGS_filename_expand (tmp);
891 * Get a configuration value that should be in a set of
892 * "GNUNET_YES" or "GNUNET_NO".
894 * @param cfg configuration to inspect
895 * @param section section of interest
896 * @param option option of interest
897 * @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR
900 GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle
901 *cfg, const char *section,
904 static const char *yesno[] = { "YES", "NO", NULL };
908 ret = GNUNET_CONFIGURATION_get_value_choice (cfg,
909 section, option, yesno, &val);
910 if (ret == GNUNET_SYSERR)
919 * Iterate over the set of filenames stored in a configuration value.
921 * @param cfg configuration to inspect
922 * @param section section of interest
923 * @param option option of interest
924 * @param cb function to call on each filename
925 * @param cb_cls closure for cb
926 * @return number of filenames iterated over, -1 on error
929 GNUNET_CONFIGURATION_iterate_value_filenames (const struct
930 GNUNET_CONFIGURATION_Handle
931 *cfg, const char *section,
933 GNUNET_FileNameCallback cb,
943 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &list))
945 GNUNET_assert (list != NULL);
950 while (pos[0] == ' ')
952 if (strlen (pos) == 0)
955 while ((end[0] != ' ') && (end[0] != '\0'))
963 memmove (end, &end[1], strlen (&end[1]) + 1);
965 /* illegal, but just keep it */
968 /* illegal, but just ignore that there was a '/' */
976 if (strlen (pos) > 0)
979 if ((cb != NULL) && (GNUNET_OK != cb (cb_cls, pos)))
1001 escape_name (const char *value)
1007 escaped = GNUNET_malloc (strlen (value) * 2 + 1);
1008 memset (escaped, 0, strlen (value) * 2 + 1);
1011 while (rpos[0] != '\0')
1034 * @param cls string we compare with (const char*)
1035 * @param fn filename we are currently looking at
1036 * @return GNUNET_OK if the names do not match, GNUNET_SYSERR if they do
1039 test_match (void *cls, const char *fn)
1041 const char *of = cls;
1042 return (0 == strcmp (of, fn)) ? GNUNET_SYSERR : GNUNET_OK;
1047 * Append a filename to a configuration value that
1048 * represents a list of filenames
1050 * @param cfg configuration to update
1051 * @param section section of interest
1052 * @param option option of interest
1053 * @param value filename to append
1054 * @return GNUNET_OK on success,
1055 * GNUNET_NO if the filename already in the list
1056 * GNUNET_SYSERR on error
1059 GNUNET_CONFIGURATION_append_value_filename (struct GNUNET_CONFIGURATION_Handle
1061 const char *section,
1070 == GNUNET_CONFIGURATION_iterate_value_filenames (cfg,
1075 return GNUNET_NO; /* already exists */
1077 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &old))
1078 old = GNUNET_strdup ("");
1079 escaped = escape_name (value);
1080 nw = GNUNET_malloc (strlen (old) + strlen (escaped) + 2);
1083 strcat (nw, escaped);
1084 GNUNET_CONFIGURATION_set_value_string (cfg, section, option, nw);
1087 GNUNET_free (escaped);
1093 * Remove a filename from a configuration value that
1094 * represents a list of filenames
1096 * @param cfg configuration to update
1097 * @param section section of interest
1098 * @param option option of interest
1099 * @param value filename to remove
1100 * @return GNUNET_OK on success,
1101 * GNUNET_NO if the filename is not in the list,
1102 * GNUNET_SYSERR on error
1105 GNUNET_CONFIGURATION_remove_value_filename (struct GNUNET_CONFIGURATION_Handle
1107 const char *section,
1118 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &list))
1120 match = escape_name (value);
1124 while (pos[0] == ' ')
1126 if (strlen (pos) == 0)
1129 while ((end[0] != ' ') && (end[0] != '\0'))
1140 /* illegal, but just keep it */
1143 /* illegal, but just ignore that there was a '/' */
1151 if (strlen (pos) > 0)
1153 if (0 == strcmp (pos, match))
1155 memmove (pos, &end[1], strlen (&end[1]) + 1);
1158 pos[-1] = ' '; /* previously changed to "\0" */
1159 GNUNET_CONFIGURATION_set_value_string (cfg,
1160 section, option, list);
1162 GNUNET_free (match);
1171 GNUNET_free (match);
1177 * Load configuration (starts with defaults, then loads
1178 * system-specific configuration).
1180 * @param cfg configuration to update
1181 * @param filename name of the configuration file
1182 * @return GNUNET_OK on success, GNUNET_SYSERR on error
1185 GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
1186 const char *filename)
1191 ipath = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
1193 return GNUNET_SYSERR;
1195 GNUNET_asprintf (&baseconfig,
1196 "%s%s%s", ipath, DIR_SEPARATOR_STR, "defaults.conf");
1197 GNUNET_free (ipath);
1199 GNUNET_CONFIGURATION_parse (cfg, baseconfig)) ||
1200 (!((filename == NULL) ||
1201 (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, filename)))))
1203 GNUNET_free (baseconfig);
1204 return GNUNET_SYSERR;
1206 GNUNET_free (baseconfig);
1207 if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg,
1210 (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg,
1213 GNUNET_CRYPTO_random_disable_entropy_gathering ();
1219 /* end of configuration.c */