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{
106 struct GNUNET_CONFIGURATION_Handle* cfgNew;
107 struct GNUNET_CONFIGURATION_Handle* cfgDiff;
113 * Create a GNUNET_CONFIGURATION_Handle.
115 * @return fresh configuration object
117 struct GNUNET_CONFIGURATION_Handle *
118 GNUNET_CONFIGURATION_create ()
120 return GNUNET_malloc (sizeof (struct GNUNET_CONFIGURATION_Handle));
125 * Destroy configuration object.
127 * @param cfg configuration to destroy
130 GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg)
132 struct ConfigSection *sec;
133 struct ConfigEntry *ent;
135 while (NULL != (sec = cfg->sections))
137 cfg->sections = sec->next;
138 while (NULL != (ent = sec->entries))
140 sec->entries = ent->next;
141 GNUNET_free (ent->key);
142 GNUNET_free_non_null (ent->val);
145 GNUNET_free (sec->name);
153 * Parse a configuration file, add all of the options in the
154 * file to the configuration environment.
156 * @param cfg configuration to update
157 * @param filename name of the configuration file
158 * @return GNUNET_OK on success, GNUNET_SYSERR on error
161 GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
162 const char *filename)
176 fn = GNUNET_STRINGS_filename_expand (filename);
177 dirty = cfg->dirty; /* back up value! */
178 if (NULL == (fp = FOPEN (fn, "r")))
180 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fopen", fn);
182 return GNUNET_SYSERR;
186 section = GNUNET_strdup ("");
187 memset (line, 0, 256);
189 while (NULL != fgets (line, 255, fp))
192 for (i = 0; i < 255; i++)
195 if (line[0] == '\n' || line[0] == '#' || line[0] == '%' ||
199 for (i = 0; (i < 255 && line[i] != 0); i++)
200 if (line[i] != ' ' && line[i] != '\n' && line[i] != '\r')
204 /* remove tailing whitespace */
205 for (i = strlen (line) - 1; (i >= 0) && (isspace (line[i])); i--)
207 if (1 == sscanf (line, "@INLINE@ %191[^\n]", value))
210 if (0 != GNUNET_CONFIGURATION_parse (cfg, value))
211 ret = GNUNET_SYSERR; /* failed to parse included config */
213 else if (1 == sscanf (line, "[%99[^]]]", value))
216 GNUNET_free (section);
217 section = GNUNET_strdup (value);
219 else if (2 == sscanf (line, " %63[^= ] = %191[^\n]", tag, value))
223 i = strlen (value) - 1;
224 while ((i >= 0) && (isspace (value[i])))
231 while ((value[i] != '\0') && (value[i] != '"'))
241 GNUNET_CONFIGURATION_set_value_string (cfg,
242 section, tag, &value[i]);
244 else if (1 == sscanf (line, " %63[^= ] =[^\n]", tag))
247 GNUNET_CONFIGURATION_set_value_string (cfg, section, tag, "");
252 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
254 ("Syntax error in configuration file `%s' at line %u.\n"),
260 GNUNET_assert (0 == fclose (fp));
261 /* restore dirty flag - anything we set in the meantime
264 GNUNET_free (section);
270 * Test if there are configuration options that were
271 * changed since the last save.
273 * @param cfg configuration to inspect
274 * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed)
277 GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg)
284 * Write configuration file.
286 * @param cfg configuration to write
287 * @param filename where to write the configuration
288 * @return GNUNET_OK on success, GNUNET_SYSERR on error
291 GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
292 const char *filename)
294 struct ConfigSection *sec;
295 struct ConfigEntry *ent;
302 fn = GNUNET_STRINGS_filename_expand (filename);
303 GNUNET_DISK_directory_create_for_file (fn);
304 if (NULL == (fp = FOPEN (fn, "w")))
306 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fopen", fn);
308 return GNUNET_SYSERR;
315 if (0 > fprintf (fp, "[%s]\n", sec->name))
323 if (ent->val != NULL)
325 val = GNUNET_malloc (strlen (ent->val) * 2 + 1);
326 strcpy (val, ent->val);
327 while (NULL != (pos = strstr (val, "\n")))
329 memmove (&pos[2], &pos[1], strlen (&pos[1]));
333 if (0 > fprintf (fp, "%s = %s\n", ent->key, val))
345 if (0 > fprintf (fp, "\n"))
353 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fprintf", filename);
354 GNUNET_assert (0 == fclose (fp));
357 cfg->dirty = GNUNET_SYSERR; /* last write failed */
358 return GNUNET_SYSERR;
360 cfg->dirty = GNUNET_NO; /* last write succeeded */
366 * Iterate over all options in the configuration.
368 * @param cfg configuration to inspect
369 * @param iter function to call on each option
370 * @param iter_cls closure for iter
373 GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
374 GNUNET_CONFIGURATION_Iterator iter,
377 struct ConfigSection *spos;
378 struct ConfigEntry *epos;
380 spos = cfg->sections;
383 epos = spos->entries;
386 iter (iter_cls, spos->name, epos->key, epos->val);
395 * Copy a configuration value to the given target configuration.
396 * Overwrites existing entries.
398 * @param cls the destination configuration (struct GNUNET_CONFIGURATION_Handle*)
399 * @param section section for the value
400 * @param option option name of the value
401 * @param value value to copy
404 copy_entry (void *cls,
405 const char *section, const char *option, const char *value)
407 struct GNUNET_CONFIGURATION_Handle *dst = cls;
408 GNUNET_CONFIGURATION_set_value_string (dst, section, option, value);
413 * Duplicate an existing configuration object.
415 * @param cfg configuration to duplicate
416 * @return duplicate configuration
418 struct GNUNET_CONFIGURATION_Handle *
419 GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg)
421 struct GNUNET_CONFIGURATION_Handle *ret;
423 ret = GNUNET_CONFIGURATION_create ();
424 GNUNET_CONFIGURATION_iterate (cfg, ©_entry, ret);
433 * @param section FIXME
434 * @return matching entry, NULL if not found
436 static struct ConfigSection *
437 findSection (const struct GNUNET_CONFIGURATION_Handle *cfg,
440 struct ConfigSection *pos;
443 while ((pos != NULL) && (0 != strcasecmp (section, pos->name)))
453 * @param section FIXME
455 * @return matching entry, NULL if not found
457 static struct ConfigEntry *
458 findEntry (const struct GNUNET_CONFIGURATION_Handle *cfg,
459 const char *section, const char *key)
461 struct ConfigSection *sec;
462 struct ConfigEntry *pos;
464 sec = findSection (cfg, section);
468 while ((pos != NULL) && (0 != strcasecmp (key, pos->key)))
475 * A callback function, compares entries from two configurations (default against a new configuration)
476 * and write the diffs in a diff-configuration object (the callback object).
477 * @param cls the diff configuration (ConfigurationDiffHandle*)
478 * @param section section for the value (of the default conf.)
479 * @param option option name of the value (of the default conf.)
480 * @param value value to copy (of the default conf.)
489 struct ConfigSection *secNew;
490 struct ConfigEntry *entNew;
491 struct GNUNNET_CONFIGURATION_Diff_Handle* cfgDiff = (struct GNUNNET_CONFIGURATION_Diff_Handle*)cls;
493 secNew = findSection(cfgDiff->cfgNew, section);
494 entNew = findEntry(cfgDiff->cfgNew, section, option);
495 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) {
504 diffSection = GNUNET_malloc(sizeof(struct ConfigSection));
505 memcpy(diffSection, secNew, sizeof(struct ConfigSection));
506 cfgDiff->cfgDiff->sections = diffSection;
507 diffSection->entries = NULL;
508 diffSection->next = NULL;
511 while ((strcmp(diffSection->name, secNew->name) != 0) && (diffSection->next != NULL)) {
512 diffSection = diffSection->next;
514 if (strcmp(diffSection->name, secNew->name) != 0) {
515 /* Section not found in diffs configuration */
516 diffSection->next = GNUNET_malloc(sizeof(struct ConfigSection));
517 memcpy(diffSection->next, secNew, sizeof(struct ConfigSection));
518 diffSection->next->entries = NULL;
519 diffSection->next->next = NULL;
522 diffEntry = diffSection->entries;
526 if (diffEntry == NULL) {
528 diffEntry = GNUNET_malloc(sizeof(struct ConfigEntry));
529 memcpy(diffEntry, entNew, sizeof(struct ConfigEntry));
530 if (diffSection->next == NULL)
531 /* The first Entry of the first Section */
532 diffSection->entries = diffEntry;
534 /* The first entry of the non-first Section */
535 diffSection->next->entries = diffEntry;
536 diffEntry->next = NULL;
539 while (diffEntry->next != NULL) {
540 diffEntry = diffEntry->next;
542 diffEntry->next = GNUNET_malloc(sizeof(struct ConfigEntry));
543 memcpy(diffEntry->next, entNew, sizeof(struct ConfigEntry));
544 diffEntry->next->next = NULL;
551 * Write only configuration entries that have been changed to configuration file
552 * @param cfgDefault default configuration
553 * @param cfgNew new configuration
554 * @param filename where to write the configuration diff between default and new
555 * @return GNUNET_OK on success, GNUNET_SYSERR on error
558 GNUNET_CONFIGURATION_write_diffs(
559 struct GNUNET_CONFIGURATION_Handle *cfgDefault,
560 struct GNUNET_CONFIGURATION_Handle *cfgNew,
565 struct GNUNNET_CONFIGURATION_Diff_Handle diffHandle;
566 diffHandle.cfgDiff = GNUNET_CONFIGURATION_create();
567 diffHandle.cfgDiff->sections = NULL;
568 diffHandle.cfgNew = cfgNew;
569 GNUNET_CONFIGURATION_iterate(cfgDefault, compareEntries, &diffHandle);
571 ret = GNUNET_CONFIGURATION_write(diffHandle.cfgDiff, filename);
574 GNUNET_CONFIGURATION_destroy(diffHandle.cfgDiff);
580 * Set a configuration value that should be a string.
582 * @param cfg configuration to update
583 * @param section section of interest
584 * @param option option of interest
585 * @param value value to set
588 GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle
591 const char *option, const char *value)
593 struct ConfigSection *sec;
594 struct ConfigEntry *e;
596 e = findEntry (cfg, section, option);
599 GNUNET_free_non_null (e->val);
600 e->val = GNUNET_strdup (value);
603 sec = findSection (cfg, section);
606 sec = GNUNET_malloc (sizeof (struct ConfigSection));
607 sec->name = GNUNET_strdup (section);
608 sec->next = cfg->sections;
611 e = GNUNET_malloc (sizeof (struct ConfigEntry));
612 e->key = GNUNET_strdup (option);
613 e->val = GNUNET_strdup (value);
614 e->next = sec->entries;
620 * Set a configuration value that should be a number.
622 * @param cfg configuration to update
623 * @param section section of interest
624 * @param option option of interest
625 * @param number value to set
628 GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle
629 *cfg, const char *section,
631 unsigned long long number)
634 GNUNET_snprintf (s, 64, "%llu", number);
635 GNUNET_CONFIGURATION_set_value_string (cfg, section, option, s);
640 * Get a configuration value that should be a number.
642 * @param cfg configuration to inspect
643 * @param section section of interest
644 * @param option option of interest
645 * @param number where to store the numeric value of the option
646 * @return GNUNET_OK on success, GNUNET_SYSERR on error
649 GNUNET_CONFIGURATION_get_value_number (const struct
650 GNUNET_CONFIGURATION_Handle *cfg,
653 unsigned long long *number)
655 struct ConfigEntry *e;
657 e = findEntry (cfg, section, option);
659 return GNUNET_SYSERR;
660 if (1 != SSCANF (e->val, "%llu", number))
661 return GNUNET_SYSERR;
667 * Get a configuration value that should be a relative time.
669 * @param cfg configuration to inspect
670 * @param section section of interest
671 * @param option option of interest
672 * @param time set to the time value stored in the configuration
673 * @return GNUNET_OK on success, GNUNET_SYSERR on error
676 GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle
677 *cfg, const char *section,
679 struct GNUNET_TIME_Relative *time)
681 unsigned long long num;
684 ret = GNUNET_CONFIGURATION_get_value_number (cfg, section, option, &num);
685 if (ret == GNUNET_OK)
686 time->value = (uint64_t) num;
692 * Get a configuration value that should be a string.
694 * @param cfg configuration to inspect
695 * @param section section of interest
696 * @param option option of interest
697 * @param value will be set to a freshly allocated configuration
698 * value, or NULL if option is not specified
699 * @return GNUNET_OK on success, GNUNET_SYSERR on error
702 GNUNET_CONFIGURATION_get_value_string (const struct
703 GNUNET_CONFIGURATION_Handle *cfg,
705 const char *option, char **value)
707 struct ConfigEntry *e;
709 e = findEntry (cfg, section, option);
710 if ((e == NULL) || (e->val == NULL))
713 return GNUNET_SYSERR;
715 *value = GNUNET_strdup (e->val);
721 * Get a configuration value that should be in a set of
724 * @param cfg configuration to inspect
725 * @param section section of interest
726 * @param option option of interest
727 * @param choices NULL-terminated list of legal values
728 * @param value will be set to an entry in the legal list,
729 * or NULL if option is not specified and no default given
730 * @return GNUNET_OK on success, GNUNET_SYSERR on error
733 GNUNET_CONFIGURATION_get_value_choice (const struct
734 GNUNET_CONFIGURATION_Handle *cfg,
737 const char **choices,
740 struct ConfigEntry *e;
743 e = findEntry (cfg, section, option);
745 return GNUNET_SYSERR;
747 while (choices[i] != NULL)
749 if (0 == strcasecmp (choices[i], e->val))
753 if (choices[i] == NULL)
755 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
756 _("Configuration value '%s' for '%s'"
757 " in section '%s' is not in set of legal choices\n"),
758 e->val, option, section);
759 return GNUNET_SYSERR;
767 * Test if we have a value for a particular option
768 * @param cfg configuration to inspect
769 * @param section section of interest
770 * @param option option of interest
771 * @return GNUNET_YES if so, GNUNET_NO if not.
774 GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle
775 *cfg, const char *section,
778 struct ConfigEntry *e;
779 if ((NULL == (e = findEntry (cfg, section, option))) || (e->val == NULL))
786 * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
787 * where either in the "PATHS" section or the environtment
788 * "FOO" is set to "DIRECTORY".
790 * @param cfg configuration to use for path expansion
791 * @param orig string to $-expand (will be freed!)
792 * @return $-expanded string
795 GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
807 while ((orig[i] != '/') && (orig[i] != '\\') && (orig[i] != '\0'))
818 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
822 if (NULL == (env = getenv (&orig[1])))
824 orig[i] = DIR_SEPARATOR;
827 prefix = GNUNET_strdup (env);
829 result = GNUNET_malloc (strlen (prefix) + strlen (post) + 2);
830 strcpy (result, prefix);
831 if ((strlen (prefix) == 0) ||
832 ((prefix[strlen (prefix) - 1] != DIR_SEPARATOR) && (strlen (post) > 0)))
833 strcat (result, DIR_SEPARATOR_STR);
834 strcat (result, post);
835 GNUNET_free (prefix);
842 * Get a configuration value that should be a string.
844 * @param cfg configuration to inspect
845 * @param section section of interest
846 * @param option option of interest
847 * @param value will be set to a freshly allocated configuration
848 * value, or NULL if option is not specified
849 * @return GNUNET_OK on success, GNUNET_SYSERR on error
852 GNUNET_CONFIGURATION_get_value_filename (const struct
853 GNUNET_CONFIGURATION_Handle *cfg,
855 const char *option, char **value)
861 ret = GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp);
862 if (ret == GNUNET_SYSERR)
866 tmp = GNUNET_CONFIGURATION_expand_dollar (cfg, tmp);
867 *value = GNUNET_STRINGS_filename_expand (tmp);
881 * Get a configuration value that should be in a set of
882 * "GNUNET_YES" or "GNUNET_NO".
884 * @param cfg configuration to inspect
885 * @param section section of interest
886 * @param option option of interest
887 * @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR
890 GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle
891 *cfg, const char *section,
894 static const char *yesno[] = { "YES", "NO", NULL };
898 ret = GNUNET_CONFIGURATION_get_value_choice (cfg,
899 section, option, yesno, &val);
900 if (ret == GNUNET_SYSERR)
909 * Iterate over the set of filenames stored in a configuration value.
911 * @param cfg configuration to inspect
912 * @param section section of interest
913 * @param option option of interest
914 * @param cb function to call on each filename
915 * @param cb_cls closure for cb
916 * @return number of filenames iterated over, -1 on error
919 GNUNET_CONFIGURATION_iterate_value_filenames (const struct
920 GNUNET_CONFIGURATION_Handle
921 *cfg, const char *section,
923 GNUNET_FileNameCallback cb,
933 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &list))
935 GNUNET_assert (list != NULL);
940 while (pos[0] == ' ')
942 if (strlen (pos) == 0)
945 while ((end[0] != ' ') && (end[0] != '\0'))
953 memmove (end, &end[1], strlen (&end[1]) + 1);
955 /* illegal, but just keep it */
958 /* illegal, but just ignore that there was a '/' */
966 if (strlen (pos) > 0)
969 if ((cb != NULL) && (GNUNET_OK != cb (cb_cls, pos)))
991 escape_name (const char *value)
997 escaped = GNUNET_malloc (strlen (value) * 2 + 1);
998 memset (escaped, 0, strlen (value) * 2 + 1);
1001 while (rpos[0] != '\0')
1024 * @param cls string we compare with (const char*)
1025 * @param fn filename we are currently looking at
1026 * @return GNUNET_OK if the names do not match, GNUNET_SYSERR if they do
1029 test_match (void *cls, const char *fn)
1031 const char *of = cls;
1032 return (0 == strcmp (of, fn)) ? GNUNET_SYSERR : GNUNET_OK;
1037 * Append a filename to a configuration value that
1038 * represents a list of filenames
1040 * @param cfg configuration to update
1041 * @param section section of interest
1042 * @param option option of interest
1043 * @param value filename to append
1044 * @return GNUNET_OK on success,
1045 * GNUNET_NO if the filename already in the list
1046 * GNUNET_SYSERR on error
1049 GNUNET_CONFIGURATION_append_value_filename (struct GNUNET_CONFIGURATION_Handle
1051 const char *section,
1060 == GNUNET_CONFIGURATION_iterate_value_filenames (cfg,
1065 return GNUNET_NO; /* already exists */
1067 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &old))
1068 old = GNUNET_strdup ("");
1069 escaped = escape_name (value);
1070 nw = GNUNET_malloc (strlen (old) + strlen (escaped) + 2);
1073 strcat (nw, escaped);
1074 GNUNET_CONFIGURATION_set_value_string (cfg, section, option, nw);
1077 GNUNET_free (escaped);
1083 * Remove a filename from a configuration value that
1084 * represents a list of filenames
1086 * @param cfg configuration to update
1087 * @param section section of interest
1088 * @param option option of interest
1089 * @param value filename to remove
1090 * @return GNUNET_OK on success,
1091 * GNUNET_NO if the filename is not in the list,
1092 * GNUNET_SYSERR on error
1095 GNUNET_CONFIGURATION_remove_value_filename (struct GNUNET_CONFIGURATION_Handle
1097 const char *section,
1108 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &list))
1110 match = escape_name (value);
1114 while (pos[0] == ' ')
1116 if (strlen (pos) == 0)
1119 while ((end[0] != ' ') && (end[0] != '\0'))
1130 /* illegal, but just keep it */
1133 /* illegal, but just ignore that there was a '/' */
1141 if (strlen (pos) > 0)
1143 if (0 == strcmp (pos, match))
1145 memmove (pos, &end[1], strlen (&end[1]) + 1);
1148 pos[-1] = ' '; /* previously changed to "\0" */
1149 GNUNET_CONFIGURATION_set_value_string (cfg,
1150 section, option, list);
1152 GNUNET_free (match);
1161 GNUNET_free (match);
1167 * Load configuration (starts with defaults, then loads
1168 * system-specific configuration).
1170 * @param cfg configuration to update
1171 * @param filename name of the configuration file
1172 * @return GNUNET_OK on success, GNUNET_SYSERR on error
1175 GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
1176 const char *filename)
1181 ipath = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
1183 return GNUNET_SYSERR;
1185 GNUNET_asprintf (&baseconfig,
1186 "%s%s%s", ipath, DIR_SEPARATOR_STR, "defaults.conf");
1187 GNUNET_free (ipath);
1189 GNUNET_CONFIGURATION_parse (cfg, baseconfig)) ||
1190 (!((filename == NULL) ||
1191 (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, filename)))))
1193 GNUNET_free (baseconfig);
1194 return GNUNET_SYSERR;
1196 GNUNET_free (baseconfig);
1197 if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (cfg,
1200 (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg,
1203 GNUNET_CRYPTO_random_disable_entropy_gathering ();
1209 /* end of configuration.c */