diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/configuration.c | 174 | ||||
-rw-r--r-- | src/util/disk.c | 72 | ||||
-rw-r--r-- | src/util/os_installation.c | 21 | ||||
-rw-r--r-- | src/util/resolver.conf.in | 1 | ||||
-rw-r--r-- | src/util/test_disk.c | 22 | ||||
-rw-r--r-- | src/util/util.conf | 31 |
6 files changed, 181 insertions, 140 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index 1b600b4c8..d7076fac1 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2006, 2007, 2008, 2009, 2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -414,7 +414,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
414 | } | 414 | } |
415 | /* For each key = value pair we need to add 4 characters (2 | 415 | /* For each key = value pair we need to add 4 characters (2 |
416 | spaces and 1 equal-to character and 1 new line) */ | 416 | spaces and 1 equal-to character and 1 new line) */ |
417 | m_size += strlen (ent->key) + strlen (ent->val) + 4; | 417 | m_size += strlen (ent->key) + strlen (ent->val) + 4; |
418 | } | 418 | } |
419 | } | 419 | } |
420 | /* A new line after section end */ | 420 | /* A new line after section end */ |
@@ -449,7 +449,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
449 | GNUNET_free (val); | 449 | GNUNET_free (val); |
450 | memcpy (mem + c_size, cbuf, len); | 450 | memcpy (mem + c_size, cbuf, len); |
451 | c_size += len; | 451 | c_size += len; |
452 | GNUNET_free (cbuf); | 452 | GNUNET_free (cbuf); |
453 | } | 453 | } |
454 | } | 454 | } |
455 | memcpy (mem + c_size, "\n", 1); | 455 | memcpy (mem + c_size, "\n", 1); |
@@ -993,7 +993,7 @@ GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle | |||
993 | * @param cfg configuration to inspect | 993 | * @param cfg configuration to inspect |
994 | * @param section section of interest | 994 | * @param section section of interest |
995 | * @param option option of interest | 995 | * @param option option of interest |
996 | * @return GNUNET_YES if so, GNUNET_NO if not. | 996 | * @return #GNUNET_YES if so, #GNUNET_NO if not. |
997 | */ | 997 | */ |
998 | int | 998 | int |
999 | GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, | 999 | GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -1009,71 +1009,183 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1009 | 1009 | ||
1010 | /** | 1010 | /** |
1011 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" | 1011 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" |
1012 | * where either in the "PATHS" section or the environtment | 1012 | * where either in the "PATHS" section or the environtment "FOO" is |
1013 | * "FOO" is set to "DIRECTORY". | 1013 | * set to "DIRECTORY". We also support default expansion, |
1014 | * i.e. ${VARIABLE:-default} will expand to $VARIABLE if VARIABLE is | ||
1015 | * set in PATHS or the environment, and otherwise to "default". Note | ||
1016 | * that "default" itself can also be a $-expression, thus | ||
1017 | * "${VAR1:-{$VAR2}}" will expand to VAR1 and if that is not defined | ||
1018 | * to VAR2. | ||
1014 | * | 1019 | * |
1015 | * @param cfg configuration to use for path expansion | 1020 | * @param cfg configuration to use for path expansion |
1016 | * @param orig string to $-expand (will be freed!) | 1021 | * @param orig string to $-expand (will be freed!) |
1022 | * @param depth recursion depth, used to detect recursive expansions | ||
1017 | * @return $-expanded string | 1023 | * @return $-expanded string |
1018 | */ | 1024 | */ |
1019 | char * | 1025 | static char * |
1020 | GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle | 1026 | expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1021 | *cfg, char *orig) | 1027 | char *orig, |
1028 | unsigned int depth) | ||
1022 | { | 1029 | { |
1023 | int i; | 1030 | int i; |
1024 | char *prefix; | 1031 | char *prefix; |
1025 | char *result; | 1032 | char *result; |
1033 | char *start; | ||
1026 | const char *post; | 1034 | const char *post; |
1027 | const char *env; | 1035 | const char *env; |
1036 | char *def; | ||
1037 | char *end; | ||
1038 | unsigned int lopen; | ||
1028 | 1039 | ||
1029 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to $-expand %s\n", orig); | 1040 | if (depth > 128) |
1030 | 1041 | { | |
1031 | if (orig[0] != '$') | 1042 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1043 | _("Recursive expansion suspected, aborting $-expansion for term `%s'\n"), | ||
1044 | orig); | ||
1045 | return orig; | ||
1046 | } | ||
1047 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1048 | "Asked to $-expand %s\n", orig); | ||
1049 | if ('$' != orig[0]) | ||
1032 | { | 1050 | { |
1033 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Doesn't start with $ - not expanding\n"); | 1051 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1052 | "Doesn't start with $ - not expanding\n"); | ||
1034 | return orig; | 1053 | return orig; |
1035 | } | 1054 | } |
1036 | i = 0; | 1055 | if ('{' == orig[1]) |
1037 | while ((orig[i] != '/') && (orig[i] != '\\') && (orig[i] != '\0')) | ||
1038 | i++; | ||
1039 | if (orig[i] == '\0') | ||
1040 | { | 1056 | { |
1041 | post = ""; | 1057 | start = &orig[2]; |
1058 | lopen = 1; | ||
1059 | end = &orig[1]; | ||
1060 | while (lopen > 0) | ||
1061 | { | ||
1062 | end++; | ||
1063 | switch (*end) | ||
1064 | { | ||
1065 | case '}': | ||
1066 | lopen--; | ||
1067 | break; | ||
1068 | case '{': | ||
1069 | lopen++; | ||
1070 | break; | ||
1071 | case '\0': | ||
1072 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1073 | _("Missing closing `%s' in option `%s'\n"), | ||
1074 | "}", | ||
1075 | orig); | ||
1076 | return orig; | ||
1077 | default: | ||
1078 | break; | ||
1079 | } | ||
1080 | } | ||
1081 | *end = '\0'; | ||
1082 | post = end + 1; | ||
1083 | def = strchr (orig, ':'); | ||
1084 | if (NULL != def) | ||
1085 | { | ||
1086 | *def = '\0'; | ||
1087 | def++; | ||
1088 | if ( ('-' == *def) || | ||
1089 | ('=' == *def) ) | ||
1090 | def++; | ||
1091 | def = GNUNET_strdup (def); | ||
1092 | } | ||
1042 | } | 1093 | } |
1043 | else | 1094 | else |
1044 | { | 1095 | { |
1045 | orig[i] = '\0'; | 1096 | start = &orig[1]; |
1046 | post = &orig[i + 1]; | 1097 | def = NULL; |
1098 | i = 0; | ||
1099 | while ( (orig[i] != '/') && | ||
1100 | (orig[i] != '\\') && | ||
1101 | (orig[i] != '\0') ) | ||
1102 | i++; | ||
1103 | if (orig[i] == '\0') | ||
1104 | { | ||
1105 | post = ""; | ||
1106 | } | ||
1107 | else | ||
1108 | { | ||
1109 | orig[i] = '\0'; | ||
1110 | post = &orig[i + 1]; | ||
1111 | } | ||
1047 | } | 1112 | } |
1048 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Split into `%s' and `%s'\n", orig, post); | 1113 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1114 | "Split into `%s' and `%s' with default %s\n", | ||
1115 | start, | ||
1116 | post, | ||
1117 | def); | ||
1049 | if (GNUNET_OK != | 1118 | if (GNUNET_OK != |
1050 | GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", &orig[1], &prefix)) | 1119 | GNUNET_CONFIGURATION_get_value_filename (cfg, |
1120 | "PATHS", | ||
1121 | start, | ||
1122 | &prefix)) | ||
1051 | { | 1123 | { |
1052 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Filename for `%s' is not in PATHS config section\n", &orig[1]); | 1124 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1053 | if (NULL == (env = getenv (&orig[1]))) | 1125 | "Filename for `%s' is not in PATHS config section\n", |
1126 | start); | ||
1127 | if (NULL == (env = getenv (start))) | ||
1128 | { | ||
1129 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1130 | "`%s' is not an environment variable\n", | ||
1131 | start); | ||
1132 | /* try default */ | ||
1133 | def = expand_dollar (cfg, def, depth + 1); | ||
1134 | env = def; | ||
1135 | } | ||
1136 | if (NULL == env) | ||
1054 | { | 1137 | { |
1055 | LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' is not an environment variable\n", &orig[1]); | 1138 | orig[strlen (orig)] = DIR_SEPARATOR; |
1056 | orig[i] = DIR_SEPARATOR; | 1139 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1057 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to `%s' (returning orig)\n", orig); | 1140 | "Expanded to `%s' (returning orig)\n", |
1141 | orig); | ||
1058 | return orig; | 1142 | return orig; |
1059 | } | 1143 | } |
1060 | prefix = GNUNET_strdup (env); | 1144 | prefix = GNUNET_strdup (env); |
1061 | } | 1145 | } |
1062 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Prefix is `%s'\n", prefix); | 1146 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1147 | "Prefix is `%s'\n", | ||
1148 | prefix); | ||
1063 | result = GNUNET_malloc (strlen (prefix) + strlen (post) + 2); | 1149 | result = GNUNET_malloc (strlen (prefix) + strlen (post) + 2); |
1064 | strcpy (result, prefix); | 1150 | strcpy (result, prefix); |
1065 | if ((strlen (prefix) == 0) || | 1151 | if ( (0 == strlen (prefix)) || |
1066 | ((prefix[strlen (prefix) - 1] != DIR_SEPARATOR) && (strlen (post) > 0))) | 1152 | ( (prefix[strlen (prefix) - 1] != DIR_SEPARATOR) && |
1153 | (strlen (post) > 0) ) ) | ||
1067 | strcat (result, DIR_SEPARATOR_STR); | 1154 | strcat (result, DIR_SEPARATOR_STR); |
1068 | strcat (result, post); | 1155 | strcat (result, post); |
1156 | GNUNET_free_non_null (def); | ||
1069 | GNUNET_free (prefix); | 1157 | GNUNET_free (prefix); |
1070 | GNUNET_free (orig); | 1158 | GNUNET_free (orig); |
1071 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Expanded to `%s'\n", result); | 1159 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1160 | "Expanded to `%s'\n", | ||
1161 | result); | ||
1072 | return result; | 1162 | return result; |
1073 | } | 1163 | } |
1074 | 1164 | ||
1075 | 1165 | ||
1076 | /** | 1166 | /** |
1167 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" | ||
1168 | * where either in the "PATHS" section or the environtment "FOO" is | ||
1169 | * set to "DIRECTORY". We also support default expansion, | ||
1170 | * i.e. ${VARIABLE:-default} will expand to $VARIABLE if VARIABLE is | ||
1171 | * set in PATHS or the environment, and otherwise to "default". Note | ||
1172 | * that "default" itself can also be a $-expression, thus | ||
1173 | * "${VAR1:-{$VAR2}}" will expand to VAR1 and if that is not defined | ||
1174 | * to VAR2. | ||
1175 | * | ||
1176 | * @param cfg configuration to use for path expansion | ||
1177 | * @param orig string to $-expand (will be freed!) | ||
1178 | * @return $-expanded string | ||
1179 | */ | ||
1180 | char * | ||
1181 | GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1182 | char *orig) | ||
1183 | { | ||
1184 | return expand_dollar (cfg, orig, 0); | ||
1185 | } | ||
1186 | |||
1187 | |||
1188 | /** | ||
1077 | * Get a configuration value that should be a string. | 1189 | * Get a configuration value that should be a string. |
1078 | * | 1190 | * |
1079 | * @param cfg configuration to inspect | 1191 | * @param cfg configuration to inspect |
diff --git a/src/util/disk.c b/src/util/disk.c index 8dc1e35bf..0d24d5a09 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -1928,78 +1928,6 @@ GNUNET_DISK_get_handle_from_native (FILE *fd) | |||
1928 | 1928 | ||
1929 | 1929 | ||
1930 | /** | 1930 | /** |
1931 | * Construct full path to a file inside of the private | ||
1932 | * directory used by GNUnet. Also creates the corresponding | ||
1933 | * directory. If the resulting name is supposed to be | ||
1934 | * a directory, end the last argument in '/' (or pass | ||
1935 | * DIR_SEPARATOR_STR as the last argument before NULL). | ||
1936 | * | ||
1937 | * @param cfg configuration to use (determines HOME) | ||
1938 | * @param service_name name of the service | ||
1939 | * @param ... is NULL-terminated list of | ||
1940 | * path components to append to the | ||
1941 | * private directory name. | ||
1942 | * @return the constructed filename | ||
1943 | */ | ||
1944 | char * | ||
1945 | GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1946 | const char *service_name, ...) | ||
1947 | { | ||
1948 | const char *c; | ||
1949 | char *pfx; | ||
1950 | char *ret; | ||
1951 | va_list ap; | ||
1952 | unsigned int needed; | ||
1953 | |||
1954 | if (GNUNET_OK != | ||
1955 | GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "HOME", &pfx)) | ||
1956 | return NULL; | ||
1957 | if (pfx == NULL) | ||
1958 | { | ||
1959 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1960 | _("No `%s' specified for service `%s' in configuration.\n"), "HOME", | ||
1961 | service_name); | ||
1962 | return NULL; | ||
1963 | } | ||
1964 | needed = strlen (pfx) + 2; | ||
1965 | if ((pfx[strlen (pfx) - 1] != '/') && (pfx[strlen (pfx) - 1] != '\\')) | ||
1966 | needed++; | ||
1967 | va_start (ap, service_name); | ||
1968 | while (1) | ||
1969 | { | ||
1970 | c = va_arg (ap, const char *); | ||
1971 | |||
1972 | if (c == NULL) | ||
1973 | break; | ||
1974 | needed += strlen (c); | ||
1975 | if ((c[strlen (c) - 1] != '/') && (c[strlen (c) - 1] != '\\')) | ||
1976 | needed++; | ||
1977 | } | ||
1978 | va_end (ap); | ||
1979 | ret = GNUNET_malloc (needed); | ||
1980 | strcpy (ret, pfx); | ||
1981 | GNUNET_free (pfx); | ||
1982 | va_start (ap, service_name); | ||
1983 | while (1) | ||
1984 | { | ||
1985 | c = va_arg (ap, const char *); | ||
1986 | |||
1987 | if (c == NULL) | ||
1988 | break; | ||
1989 | if ((c[strlen (c) - 1] != '/') && (c[strlen (c) - 1] != '\\')) | ||
1990 | strcat (ret, DIR_SEPARATOR_STR); | ||
1991 | strcat (ret, c); | ||
1992 | } | ||
1993 | va_end (ap); | ||
1994 | if ((ret[strlen (ret) - 1] != '/') && (ret[strlen (ret) - 1] != '\\')) | ||
1995 | (void) GNUNET_DISK_directory_create_for_file (ret); | ||
1996 | else | ||
1997 | (void) GNUNET_DISK_directory_create (ret); | ||
1998 | return ret; | ||
1999 | } | ||
2000 | |||
2001 | |||
2002 | /** | ||
2003 | * Handle for a memory-mapping operation. | 1931 | * Handle for a memory-mapping operation. |
2004 | */ | 1932 | */ |
2005 | struct GNUNET_DISK_MapHandle | 1933 | struct GNUNET_DISK_MapHandle |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 98ac7b989..8649fac6f 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 44 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) |
45 | 45 | ||
46 | |||
46 | #if LINUX | 47 | #if LINUX |
47 | /** | 48 | /** |
48 | * Try to determine path by reading /proc/PID/exe | 49 | * Try to determine path by reading /proc/PID/exe |
@@ -115,12 +116,13 @@ get_path_from_proc_exe () | |||
115 | } | 116 | } |
116 | #endif | 117 | #endif |
117 | 118 | ||
118 | #if WINDOWS | ||
119 | 119 | ||
120 | #if WINDOWS | ||
120 | static HINSTANCE dll_instance; | 121 | static HINSTANCE dll_instance; |
121 | 122 | ||
122 | 123 | ||
123 | /* GNUNET_util_cl_init() in common_logging.c is preferred. | 124 | /** |
125 | * GNUNET_util_cl_init() in common_logging.c is preferred. | ||
124 | * This function is only for thread-local storage (not used in GNUnet) | 126 | * This function is only for thread-local storage (not used in GNUnet) |
125 | * and hInstance saving. | 127 | * and hInstance saving. |
126 | */ | 128 | */ |
@@ -226,6 +228,7 @@ get_path_from_module_filename () | |||
226 | } | 228 | } |
227 | #endif | 229 | #endif |
228 | 230 | ||
231 | |||
229 | #if DARWIN | 232 | #if DARWIN |
230 | /** | 233 | /** |
231 | * Signature of the '_NSGetExecutablePath" function. | 234 | * Signature of the '_NSGetExecutablePath" function. |
@@ -415,8 +418,7 @@ os_get_gnunet_path () | |||
415 | return ret; | 418 | return ret; |
416 | /* other attempts here */ | 419 | /* other attempts here */ |
417 | LOG (GNUNET_ERROR_TYPE_ERROR, | 420 | LOG (GNUNET_ERROR_TYPE_ERROR, |
418 | _ | 421 | _("Could not determine installation path for %s. Set `%s' environment variable.\n"), |
419 | ("Could not determine installation path for %s. Set `%s' environment variable.\n"), | ||
420 | "GNUnet", "GNUNET_PREFIX"); | 422 | "GNUnet", "GNUNET_PREFIX"); |
421 | return NULL; | 423 | return NULL; |
422 | } | 424 | } |
@@ -452,7 +454,7 @@ os_get_exec_path () | |||
452 | 454 | ||
453 | /** | 455 | /** |
454 | * @brief get the path to a specific GNUnet installation directory or, | 456 | * @brief get the path to a specific GNUnet installation directory or, |
455 | * with GNUNET_IPK_SELF_PREFIX, the current running apps installation directory | 457 | * with #GNUNET_IPK_SELF_PREFIX, the current running apps installation directory |
456 | * @author Milan | 458 | * @author Milan |
457 | * @return a pointer to the dir path (to be freed by the caller) | 459 | * @return a pointer to the dir path (to be freed by the caller) |
458 | */ | 460 | */ |
@@ -657,9 +659,9 @@ GNUNET_OS_get_libexec_binary_path (const char *progname) | |||
657 | * binary with the -d flag. -d omits a programs main loop and only | 659 | * binary with the -d flag. -d omits a programs main loop and only |
658 | * executes all privileged operations in an binary. | 660 | * executes all privileged operations in an binary. |
659 | * @param params parameters used for w32 privilege checking (can be NULL for != w32 ) | 661 | * @param params parameters used for w32 privilege checking (can be NULL for != w32 ) |
660 | * @return GNUNET_YES if the file is SUID (*nix) or can be executed with current privileges (W32), | 662 | * @return #GNUNET_YES if the file is SUID (*nix) or can be executed with current privileges (W32), |
661 | * GNUNET_NO if not SUID (but binary exists), | 663 | * #GNUNET_NO if not SUID (but binary exists), |
662 | * GNUNET_SYSERR on error (no such binary or not executable) | 664 | * #GNUNET_SYSERR on error (no such binary or not executable) |
663 | */ | 665 | */ |
664 | int | 666 | int |
665 | GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *params) | 667 | GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *params) |
@@ -704,7 +706,8 @@ GNUNET_OS_check_helper_binary (const char *binary, int check_suid, const char *p | |||
704 | #endif | 706 | #endif |
705 | if (NULL == p) | 707 | if (NULL == p) |
706 | { | 708 | { |
707 | LOG (GNUNET_ERROR_TYPE_INFO, _("Could not find binary `%s' in PATH!\n"), | 709 | LOG (GNUNET_ERROR_TYPE_INFO, |
710 | _("Could not find binary `%s' in PATH!\n"), | ||
708 | binary); | 711 | binary); |
709 | return GNUNET_SYSERR; | 712 | return GNUNET_SYSERR; |
710 | } | 713 | } |
diff --git a/src/util/resolver.conf.in b/src/util/resolver.conf.in index cccb60c2f..42cc5855f 100644 --- a/src/util/resolver.conf.in +++ b/src/util/resolver.conf.in | |||
@@ -2,7 +2,6 @@ | |||
2 | AUTOSTART = YES | 2 | AUTOSTART = YES |
3 | @JAVAPORT@PORT = 2089 | 3 | @JAVAPORT@PORT = 2089 |
4 | HOSTNAME = localhost | 4 | HOSTNAME = localhost |
5 | HOME = $SERVICEHOME | ||
6 | BINARY = gnunet-service-resolver | 5 | BINARY = gnunet-service-resolver |
7 | ACCEPT_FROM = 127.0.0.1; | 6 | ACCEPT_FROM = 127.0.0.1; |
8 | ACCEPT_FROM6 = ::1; | 7 | ACCEPT_FROM6 = ::1; |
diff --git a/src/util/test_disk.c b/src/util/test_disk.c index 7579ac7dc..40e6b079c 100644 --- a/src/util/test_disk.c +++ b/src/util/test_disk.c | |||
@@ -169,27 +169,6 @@ testDirIter () | |||
169 | 169 | ||
170 | 170 | ||
171 | static int | 171 | static int |
172 | testGetHome () | ||
173 | { | ||
174 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
175 | char *fn; | ||
176 | int ret; | ||
177 | |||
178 | cfg = GNUNET_CONFIGURATION_create (); | ||
179 | GNUNET_assert (cfg != NULL); | ||
180 | GNUNET_CONFIGURATION_set_value_string (cfg, "service", "HOME", | ||
181 | "/tmp/test-gnunet-disk-a/b/c"); | ||
182 | fn = GNUNET_DISK_get_home_filename (cfg, "service", "d", "e", NULL); | ||
183 | GNUNET_assert (fn != NULL); | ||
184 | GNUNET_CONFIGURATION_destroy (cfg); | ||
185 | ret = strcmp ("/tmp/test-gnunet-disk-a/b/c/d/e", fn); | ||
186 | GNUNET_free (fn); | ||
187 | GNUNET_break (GNUNET_OK == | ||
188 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-disk-a")); | ||
189 | return ret; | ||
190 | } | ||
191 | |||
192 | static int | ||
193 | testCanonicalize () | 172 | testCanonicalize () |
194 | { | 173 | { |
195 | char *fn = GNUNET_strdup ("ab?><|cd*ef:/g\""); | 174 | char *fn = GNUNET_strdup ("ab?><|cd*ef:/g\""); |
@@ -246,7 +225,6 @@ main (int argc, char *argv[]) | |||
246 | failureCount += testOpenClose (); | 225 | failureCount += testOpenClose (); |
247 | failureCount += testDirScan (); | 226 | failureCount += testDirScan (); |
248 | failureCount += testDirIter (); | 227 | failureCount += testDirIter (); |
249 | failureCount += testGetHome (); | ||
250 | failureCount += testCanonicalize (); | 228 | failureCount += testCanonicalize (); |
251 | failureCount += testChangeOwner (); | 229 | failureCount += testChangeOwner (); |
252 | failureCount += testDirMani (); | 230 | failureCount += testDirMani (); |
diff --git a/src/util/util.conf b/src/util/util.conf index ade7786ad..b7f9deb04 100644 --- a/src/util/util.conf +++ b/src/util/util.conf | |||
@@ -1,20 +1,41 @@ | |||
1 | [PATHS] | 1 | [PATHS] |
2 | # The PATHS section is special, as filenames including $-expression are | ||
3 | # expanded using the values from PATHS or the system environment (PATHS | ||
4 | # is checked first). GNUnet also supports expanding $-expressions using | ||
5 | # defaults with the syntax "${VAR:-default}". Here, "default" can again | ||
6 | # be a $-expression. | ||
7 | # | ||
2 | GNUNET_HOME = $HOME | 8 | GNUNET_HOME = $HOME |
3 | GNUNET_DATA_HOME = $GNUNET_HOME/.local/share/gnunet/ | ||
4 | GNUNET_CONFIG_HOME = $GNUNET_HOME/.config/gnunet/ | ||
5 | GNUNET_CACHE_HOME = $GNUNET_HOME/.cache/gnunet/ | ||
6 | GNUNET_RUNTIME_DIR = $GNUNET_HOME/.runtime/gnunet/ | ||
7 | 9 | ||
10 | # see XDG Base Directory Specification at | ||
11 | # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html | ||
12 | # for how these should be used. | ||
8 | 13 | ||
14 | # Persistant data storage | ||
15 | GNUNET_DATA_HOME = ${XDG_DATA_HOME:-$GNUNET_HOME/.local/share}/gnunet/ | ||
16 | |||
17 | # Configuration files | ||
18 | GNUNET_CONFIG_HOME = ${XDG_CONFIG_HOME:-GNUNET_HOME/.config/}gnunet/ | ||
19 | |||
20 | # Cached data, no big deal if lost | ||
21 | GNUNET_CACHE_HOME = ${XDG_CACHE_HOME:-$GNUNET_HOME/.cache/}gnunet/ | ||
22 | |||
23 | # Runtime data (i.e UNIX domain sockets, locks, always lost on system boot) | ||
24 | GNUNET_RUNTIME_DIR = ${XDG_RUNTIME_DIR:-${TMPDIR:-${TMP:-/tmp}}}gnunet/ | ||
25 | |||
26 | # Legacy option... | ||
9 | SERVICEHOME = ~/.gnunet/ | 27 | SERVICEHOME = ~/.gnunet/ |
10 | # SERVICEHOME = /var/lib/gnunet/ | 28 | # SERVICEHOME = /var/lib/gnunet/ |
29 | |||
11 | # DEFAULTCONFIG = /etc/gnunet.conf | 30 | # DEFAULTCONFIG = /etc/gnunet.conf |
12 | # If 'DEFAULTCONFIG' is not defined, the current | 31 | # If 'DEFAULTCONFIG' is not defined, the current |
13 | # configuration file is assumed to be the default, | 32 | # configuration file is assumed to be the default, |
14 | # which is what we want by default... | 33 | # which is what we want by default... |
15 | 34 | ||
35 | |||
16 | [PEER] | 36 | [PEER] |
17 | PRIVATE_KEY = $SERVICEHOME/private_key.ecc | 37 | PRIVATE_KEY = $GNUNET_DATA_HOME/private_key.ecc |
38 | |||
18 | 39 | ||
19 | [TESTING] | 40 | [TESTING] |
20 | SPEEDUP_INTERVAL = 0 ms | 41 | SPEEDUP_INTERVAL = 0 ms |