aboutsummaryrefslogtreecommitdiff
path: root/src/fs/test_fs_uri.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-14 22:15:55 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-14 22:15:55 +0000
commit6c8fa85819a2b02b3c4a175a08c1779283eda209 (patch)
tree3d635a2aa58f321fbb8779b6e086113558dc1c52 /src/fs/test_fs_uri.c
parent6d7c1dd00a193fc054d1f1588ae7c98dc95b6257 (diff)
downloadgnunet-6c8fa85819a2b02b3c4a175a08c1779283eda209.tar.gz
gnunet-6c8fa85819a2b02b3c4a175a08c1779283eda209.zip
fix key management issue with LOC signing identified in #3559
Diffstat (limited to 'src/fs/test_fs_uri.c')
-rw-r--r--src/fs/test_fs_uri.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c
index afc80ef71..fdc39ce05 100644
--- a/src/fs/test_fs_uri.c
+++ b/src/fs/test_fs_uri.c
@@ -42,12 +42,12 @@ testKeyword ()
42 } 42 }
43 GNUNET_free (emsg); 43 GNUNET_free (emsg);
44 ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/foo+bar", &emsg); 44 ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/foo+bar", &emsg);
45 if (ret == NULL) 45 if (NULL == ret)
46 { 46 {
47 GNUNET_free (emsg); 47 GNUNET_free (emsg);
48 GNUNET_assert (0); 48 GNUNET_assert (0);
49 } 49 }
50 if (!GNUNET_FS_uri_test_ksk (ret)) 50 if (! GNUNET_FS_uri_test_ksk (ret))
51 { 51 {
52 GNUNET_FS_uri_destroy (ret); 52 GNUNET_FS_uri_destroy (ret);
53 GNUNET_assert (0); 53 GNUNET_assert (0);
@@ -81,7 +81,7 @@ testLocation ()
81 struct GNUNET_FS_Uri *uri2; 81 struct GNUNET_FS_Uri *uri2;
82 struct GNUNET_FS_Uri *baseURI; 82 struct GNUNET_FS_Uri *baseURI;
83 char *emsg; 83 char *emsg;
84 struct GNUNET_CONFIGURATION_Handle *cfg; 84 struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
85 85
86 baseURI = 86 baseURI =
87 GNUNET_FS_uri_parse 87 GNUNET_FS_uri_parse
@@ -89,38 +89,31 @@ testLocation ()
89 &emsg); 89 &emsg);
90 GNUNET_assert (baseURI != NULL); 90 GNUNET_assert (baseURI != NULL);
91 GNUNET_assert (emsg == NULL); 91 GNUNET_assert (emsg == NULL);
92 cfg = GNUNET_CONFIGURATION_create (); 92 pk = GNUNET_CRYPTO_eddsa_key_create ();
93 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, "test_fs_uri_data.conf")) 93 uri = GNUNET_FS_uri_loc_create (baseURI,
94 { 94 pk,
95 FPRINTF (stderr, "%s", "Failed to parse configuration file\n"); 95 GNUNET_TIME_absolute_get ());
96 GNUNET_FS_uri_destroy (baseURI); 96 GNUNET_free (pk);
97 GNUNET_CONFIGURATION_destroy (cfg); 97 if (NULL == uri)
98 return 1;
99 }
100 uri = GNUNET_FS_uri_loc_create (baseURI, cfg, GNUNET_TIME_absolute_get ());
101 if (uri == NULL)
102 { 98 {
103 GNUNET_break (0); 99 GNUNET_break (0);
104 GNUNET_FS_uri_destroy (baseURI); 100 GNUNET_FS_uri_destroy (baseURI);
105 GNUNET_CONFIGURATION_destroy (cfg);
106 return 1; 101 return 1;
107 } 102 }
108 if (!GNUNET_FS_uri_test_loc (uri)) 103 if (! GNUNET_FS_uri_test_loc (uri))
109 { 104 {
110 GNUNET_break (0); 105 GNUNET_break (0);
111 GNUNET_FS_uri_destroy (uri); 106 GNUNET_FS_uri_destroy (uri);
112 GNUNET_FS_uri_destroy (baseURI); 107 GNUNET_FS_uri_destroy (baseURI);
113 GNUNET_CONFIGURATION_destroy (cfg);
114 return 1; 108 return 1;
115 } 109 }
116 uri2 = GNUNET_FS_uri_loc_get_uri (uri); 110 uri2 = GNUNET_FS_uri_loc_get_uri (uri);
117 if (!GNUNET_FS_uri_test_equal (baseURI, uri2)) 111 if (! GNUNET_FS_uri_test_equal (baseURI, uri2))
118 { 112 {
119 GNUNET_break (0); 113 GNUNET_break (0);
120 GNUNET_FS_uri_destroy (uri); 114 GNUNET_FS_uri_destroy (uri);
121 GNUNET_FS_uri_destroy (uri2); 115 GNUNET_FS_uri_destroy (uri2);
122 GNUNET_FS_uri_destroy (baseURI); 116 GNUNET_FS_uri_destroy (baseURI);
123 GNUNET_CONFIGURATION_destroy (cfg);
124 return 1; 117 return 1;
125 } 118 }
126 GNUNET_FS_uri_destroy (uri2); 119 GNUNET_FS_uri_destroy (uri2);
@@ -137,7 +130,6 @@ testLocation ()
137 fprintf (stderr, "URI parsing failed: %s\n", emsg); 130 fprintf (stderr, "URI parsing failed: %s\n", emsg);
138 GNUNET_break (0); 131 GNUNET_break (0);
139 GNUNET_FS_uri_destroy (uri); 132 GNUNET_FS_uri_destroy (uri);
140 GNUNET_CONFIGURATION_destroy (cfg);
141 GNUNET_free (emsg); 133 GNUNET_free (emsg);
142 return 1; 134 return 1;
143 } 135 }
@@ -147,12 +139,10 @@ testLocation ()
147 GNUNET_break (0); 139 GNUNET_break (0);
148 GNUNET_FS_uri_destroy (uri); 140 GNUNET_FS_uri_destroy (uri);
149 GNUNET_FS_uri_destroy (uri2); 141 GNUNET_FS_uri_destroy (uri2);
150 GNUNET_CONFIGURATION_destroy (cfg);
151 return 1; 142 return 1;
152 } 143 }
153 GNUNET_FS_uri_destroy (uri2); 144 GNUNET_FS_uri_destroy (uri2);
154 GNUNET_FS_uri_destroy (uri); 145 GNUNET_FS_uri_destroy (uri);
155 GNUNET_CONFIGURATION_destroy (cfg);
156 return 0; 146 return 0;
157} 147}
158 148