aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-07-30 14:53:55 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-07-30 14:53:55 +0000
commit8f1d5a8a9a094b98d1f8a45ae8b9c83bafcf3248 (patch)
tree2909d984973861eb07c87c452c7d9d4cfca4ea9d /src
parent2e42d43da78d245d0319dd76323b7056cd931c1e (diff)
downloadgnunet-8f1d5a8a9a094b98d1f8a45ae8b9c83bafcf3248.tar.gz
gnunet-8f1d5a8a9a094b98d1f8a45ae8b9c83bafcf3248.zip
- debug output decreased
- private keys and certs removed after all testcases
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_https.c4
-rw-r--r--src/transport/test_plugin_transport_https.c1
-rw-r--r--src/transport/test_transport_api.c113
-rw-r--r--src/transport/test_transport_api_rel_https_peer1.conf3
-rw-r--r--src/transport/test_transport_api_rel_https_peer2.conf3
-rw-r--r--src/transport/test_transport_api_reliability.c107
6 files changed, 223 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_https.c b/src/transport/plugin_transport_https.c
index b7a9465b8..6cc9f9c7e 100644
--- a/src/transport/plugin_transport_https.c
+++ b/src/transport/plugin_transport_https.c
@@ -41,8 +41,8 @@
41#include "microhttpd.h" 41#include "microhttpd.h"
42#include <curl/curl.h> 42#include <curl/curl.h>
43 43
44#define DEBUG_HTTPS GNUNET_YES 44#define DEBUG_HTTPS GNUNET_NO
45#define VERBOSE GNUNET_YES 45#define VERBOSE GNUNET_NO
46#define DEBUG_CURL GNUNET_NO 46#define DEBUG_CURL GNUNET_NO
47#define DEBUG_CONNECTIONS GNUNET_NO 47#define DEBUG_CONNECTIONS GNUNET_NO
48#define DEBUG_SESSION_SELECTION GNUNET_NO 48#define DEBUG_SESSION_SELECTION GNUNET_NO
diff --git a/src/transport/test_plugin_transport_https.c b/src/transport/test_plugin_transport_https.c
index e5c661ae9..32862913b 100644
--- a/src/transport/test_plugin_transport_https.c
+++ b/src/transport/test_plugin_transport_https.c
@@ -467,7 +467,6 @@ shutdown_clean ()
467 GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http"); 467 GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http");
468 468
469 struct stat sbuf; 469 struct stat sbuf;
470
471 if (0 == stat (cert_file, &sbuf )) 470 if (0 == stat (cert_file, &sbuf ))
472 { 471 {
473 if (0 == remove(cert_file)) 472 if (0 == remove(cert_file))
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index 04cf69bb8..46973e414 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -36,7 +36,7 @@
36#include "gnunet_transport_service.h" 36#include "gnunet_transport_service.h"
37#include "transport.h" 37#include "transport.h"
38 38
39#define VERBOSE GNUNET_NO 39#define VERBOSE GNUNET_YES
40 40
41#define VERBOSE_ARM GNUNET_NO 41#define VERBOSE_ARM GNUNET_NO
42 42
@@ -86,6 +86,12 @@ static int is_https;
86 86
87static GNUNET_SCHEDULER_TaskIdentifier die_task; 87static GNUNET_SCHEDULER_TaskIdentifier die_task;
88 88
89static char * key_file_p1;
90static char * cert_file_p1;
91
92static char * key_file_p2;
93static char * cert_file_p2;
94
89#if VERBOSE 95#if VERBOSE
90#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) 96#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
91#else 97#else
@@ -221,6 +227,63 @@ setup_peer (struct PeerContext *p, const char *cfgname)
221#endif 227#endif
222 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 228 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
223 229
230 if (is_https)
231 {
232 struct stat sbuf;
233 if (p==&p1)
234 {
235 if (GNUNET_CONFIGURATION_have_value (p->cfg,
236 "transport-https", "KEY_FILE"))
237 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p1);
238 else
239 GNUNET_asprintf(&key_file_p1,"https.key");
240 if (0 == stat (key_file_p1, &sbuf ))
241 {
242 if (0 == remove(key_file_p1))
243 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p1);
244 else
245 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p1);
246 }
247 if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE"))
248 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p1);
249 else
250 GNUNET_asprintf(&cert_file_p1,"https.cert");
251 if (0 == stat (cert_file_p1, &sbuf ))
252 {
253 if (0 == remove(cert_file_p1))
254 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p1);
255 else
256 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p1);
257 }
258 }
259 else if (p==&p2)
260 {
261 if (GNUNET_CONFIGURATION_have_value (p->cfg,
262 "transport-https", "KEY_FILE"))
263 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p2);
264 else
265 GNUNET_asprintf(&key_file_p2,"https.key");
266 if (0 == stat (key_file_p2, &sbuf ))
267 {
268 if (0 == remove(key_file_p2))
269 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p2);
270 else
271 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p2);
272 }
273 if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE"))
274 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p2);
275 else
276 GNUNET_asprintf(&cert_file_p2,"https.cert");
277 if (0 == stat (cert_file_p2, &sbuf ))
278 {
279 if (0 == remove(cert_file_p2))
280 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p2);
281 else
282 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p2);
283 }
284 }
285 }
286
224 p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, 287 p->th = GNUNET_TRANSPORT_connect (sched, p->cfg,
225 NULL, p, 288 NULL, p,
226 &notify_receive, 289 &notify_receive,
@@ -311,10 +374,10 @@ run (void *cls,
311 setup_peer (&p2, "test_transport_api_http_peer2.conf"); 374 setup_peer (&p2, "test_transport_api_http_peer2.conf");
312 } 375 }
313 else if (is_https) 376 else if (is_https)
314 { 377 {
315 setup_peer (&p1, "test_transport_api_https_peer1.conf"); 378 setup_peer (&p1, "test_transport_api_https_peer1.conf");
316 setup_peer (&p2, "test_transport_api_https_peer2.conf"); 379 setup_peer (&p2, "test_transport_api_https_peer2.conf");
317 } 380 }
318 GNUNET_assert(p1.th != NULL); 381 GNUNET_assert(p1.th != NULL);
319 GNUNET_assert(p2.th != NULL); 382 GNUNET_assert(p2.th != NULL);
320 383
@@ -345,6 +408,46 @@ check ()
345 options, &run, &ok); 408 options, &run, &ok);
346 stop_arm (&p1); 409 stop_arm (&p1);
347 stop_arm (&p2); 410 stop_arm (&p2);
411
412 if (is_https)
413 {
414 struct stat sbuf;
415 if (0 == stat (cert_file_p1, &sbuf ))
416 {
417 if (0 == remove(cert_file_p1))
418 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p1);
419 else
420 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p1);
421 }
422
423 if (0 == stat (key_file_p1, &sbuf ))
424 {
425 if (0 == remove(key_file_p1))
426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p1);
427 else
428 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p1);
429 }
430
431 if (0 == stat (cert_file_p2, &sbuf ))
432 {
433 if (0 == remove(cert_file_p2))
434 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p2);
435 else
436 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p2);
437 }
438
439 if (0 == stat (key_file_p2, &sbuf ))
440 {
441 if (0 == remove(key_file_p2))
442 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p2);
443 else
444 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p2);
445 }
446 GNUNET_free(key_file_p1);
447 GNUNET_free(key_file_p2);
448 GNUNET_free(cert_file_p1);
449 GNUNET_free(cert_file_p2);
450 }
348 return ok; 451 return ok;
349} 452}
350 453
diff --git a/src/transport/test_transport_api_rel_https_peer1.conf b/src/transport/test_transport_api_rel_https_peer1.conf
index 40aef0f04..0ee8fe99d 100644
--- a/src/transport/test_transport_api_rel_https_peer1.conf
+++ b/src/transport/test_transport_api_rel_https_peer1.conf
@@ -13,6 +13,9 @@ USE_IPv4 = YES
13USE_IPv6 = NO 13USE_IPv6 = NO
14BINDTO4 = 127.0.0.1 14BINDTO4 = 127.0.0.1
15#BINDTO6 = ::1 15#BINDTO6 = ::1
16KEY_FILE = https_key_p1.key
17CERT_FILE = https_cert_p1.crt
18
16 19
17[fs] 20[fs]
18AUTOSTART = NO 21AUTOSTART = NO
diff --git a/src/transport/test_transport_api_rel_https_peer2.conf b/src/transport/test_transport_api_rel_https_peer2.conf
index 978234c90..f20366262 100644
--- a/src/transport/test_transport_api_rel_https_peer2.conf
+++ b/src/transport/test_transport_api_rel_https_peer2.conf
@@ -13,6 +13,9 @@ USE_IPv4 = YES
13USE_IPv6 = NO 13USE_IPv6 = NO
14BINDTO4 = 127.0.0.1 14BINDTO4 = 127.0.0.1
15#BINDTO6 = ::1 15#BINDTO6 = ::1
16KEY_FILE = https_key_p2.key
17CERT_FILE = https_cert_p2.crt
18
16 19
17[fs] 20[fs]
18AUTOSTART = NO 21AUTOSTART = NO
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 3e22299de..a18175bf4 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -92,6 +92,13 @@ static struct GNUNET_TIME_Absolute start_time;
92 92
93static GNUNET_SCHEDULER_TaskIdentifier die_task; 93static GNUNET_SCHEDULER_TaskIdentifier die_task;
94 94
95static char * key_file_p1;
96static char * cert_file_p1;
97
98static char * key_file_p2;
99static char * cert_file_p2;
100
101
95#if VERBOSE 102#if VERBOSE
96#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) 103#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
97#else 104#else
@@ -120,6 +127,7 @@ end ()
120 "\nThroughput was %llu kb/s\n", 127 "\nThroughput was %llu kb/s\n",
121 total_bytes * 1000 / 1024 / delta); 128 total_bytes * 1000 / 1024 / delta);
122 ok = 0; 129 ok = 0;
130
123} 131}
124 132
125 133
@@ -369,6 +377,64 @@ setup_peer (struct PeerContext *p, const char *cfgname)
369 "-c", cfgname, NULL); 377 "-c", cfgname, NULL);
370#endif 378#endif
371 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 379 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
380
381 if (is_https)
382 {
383 struct stat sbuf;
384 if (p==&p1)
385 {
386 if (GNUNET_CONFIGURATION_have_value (p->cfg,
387 "transport-https", "KEY_FILE"))
388 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p1);
389 else
390 GNUNET_asprintf(&key_file_p1,"https.key");
391 if (0 == stat (key_file_p1, &sbuf ))
392 {
393 if (0 == remove(key_file_p1))
394 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p1);
395 else
396 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p1);
397 }
398 if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE"))
399 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p1);
400 else
401 GNUNET_asprintf(&cert_file_p1,"https.cert");
402 if (0 == stat (cert_file_p1, &sbuf ))
403 {
404 if (0 == remove(cert_file_p1))
405 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p1);
406 else
407 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p1);
408 }
409 }
410 else if (p==&p2)
411 {
412 if (GNUNET_CONFIGURATION_have_value (p->cfg,
413 "transport-https", "KEY_FILE"))
414 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "KEY_FILE", &key_file_p2);
415 else
416 GNUNET_asprintf(&key_file_p2,"https.key");
417 if (0 == stat (key_file_p2, &sbuf ))
418 {
419 if (0 == remove(key_file_p2))
420 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing private key file `%s'\n",key_file_p2);
421 else
422 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove private key file `%s'\n",key_file_p2);
423 }
424 if (GNUNET_CONFIGURATION_have_value (p->cfg,"transport-https", "CERT_FILE"))
425 GNUNET_CONFIGURATION_get_value_string (p->cfg, "transport-https", "CERT_FILE", &cert_file_p2);
426 else
427 GNUNET_asprintf(&cert_file_p2,"https.cert");
428 if (0 == stat (cert_file_p2, &sbuf ))
429 {
430 if (0 == remove(cert_file_p2))
431 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Successfully removed existing certificate file `%s'\n",cert_file_p2);
432 else
433 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove existing certificate file `%s'\n",cert_file_p2);
434 }
435 }
436 }
437
372 p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, 438 p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL,
373 p, 439 p,
374 &notify_receive, 440 &notify_receive,
@@ -499,6 +565,47 @@ check ()
499 options, &run, &ok); 565 options, &run, &ok);
500 stop_arm (&p1); 566 stop_arm (&p1);
501 stop_arm (&p2); 567 stop_arm (&p2);
568
569 if (is_https)
570 {
571 struct stat sbuf;
572 if (0 == stat (cert_file_p1, &sbuf ))
573 {
574 if (0 == remove(cert_file_p1))
575 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p1);
576 else
577 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p1);
578 }
579
580 if (0 == stat (key_file_p1, &sbuf ))
581 {
582 if (0 == remove(key_file_p1))
583 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p1);
584 else
585 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p1);
586 }
587
588 if (0 == stat (cert_file_p2, &sbuf ))
589 {
590 if (0 == remove(cert_file_p2))
591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed existing certificate file `%s'\n",cert_file_p2);
592 else
593 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove certfile `%s'\n",cert_file_p2);
594 }
595
596 if (0 == stat (key_file_p2, &sbuf ))
597 {
598 if (0 == remove(key_file_p2))
599 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully removed private key file `%s'\n",key_file_p2);
600 else
601 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to private key file `%s'\n",key_file_p2);
602 }
603 GNUNET_free(key_file_p1);
604 GNUNET_free(key_file_p2);
605 GNUNET_free(cert_file_p1);
606 GNUNET_free(cert_file_p2);
607 }
608
502 return ok; 609 return ok;
503} 610}
504 611