diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-06-25 19:36:44 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-06-25 19:36:44 +0200 |
commit | 981cc68a63c71ba11aaca84f559f3cf86a29c0ec (patch) | |
tree | 5196b264c461b609a128188e78a42b9972c845c3 /src | |
parent | 169f1c8c1db0a6d8cebf308ced1de064eadcdc4d (diff) | |
download | gnunet-981cc68a63c71ba11aaca84f559f3cf86a29c0ec.tar.gz gnunet-981cc68a63c71ba11aaca84f559f3cf86a29c0ec.zip |
fix configuration parsing issue with inlines from configuration not in cwd
Diffstat (limited to 'src')
-rw-r--r-- | src/datacache/datacache.c | 6 | ||||
-rw-r--r-- | src/include/gnunet_configuration_lib.h | 6 | ||||
-rw-r--r-- | src/nat-auto/gnunet-service-nat-auto.c | 2 | ||||
-rw-r--r-- | src/nat-auto/nat_auto_api.c | 2 | ||||
-rw-r--r-- | src/set/gnunet-service-set_union.c | 4 | ||||
-rw-r--r-- | src/testbed/gnunet-helper-testbed.c | 5 | ||||
-rw-r--r-- | src/testbed/testbed_api.c | 5 | ||||
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 5 | ||||
-rw-r--r-- | src/util/configuration.c | 29 |
9 files changed, 42 insertions, 22 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index a1869a8bd..92cc40b53 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c | |||
@@ -185,9 +185,9 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
185 | } | 185 | } |
186 | if (NULL == ret->filter) | 186 | if (NULL == ret->filter) |
187 | { | 187 | { |
188 | ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, | 188 | ret->filter = GNUNET_CONTAINER_bloomfilter_init (NULL, |
189 | bf_size, | 189 | bf_size, |
190 | 5); /* approx. 3% false positives at max use */ | 190 | 5); /* approx. 3% false positives at max use */ |
191 | } | 191 | } |
192 | } | 192 | } |
193 | ret->stats = GNUNET_STATISTICS_create ("datacache", cfg); | 193 | ret->stats = GNUNET_STATISTICS_create ("datacache", cfg); |
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index c1537e4f8..8a874da13 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -132,8 +132,8 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
132 | * @param cfg configuration to update | 132 | * @param cfg configuration to update |
133 | * @param mem the memory block of serialized configuration | 133 | * @param mem the memory block of serialized configuration |
134 | * @param size the size of the memory block | 134 | * @param size the size of the memory block |
135 | * @param allow_inline set to #GNUNET_YES if we recursively load configuration | 135 | * @param allow_inline set to the base directory if we recursively load configuration |
136 | * from inlined configurations; #GNUNET_NO if not and raise warnings | 136 | * from inlined configurations; NULL if not and raise warnings |
137 | * when we come across them | 137 | * when we come across them |
138 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 138 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
139 | */ | 139 | */ |
@@ -141,7 +141,7 @@ int | |||
141 | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | 141 | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, |
142 | const char *mem, | 142 | const char *mem, |
143 | size_t size, | 143 | size_t size, |
144 | int allow_inline); | 144 | const char *basedir); |
145 | 145 | ||
146 | 146 | ||
147 | /** | 147 | /** |
diff --git a/src/nat-auto/gnunet-service-nat-auto.c b/src/nat-auto/gnunet-service-nat-auto.c index ae570c351..5f10dad94 100644 --- a/src/nat-auto/gnunet-service-nat-auto.c +++ b/src/nat-auto/gnunet-service-nat-auto.c | |||
@@ -310,7 +310,7 @@ handle_autoconfig_request (void *cls, | |||
310 | GNUNET_CONFIGURATION_deserialize (ac->c, | 310 | GNUNET_CONFIGURATION_deserialize (ac->c, |
311 | (const char *) &message[1], | 311 | (const char *) &message[1], |
312 | left, | 312 | left, |
313 | GNUNET_NO)) | 313 | NULL)) |
314 | { | 314 | { |
315 | GNUNET_break (0); | 315 | GNUNET_break (0); |
316 | GNUNET_SERVICE_client_drop (ch->client); | 316 | GNUNET_SERVICE_client_drop (ch->client); |
diff --git a/src/nat-auto/nat_auto_api.c b/src/nat-auto/nat_auto_api.c index 8a7eaf264..43a5212c8 100644 --- a/src/nat-auto/nat_auto_api.c +++ b/src/nat-auto/nat_auto_api.c | |||
@@ -155,7 +155,7 @@ handle_auto_result (void *cls, | |||
155 | GNUNET_CONFIGURATION_deserialize (cfg, | 155 | GNUNET_CONFIGURATION_deserialize (cfg, |
156 | (const char *) &res[1], | 156 | (const char *) &res[1], |
157 | left, | 157 | left, |
158 | GNUNET_NO)) | 158 | NULL)) |
159 | { | 159 | { |
160 | GNUNET_break (0); | 160 | GNUNET_break (0); |
161 | ah->arc (ah->arc_cls, | 161 | ah->arc (ah->arc_cls, |
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index 4ca10f0b4..b2983545f 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.c | |||
@@ -1467,8 +1467,6 @@ maybe_finish (struct Operation *op) | |||
1467 | num_demanded); | 1467 | num_demanded); |
1468 | if (0 == num_demanded) | 1468 | if (0 == num_demanded) |
1469 | { | 1469 | { |
1470 | struct GNUNET_MQ_Envelope *ev; | ||
1471 | |||
1472 | op->state->phase = PHASE_DONE; | 1470 | op->state->phase = PHASE_DONE; |
1473 | send_client_done (op); | 1471 | send_client_done (op); |
1474 | destroy_channel (op); | 1472 | destroy_channel (op); |
@@ -1894,8 +1892,6 @@ handle_union_p2p_full_done (void *cls, | |||
1894 | break; | 1892 | break; |
1895 | case PHASE_FULL_SENDING: | 1893 | case PHASE_FULL_SENDING: |
1896 | { | 1894 | { |
1897 | struct GNUNET_MQ_Envelope *ev; | ||
1898 | |||
1899 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1895 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1900 | "got FULL DONE, finishing\n"); | 1896 | "got FULL DONE, finishing\n"); |
1901 | /* We sent the full set, and got the response for that. We're done. */ | 1897 | /* We sent the full set, and got the response for that. We're done. */ |
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c index d2a3a98b7..392f257dd 100644 --- a/src/testbed/gnunet-helper-testbed.c +++ b/src/testbed/gnunet-helper-testbed.c | |||
@@ -358,7 +358,10 @@ tokenizer_cb (void *cls, | |||
358 | } | 358 | } |
359 | cfg = GNUNET_CONFIGURATION_create (); | 359 | cfg = GNUNET_CONFIGURATION_create (); |
360 | if (GNUNET_OK != | 360 | if (GNUNET_OK != |
361 | GNUNET_CONFIGURATION_deserialize (cfg, config, ul_config_size, GNUNET_NO)) | 361 | GNUNET_CONFIGURATION_deserialize (cfg, |
362 | config, | ||
363 | ul_config_size, | ||
364 | NULL)) | ||
362 | { | 365 | { |
363 | LOG (GNUNET_ERROR_TYPE_WARNING, | 366 | LOG (GNUNET_ERROR_TYPE_WARNING, |
364 | "Unable to deserialize config -- exiting\n"); | 367 | "Unable to deserialize config -- exiting\n"); |
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 0e0a5da9c..1acd0e47c 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -2158,9 +2158,10 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg) | |||
2158 | } | 2158 | } |
2159 | cfg = GNUNET_CONFIGURATION_create (); | 2159 | cfg = GNUNET_CONFIGURATION_create (); |
2160 | if (GNUNET_OK != | 2160 | if (GNUNET_OK != |
2161 | GNUNET_CONFIGURATION_deserialize (cfg, (const char *) data, | 2161 | GNUNET_CONFIGURATION_deserialize (cfg, |
2162 | (const char *) data, | ||
2162 | (size_t) data_len, | 2163 | (size_t) data_len, |
2163 | GNUNET_NO)) | 2164 | NULL)) |
2164 | { | 2165 | { |
2165 | GNUNET_free (data); | 2166 | GNUNET_free (data); |
2166 | GNUNET_break_op (0); /* De-serialization failure */ | 2167 | GNUNET_break_op (0); /* De-serialization failure */ |
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 5d2c1cc37..8efcab649 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -983,7 +983,10 @@ helper_mst (void *cls, | |||
983 | GNUNET_CONFIGURATION_destroy (cp->host->cfg); | 983 | GNUNET_CONFIGURATION_destroy (cp->host->cfg); |
984 | cp->host->cfg = GNUNET_CONFIGURATION_create (); | 984 | cp->host->cfg = GNUNET_CONFIGURATION_create (); |
985 | GNUNET_assert (GNUNET_CONFIGURATION_deserialize | 985 | GNUNET_assert (GNUNET_CONFIGURATION_deserialize |
986 | (cp->host->cfg, config, config_size, GNUNET_NO)); | 986 | (cp->host->cfg, |
987 | config, | ||
988 | config_size, | ||
989 | NULL)); | ||
987 | GNUNET_free (config); | 990 | GNUNET_free (config); |
988 | if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host))) | 991 | if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host))) |
989 | hostname = "localhost"; | 992 | hostname = "localhost"; |
diff --git a/src/util/configuration.c b/src/util/configuration.c index 639bd55a2..f63903b4e 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -145,8 +145,8 @@ GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) | |||
145 | * @param cfg configuration to update | 145 | * @param cfg configuration to update |
146 | * @param mem the memory block of serialized configuration | 146 | * @param mem the memory block of serialized configuration |
147 | * @param size the size of the memory block | 147 | * @param size the size of the memory block |
148 | * @param allow_inline set to #GNUNET_YES if we recursively load configuration | 148 | * @param basedir set to path from which we recursively load configuration |
149 | * from inlined configurations; #GNUNET_NO if not and raise warnings | 149 | * from inlined configurations; NULL if not and raise warnings |
150 | * when we come across them | 150 | * when we come across them |
151 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 151 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
152 | */ | 152 | */ |
@@ -154,7 +154,7 @@ int | |||
154 | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | 154 | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, |
155 | const char *mem, | 155 | const char *mem, |
156 | size_t size, | 156 | size_t size, |
157 | int allow_inline) | 157 | const char *basedir) |
158 | { | 158 | { |
159 | char *line; | 159 | char *line; |
160 | char *line_orig; | 160 | char *line_orig; |
@@ -228,13 +228,23 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
228 | { | 228 | { |
229 | /* @INLINE@ value */ | 229 | /* @INLINE@ value */ |
230 | value = &line[strlen ("@INLINE@ ")]; | 230 | value = &line[strlen ("@INLINE@ ")]; |
231 | if (GNUNET_YES == allow_inline) | 231 | if (NULL != basedir) |
232 | { | 232 | { |
233 | if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, value)) | 233 | char *fn; |
234 | |||
235 | GNUNET_asprintf (&fn, | ||
236 | "%s/%s", | ||
237 | basedir, | ||
238 | value); | ||
239 | if (GNUNET_OK != | ||
240 | GNUNET_CONFIGURATION_parse (cfg, | ||
241 | fn)) | ||
234 | { | 242 | { |
243 | GNUNET_free (fn); | ||
235 | ret = GNUNET_SYSERR; /* failed to parse included config */ | 244 | ret = GNUNET_SYSERR; /* failed to parse included config */ |
236 | break; | 245 | break; |
237 | } | 246 | } |
247 | GNUNET_free (fn); | ||
238 | } | 248 | } |
239 | else | 249 | else |
240 | { | 250 | { |
@@ -311,6 +321,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
311 | size_t fs; | 321 | size_t fs; |
312 | char *fn; | 322 | char *fn; |
313 | char *mem; | 323 | char *mem; |
324 | char *endsep; | ||
314 | int dirty; | 325 | int dirty; |
315 | int ret; | 326 | int ret; |
316 | 327 | ||
@@ -350,8 +361,14 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
350 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 361 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
351 | "Deserializing contents of file `%s'\n", | 362 | "Deserializing contents of file `%s'\n", |
352 | fn); | 363 | fn); |
364 | endsep = strrchr (fn, (int) '/'); | ||
365 | if (NULL != endsep) | ||
366 | *endsep = '\0'; | ||
367 | ret = GNUNET_CONFIGURATION_deserialize (cfg, | ||
368 | mem, | ||
369 | fs, | ||
370 | fn); | ||
353 | GNUNET_free (fn); | 371 | GNUNET_free (fn); |
354 | ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); | ||
355 | GNUNET_free (mem); | 372 | GNUNET_free (mem); |
356 | /* restore dirty flag - anything we set in the meantime | 373 | /* restore dirty flag - anything we set in the meantime |
357 | * came from disk */ | 374 | * came from disk */ |