diff options
Diffstat (limited to 'src/gns/gnunet-gns-import.c')
-rw-r--r-- | src/gns/gnunet-gns-import.c | 425 |
1 files changed, 228 insertions, 197 deletions
diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c index cd354eee4..064294234 100644 --- a/src/gns/gnunet-gns-import.c +++ b/src/gns/gnunet-gns-import.c | |||
@@ -67,7 +67,8 @@ static char *private_zone_pkey; | |||
67 | /** | 67 | /** |
68 | * String version of PKEY for pin-zone. | 68 | * String version of PKEY for pin-zone. |
69 | */ | 69 | */ |
70 | static char *pin_zone_pkey = "72QC35CO20UJN1E91KPJFNT9TG4CLKAPB4VK9S3Q758S9MLBRKOG"; | 70 | static char *pin_zone_pkey = |
71 | "72QC35CO20UJN1E91KPJFNT9TG4CLKAPB4VK9S3Q758S9MLBRKOG"; | ||
71 | 72 | ||
72 | /** | 73 | /** |
73 | * Set to GNUNET_YES if private record was found; | 74 | * Set to GNUNET_YES if private record was found; |
@@ -86,13 +87,13 @@ static int ret; | |||
86 | 87 | ||
87 | 88 | ||
88 | static int | 89 | static int |
89 | run_process_and_wait(int pipe_control, | 90 | run_process_and_wait (int pipe_control, |
90 | enum GNUNET_OS_InheritStdioFlags std_inheritance, | 91 | enum GNUNET_OS_InheritStdioFlags std_inheritance, |
91 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | 92 | struct GNUNET_DISK_PipeHandle *pipe_stdin, |
92 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 93 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
93 | enum GNUNET_OS_ProcessStatusType *st, | 94 | enum GNUNET_OS_ProcessStatusType *st, |
94 | unsigned long *code, | 95 | unsigned long *code, |
95 | const char *filename, ...) | 96 | const char *filename, ...) |
96 | { | 97 | { |
97 | static struct GNUNET_OS_Process *p; | 98 | static struct GNUNET_OS_Process *p; |
98 | int arglen; | 99 | int arglen; |
@@ -101,88 +102,88 @@ run_process_and_wait(int pipe_control, | |||
101 | char *argp; | 102 | char *argp; |
102 | va_list ap, apc1, apc2; | 103 | va_list ap, apc1, apc2; |
103 | 104 | ||
104 | va_start(ap, filename); | 105 | va_start (ap, filename); |
105 | va_copy(apc1, ap); | 106 | va_copy (apc1, ap); |
106 | va_copy(apc2, ap); | 107 | va_copy (apc2, ap); |
107 | arglen = 0; | 108 | arglen = 0; |
108 | while (NULL != (arg = va_arg(apc1, char *))) | 109 | while (NULL != (arg = va_arg (apc1, char *))) |
109 | arglen += strlen(arg) + 1; | 110 | arglen += strlen (arg) + 1; |
110 | va_end(apc1); | 111 | va_end (apc1); |
111 | args = argp = GNUNET_malloc(arglen); | 112 | args = argp = GNUNET_malloc (arglen); |
112 | while (NULL != (arg = va_arg(apc2, char *))) | 113 | while (NULL != (arg = va_arg (apc2, char *))) |
113 | { | 114 | { |
114 | strcpy(argp, arg); | 115 | strcpy (argp, arg); |
115 | argp += strlen(arg); | 116 | argp += strlen (arg); |
116 | *argp = ' '; | 117 | *argp = ' '; |
117 | argp += 1; | 118 | argp += 1; |
118 | } | 119 | } |
119 | va_end(apc2); | 120 | va_end (apc2); |
120 | if (arglen > 0) | 121 | if (arglen > 0) |
121 | argp[-1] = '\0'; | 122 | argp[-1] = '\0'; |
122 | p = GNUNET_OS_start_process_va(pipe_control, std_inheritance, | 123 | p = GNUNET_OS_start_process_va (pipe_control, std_inheritance, |
123 | pipe_stdin, | 124 | pipe_stdin, |
124 | pipe_stdout, | 125 | pipe_stdout, |
125 | NULL, | 126 | NULL, |
126 | filename, ap); | 127 | filename, ap); |
127 | va_end(ap); | 128 | va_end (ap); |
128 | if (NULL == p) | 129 | if (NULL == p) |
129 | { | 130 | { |
130 | ret = 3; | 131 | ret = 3; |
131 | fprintf(stderr, "Failed to run `%s'\n", args); | 132 | fprintf (stderr, "Failed to run `%s'\n", args); |
132 | GNUNET_free(args); | 133 | GNUNET_free (args); |
133 | return 1; | 134 | return 1; |
134 | } | 135 | } |
135 | 136 | ||
136 | if (GNUNET_OK != GNUNET_OS_process_wait(p)) | 137 | if (GNUNET_OK != GNUNET_OS_process_wait (p)) |
137 | { | 138 | { |
138 | ret = 4; | 139 | ret = 4; |
139 | fprintf(stderr, "Failed to wait for `%s'\n", args); | 140 | fprintf (stderr, "Failed to wait for `%s'\n", args); |
140 | GNUNET_free(args); | 141 | GNUNET_free (args); |
141 | return 1; | 142 | return 1; |
142 | } | 143 | } |
143 | 144 | ||
144 | switch (GNUNET_OS_process_status(p, st, code)) | 145 | switch (GNUNET_OS_process_status (p, st, code)) |
145 | { | 146 | { |
146 | case GNUNET_OK: | 147 | case GNUNET_OK: |
147 | break; | 148 | break; |
148 | 149 | ||
149 | case GNUNET_NO: | 150 | case GNUNET_NO: |
150 | ret = 5; | 151 | ret = 5; |
151 | fprintf(stderr, "`%s' is still running\n", args); | 152 | fprintf (stderr, "`%s' is still running\n", args); |
152 | GNUNET_free(args); | 153 | GNUNET_free (args); |
153 | return 1; | 154 | return 1; |
154 | 155 | ||
155 | default: | 156 | default: |
156 | case GNUNET_SYSERR: | 157 | case GNUNET_SYSERR: |
157 | ret = 6; | 158 | ret = 6; |
158 | fprintf(stderr, "Failed to check the status of `%s'\n", args); | 159 | fprintf (stderr, "Failed to check the status of `%s'\n", args); |
159 | GNUNET_free(args); | 160 | GNUNET_free (args); |
160 | return 1; | 161 | return 1; |
161 | } | 162 | } |
162 | return 0; | 163 | return 0; |
163 | } | 164 | } |
164 | 165 | ||
165 | static void | 166 | static void |
166 | check_pkey(unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, | 167 | check_pkey (unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, |
167 | char *pk, int *found_rec) | 168 | char *pk, int *found_rec) |
168 | { | 169 | { |
169 | int i; | 170 | int i; |
170 | 171 | ||
171 | for (i = 0; i < rd_len; i++) | 172 | for (i = 0; i < rd_len; i++) |
172 | { | 173 | { |
173 | char *s; | 174 | char *s; |
174 | if (GNUNET_GNSRECORD_TYPE_PKEY != rd[i].record_type || | 175 | if ((GNUNET_GNSRECORD_TYPE_PKEY != rd[i].record_type) || |
175 | rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) | 176 | (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) ) |
176 | continue; | 177 | continue; |
177 | s = GNUNET_GNSRECORD_value_to_string(rd[i].record_type, | 178 | s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, |
178 | rd[i].data, | 179 | rd[i].data, |
179 | rd[i].data_size); | 180 | rd[i].data_size); |
180 | if (NULL == s) | 181 | if (NULL == s) |
181 | continue; | 182 | continue; |
182 | if (0 == strcmp(s, pk)) | 183 | if (0 == strcmp (s, pk)) |
183 | *found_rec = GNUNET_YES; | 184 | *found_rec = GNUNET_YES; |
184 | GNUNET_free(s); | 185 | GNUNET_free (s); |
185 | } | 186 | } |
186 | } | 187 | } |
187 | 188 | ||
188 | /** | 189 | /** |
@@ -195,54 +196,62 @@ check_pkey(unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, | |||
195 | * @param rd array of records with data to store | 196 | * @param rd array of records with data to store |
196 | */ | 197 | */ |
197 | static void | 198 | static void |
198 | zone_iterator(void *cls, | 199 | zone_iterator (void *cls, |
199 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 200 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
200 | const char *rname, unsigned int rd_len, | 201 | const char *rname, unsigned int rd_len, |
201 | const struct GNUNET_GNSRECORD_Data *rd) | 202 | const struct GNUNET_GNSRECORD_Data *rd) |
202 | { | 203 | { |
203 | if (NULL != rname) | 204 | if (NULL != rname) |
204 | { | 205 | { |
205 | if (0 == strcmp(rname, "private")) | 206 | if (0 == strcmp (rname, "private")) |
206 | check_pkey(rd_len, rd, private_zone_pkey, &found_private_rec); | 207 | check_pkey (rd_len, rd, private_zone_pkey, &found_private_rec); |
207 | else if (0 == strcmp(rname, "pin")) | 208 | else if (0 == strcmp (rname, "pin")) |
208 | check_pkey(rd_len, rd, pin_zone_pkey, &found_pin_rec); | 209 | check_pkey (rd_len, rd, pin_zone_pkey, &found_pin_rec); |
209 | } | 210 | } |
210 | GNUNET_NAMESTORE_zone_iterator_next(list_it); | 211 | GNUNET_NAMESTORE_zone_iterator_next (list_it); |
211 | } | 212 | } |
212 | 213 | ||
213 | static void | 214 | static void |
214 | zone_iteration_error(void *cls) | 215 | zone_iteration_error (void *cls) |
215 | { | 216 | { |
216 | enum GNUNET_OS_ProcessStatusType st; | 217 | enum GNUNET_OS_ProcessStatusType st; |
217 | unsigned long code; | 218 | unsigned long code; |
218 | 219 | ||
219 | if (!found_private_rec) | 220 | if (! found_private_rec) |
221 | { | ||
222 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
223 | NULL, NULL, &st, &code, | ||
224 | "gnunet-namestore", | ||
225 | "gnunet-namestore", "-z", "master-zone", | ||
226 | "-a", "-e", "never", "-n", "private", "-p", | ||
227 | "-t", "PKEY", "-V", | ||
228 | private_zone_pkey, NULL)) | ||
220 | { | 229 | { |
221 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 230 | ret = 8; |
222 | "gnunet-namestore", | 231 | return; |
223 | "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "private", "-p", "-t", "PKEY", "-V", private_zone_pkey, NULL)) | ||
224 | { | ||
225 | ret = 8; | ||
226 | return; | ||
227 | } | ||
228 | } | 232 | } |
229 | if (!found_pin_rec) | 233 | } |
234 | if (! found_pin_rec) | ||
235 | { | ||
236 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
237 | NULL, NULL, &st, &code, | ||
238 | "gnunet-namestore", | ||
239 | "gnunet-namestore", "-z", "master-zone", | ||
240 | "-a", "-e", "never", "-n", "pin", "-p", "-t", | ||
241 | "PKEY", "-V", pin_zone_pkey, | ||
242 | NULL)) | ||
230 | { | 243 | { |
231 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 244 | ret = 10; |
232 | "gnunet-namestore", | 245 | return; |
233 | "gnunet-namestore", "-z", "master-zone", "-a", "-e", "never", "-n", "pin", "-p", "-t", "PKEY", "-V", pin_zone_pkey, NULL)) | ||
234 | { | ||
235 | ret = 10; | ||
236 | return; | ||
237 | } | ||
238 | } | 246 | } |
247 | } | ||
239 | list_it = NULL; | 248 | list_it = NULL; |
240 | GNUNET_SCHEDULER_shutdown(); | 249 | GNUNET_SCHEDULER_shutdown (); |
241 | } | 250 | } |
242 | 251 | ||
243 | 252 | ||
244 | static void | 253 | static void |
245 | zone_iteration_finished(void *cls) | 254 | zone_iteration_finished (void *cls) |
246 | { | 255 | { |
247 | } | 256 | } |
248 | 257 | ||
@@ -281,42 +290,47 @@ zone_iteration_finished(void *cls) | |||
281 | * must thus no longer be used | 290 | * must thus no longer be used |
282 | */ | 291 | */ |
283 | static void | 292 | static void |
284 | get_ego(void *cls, | 293 | get_ego (void *cls, |
285 | struct GNUNET_IDENTITY_Ego *ego, | 294 | struct GNUNET_IDENTITY_Ego *ego, |
286 | void **ctx, | 295 | void **ctx, |
287 | const char *identifier) | 296 | const char *identifier) |
288 | { | 297 | { |
289 | static struct GNUNET_CRYPTO_EcdsaPublicKey pk; | 298 | static struct GNUNET_CRYPTO_EcdsaPublicKey pk; |
290 | 299 | ||
291 | if (NULL == ego) | 300 | if (NULL == ego) |
301 | { | ||
302 | if ((NULL == master_zone_pkey) || | ||
303 | (NULL == private_zone_pkey) ) | ||
292 | { | 304 | { |
293 | if (NULL == master_zone_pkey || | 305 | ret = 11; |
294 | NULL == private_zone_pkey) | 306 | GNUNET_SCHEDULER_shutdown (); |
295 | { | ||
296 | ret = 11; | ||
297 | GNUNET_SCHEDULER_shutdown(); | ||
298 | return; | ||
299 | } | ||
300 | list_it = GNUNET_NAMESTORE_zone_iteration_start(ns, | ||
301 | &master_pk, &zone_iteration_error, NULL, &zone_iterator, NULL, &zone_iteration_finished, NULL); | ||
302 | if (NULL == list_it) | ||
303 | { | ||
304 | ret = 12; | ||
305 | GNUNET_SCHEDULER_shutdown(); | ||
306 | } | ||
307 | return; | 307 | return; |
308 | } | 308 | } |
309 | GNUNET_IDENTITY_ego_get_public_key(ego, &pk); | 309 | list_it = GNUNET_NAMESTORE_zone_iteration_start (ns, |
310 | &master_pk, | ||
311 | &zone_iteration_error, | ||
312 | NULL, &zone_iterator, NULL, | ||
313 | &zone_iteration_finished, | ||
314 | NULL); | ||
315 | if (NULL == list_it) | ||
316 | { | ||
317 | ret = 12; | ||
318 | GNUNET_SCHEDULER_shutdown (); | ||
319 | } | ||
320 | return; | ||
321 | } | ||
322 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | ||
310 | if (NULL != identifier) | 323 | if (NULL != identifier) |
324 | { | ||
325 | if ((NULL == master_zone_pkey) &&(0 == strcmp ("master-zone", identifier)) ) | ||
311 | { | 326 | { |
312 | if (NULL == master_zone_pkey && 0 == strcmp("master-zone", identifier)) | 327 | master_zone_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); |
313 | { | 328 | master_pk = *GNUNET_IDENTITY_ego_get_private_key (ego); |
314 | master_zone_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string(&pk); | ||
315 | master_pk = *GNUNET_IDENTITY_ego_get_private_key(ego); | ||
316 | } | ||
317 | else if (NULL == private_zone_pkey && 0 == strcmp("private-zone", identifier)) | ||
318 | private_zone_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string(&pk); | ||
319 | } | 329 | } |
330 | else if ((NULL == private_zone_pkey) &&(0 == strcmp ("private-zone", | ||
331 | identifier)) ) | ||
332 | private_zone_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | ||
333 | } | ||
320 | } | 334 | } |
321 | 335 | ||
322 | /** | 336 | /** |
@@ -325,27 +339,27 @@ get_ego(void *cls, | |||
325 | * @param cls NULL | 339 | * @param cls NULL |
326 | */ | 340 | */ |
327 | static void | 341 | static void |
328 | shutdown_task(void *cls) | 342 | shutdown_task (void *cls) |
329 | { | 343 | { |
330 | GNUNET_free_non_null(master_zone_pkey); | 344 | GNUNET_free_non_null (master_zone_pkey); |
331 | master_zone_pkey = NULL; | 345 | master_zone_pkey = NULL; |
332 | GNUNET_free_non_null(private_zone_pkey); | 346 | GNUNET_free_non_null (private_zone_pkey); |
333 | private_zone_pkey = NULL; | 347 | private_zone_pkey = NULL; |
334 | if (NULL != list_it) | 348 | if (NULL != list_it) |
335 | { | 349 | { |
336 | GNUNET_NAMESTORE_zone_iteration_stop(list_it); | 350 | GNUNET_NAMESTORE_zone_iteration_stop (list_it); |
337 | list_it = NULL; | 351 | list_it = NULL; |
338 | } | 352 | } |
339 | if (NULL != ns) | 353 | if (NULL != ns) |
340 | { | 354 | { |
341 | GNUNET_NAMESTORE_disconnect(ns); | 355 | GNUNET_NAMESTORE_disconnect (ns); |
342 | ns = NULL; | 356 | ns = NULL; |
343 | } | 357 | } |
344 | if (NULL != sh) | 358 | if (NULL != sh) |
345 | { | 359 | { |
346 | GNUNET_IDENTITY_disconnect(sh); | 360 | GNUNET_IDENTITY_disconnect (sh); |
347 | sh = NULL; | 361 | sh = NULL; |
348 | } | 362 | } |
349 | } | 363 | } |
350 | 364 | ||
351 | /** | 365 | /** |
@@ -357,71 +371,87 @@ shutdown_task(void *cls) | |||
357 | * @param c configuration | 371 | * @param c configuration |
358 | */ | 372 | */ |
359 | static void | 373 | static void |
360 | run(void *cls, char *const *args, const char *cfgfile, | 374 | run (void *cls, char *const *args, const char *cfgfile, |
361 | const struct GNUNET_CONFIGURATION_Handle *c) | 375 | const struct GNUNET_CONFIGURATION_Handle *c) |
362 | { | 376 | { |
363 | enum GNUNET_OS_ProcessStatusType st; | 377 | enum GNUNET_OS_ProcessStatusType st; |
364 | unsigned long code; | 378 | unsigned long code; |
365 | 379 | ||
366 | cfg = c; | 380 | cfg = c; |
367 | 381 | ||
368 | if (0 != run_process_and_wait(GNUNET_NO, 0, NULL, NULL, &st, &code, | 382 | if (0 != run_process_and_wait (GNUNET_NO, 0, NULL, NULL, &st, &code, |
369 | "gnunet-arm", | 383 | "gnunet-arm", |
370 | "gnunet-arm", "-I", NULL)) | 384 | "gnunet-arm", "-I", NULL)) |
371 | { | 385 | { |
372 | if (7 == ret) | 386 | if (7 == ret) |
373 | fprintf(stderr, "GNUnet is not running, please start GNUnet before running import\n"); | 387 | fprintf (stderr, |
374 | return; | 388 | "GNUnet is not running, please start GNUnet before running import\n"); |
375 | } | 389 | return; |
390 | } | ||
376 | 391 | ||
377 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 392 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
378 | "gnunet-identity", | 393 | NULL, NULL, &st, &code, |
379 | "gnunet-identity", "-C", "master-zone", NULL)) | 394 | "gnunet-identity", |
395 | "gnunet-identity", "-C", "master-zone", NULL)) | ||
380 | return; | 396 | return; |
381 | 397 | ||
382 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 398 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
383 | "gnunet-identity", | 399 | NULL, NULL, &st, &code, |
384 | "gnunet-identity", "-C", "private-zone", NULL)) | 400 | "gnunet-identity", |
401 | "gnunet-identity", "-C", "private-zone", NULL)) | ||
385 | return; | 402 | return; |
386 | 403 | ||
387 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 404 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
388 | "gnunet-identity", | 405 | NULL, NULL, &st, &code, |
389 | "gnunet-identity", "-C", "sks-zone", NULL)) | 406 | "gnunet-identity", |
407 | "gnunet-identity", "-C", "sks-zone", NULL)) | ||
390 | return; | 408 | return; |
391 | 409 | ||
392 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 410 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
393 | "gnunet-identity", | 411 | NULL, NULL, &st, &code, |
394 | "gnunet-identity", "-e", "master-zone", "-s", "gns-master", NULL)) | 412 | "gnunet-identity", |
413 | "gnunet-identity", "-e", "master-zone", "-s", | ||
414 | "gns-master", NULL)) | ||
395 | return; | 415 | return; |
396 | 416 | ||
397 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 417 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
398 | "gnunet-identity", | 418 | NULL, NULL, &st, &code, |
399 | "gnunet-identity", "-e", "master-zone", "-s", "namestore", NULL)) | 419 | "gnunet-identity", |
420 | "gnunet-identity", "-e", "master-zone", "-s", | ||
421 | "namestore", NULL)) | ||
400 | return; | 422 | return; |
401 | 423 | ||
402 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 424 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
403 | "gnunet-identity", | 425 | NULL, NULL, &st, &code, |
404 | "gnunet-identity", "-e", "master-zone", "-s", "gns-proxy", NULL)) | 426 | "gnunet-identity", |
427 | "gnunet-identity", "-e", "master-zone", "-s", | ||
428 | "gns-proxy", NULL)) | ||
405 | return; | 429 | return; |
406 | 430 | ||
407 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 431 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
408 | "gnunet-identity", | 432 | NULL, NULL, &st, &code, |
409 | "gnunet-identity", "-e", "master-zone", "-s", "gns-intercept", NULL)) | 433 | "gnunet-identity", |
434 | "gnunet-identity", "-e", "master-zone", "-s", | ||
435 | "gns-intercept", NULL)) | ||
410 | return; | 436 | return; |
411 | 437 | ||
412 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 438 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
413 | "gnunet-identity", | 439 | NULL, NULL, &st, &code, |
414 | "gnunet-identity", "-e", "private-zone", "-s", "gns-private", NULL)) | 440 | "gnunet-identity", |
441 | "gnunet-identity", "-e", "private-zone", "-s", | ||
442 | "gns-private", NULL)) | ||
415 | return; | 443 | return; |
416 | 444 | ||
417 | if (0 != run_process_and_wait(GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, &st, &code, | 445 | if (0 != run_process_and_wait (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, |
418 | "gnunet-identity", | 446 | NULL, NULL, &st, &code, |
419 | "gnunet-identity", "-e", "sks-zone", "-s", "fs-sks", NULL)) | 447 | "gnunet-identity", |
448 | "gnunet-identity", "-e", "sks-zone", "-s", | ||
449 | "fs-sks", NULL)) | ||
420 | return; | 450 | return; |
421 | 451 | ||
422 | ns = GNUNET_NAMESTORE_connect(cfg); | 452 | ns = GNUNET_NAMESTORE_connect (cfg); |
423 | sh = GNUNET_IDENTITY_connect(cfg, &get_ego, NULL); | 453 | sh = GNUNET_IDENTITY_connect (cfg, &get_ego, NULL); |
424 | GNUNET_SCHEDULER_add_shutdown(&shutdown_task, NULL); | 454 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
425 | } | 455 | } |
426 | 456 | ||
427 | 457 | ||
@@ -433,23 +463,24 @@ run(void *cls, char *const *args, const char *cfgfile, | |||
433 | * @return 0 ok, 1 on error | 463 | * @return 0 ok, 1 on error |
434 | */ | 464 | */ |
435 | int | 465 | int |
436 | main(int argc, char *const *argv) | 466 | main (int argc, char *const *argv) |
437 | { | 467 | { |
438 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 468 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
439 | GNUNET_GETOPT_OPTION_END | 469 | GNUNET_GETOPT_OPTION_END |
440 | }; | 470 | }; |
441 | int r; | 471 | int r; |
442 | 472 | ||
443 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv)) | 473 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
444 | return 2; | 474 | return 2; |
445 | 475 | ||
446 | GNUNET_log_setup("gnunet-gns-import", "WARNING", NULL); | 476 | GNUNET_log_setup ("gnunet-gns-import", "WARNING", NULL); |
447 | ret = 0; | 477 | ret = 0; |
448 | r = GNUNET_PROGRAM_run(argc, argv, "gnunet-gns-import", | 478 | r = GNUNET_PROGRAM_run (argc, argv, "gnunet-gns-import", |
449 | _("This program will import some GNS authorities into your GNS namestore."), | 479 | _ ( |
450 | options, | 480 | "This program will import some GNS authorities into your GNS namestore."), |
451 | &run, NULL); | 481 | options, |
452 | GNUNET_free((void*)argv); | 482 | &run, NULL); |
483 | GNUNET_free ((void*) argv); | ||
453 | return GNUNET_OK == r ? ret : 1; | 484 | return GNUNET_OK == r ? ret : 1; |
454 | } | 485 | } |
455 | 486 | ||