Mercurial > trustbridge
comparison cinst/mozilla.c @ 281:0f73fe4230c1
Fixed and optimized production build.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 02 Apr 2014 15:22:13 +0200 |
parents | 6c4b3ff4a356 |
children | fb9e14f4b4c9 |
comparison
equal
deleted
inserted
replaced
280:6c4b3ff4a356 | 281:0f73fe4230c1 |
---|---|
303 strv_free(mozinis); | 303 strv_free(mozinis); |
304 } | 304 } |
305 return alldirs; | 305 return alldirs; |
306 } | 306 } |
307 | 307 |
308 #ifdef DEBUGOUTPUT | |
308 /** | 309 /** |
309 * @brief list certificates from nss certificate store | 310 * @brief list certificates from nss certificate store |
310 * @param[in] confdir the directory with the certificate store | 311 * @param[in] confdir the directory with the certificate store |
311 */ | 312 */ |
312 static void | 313 static void |
313 nss_list_certs (char *confdir) | 314 DEBUG_nss_list_certs (char *confdir) |
314 { | 315 { |
315 CERTCertList *list; | 316 CERTCertList *list; |
316 CERTCertListNode *node; | 317 CERTCertListNode *node; |
317 char *name; | 318 char *name; |
318 | 319 |
322 list = PK11_ListCerts(PK11CertListAll, NULL); | 323 list = PK11_ListCerts(PK11CertListAll, NULL); |
323 for (node = CERT_LIST_HEAD(list); !CERT_LIST_END(node, list); | 324 for (node = CERT_LIST_HEAD(list); !CERT_LIST_END(node, list); |
324 node = CERT_LIST_NEXT(node)) { | 325 node = CERT_LIST_NEXT(node)) { |
325 name = node->appData; | 326 name = node->appData; |
326 | 327 |
327 printf ("Found certificate \"%s\"\n", name); | 328 DEBUGPRINTF("Found certificate \"%s\"\n", name); |
328 } | 329 } |
329 CERT_DestroyCertList(list); | 330 CERT_DestroyCertList(list); |
330 NSS_Shutdown(); | 331 NSS_Shutdown(); |
331 } | 332 } |
332 else | 333 else |
333 DEBUGPRINTF("Could not open nss certificate store in %s!\n", confdir); | 334 { |
334 } | 335 DEBUGPRINTF("Could not open nss certificate store in %s!\n", confdir); |
336 } | |
337 } | |
338 #endif | |
335 | 339 |
336 /** | 340 /** |
337 * @brief Create a string with the name for cert in SECItem. | 341 * @brief Create a string with the name for cert in SECItem. |
338 * | 342 * |
339 * Should be freed by caller. | 343 * Should be freed by caller. |
375 secitem->data = dercert; | 379 secitem->data = dercert; |
376 secitem->len = (unsigned int) dercertlen; | 380 secitem->len = (unsigned int) dercertlen; |
377 return true; | 381 return true; |
378 } | 382 } |
379 else | 383 else |
380 DEBUGPRINTF("Base64 decode failed for: %s\n", b64); | 384 { |
385 DEBUGPRINTF("Base64 decode failed for: %s\n", b64); | |
386 } | |
381 return false; | 387 return false; |
382 } | 388 } |
383 | 389 |
384 /** | 390 /** |
385 * @brief Store DER certificate in mozilla store. | 391 * @brief Store DER certificate in mozilla store. |
587 | 593 |
588 if (pdirs != NULL) | 594 if (pdirs != NULL) |
589 { | 595 { |
590 parse_commands(&certs_to_add, &certs_to_remove); | 596 parse_commands(&certs_to_add, &certs_to_remove); |
591 | 597 |
592 puts("OLD List of installed certs:"); | 598 #ifdef DEBUGOUTPUT |
599 DEBUGPRINTF("OLD List of installed certs:"); | |
593 for (int i=0; pdirs[i] != NULL; i++) | 600 for (int i=0; pdirs[i] != NULL; i++) |
594 nss_list_certs(pdirs[i]); | 601 DEBUG_nss_list_certs(pdirs[i]); |
602 #endif | |
595 | 603 |
596 if (! apply_to_certs_and_profiles(remove_cert, &certs_to_remove, pdirs)) | 604 if (! apply_to_certs_and_profiles(remove_cert, &certs_to_remove, pdirs)) |
597 return_code |= WARN_MOZ_COULD_NOT_REMOVE_CERT; | 605 return_code |= WARN_MOZ_COULD_NOT_REMOVE_CERT; |
598 | 606 |
599 if (! apply_to_certs_and_profiles(import_cert, &certs_to_add, pdirs)) | 607 if (! apply_to_certs_and_profiles(import_cert, &certs_to_add, pdirs)) |
600 return_code |= WARN_MOZ_COULD_NOT_ADD_CERT; | 608 return_code |= WARN_MOZ_COULD_NOT_ADD_CERT; |
601 | 609 |
602 puts("NEW List of installed certs:"); | 610 #ifdef DEBUGOUTPUT |
611 DEBUGPRINTF("NEW List of installed certs:"); | |
603 for (int i=0; pdirs[i] != NULL; i++) | 612 for (int i=0; pdirs[i] != NULL; i++) |
604 nss_list_certs(pdirs[i]); | 613 DEBUG_nss_list_certs(pdirs[i]); |
614 #endif | |
605 | 615 |
606 strv_free(pdirs); | 616 strv_free(pdirs); |
607 } | 617 } |
608 exit(return_code); | 618 exit(return_code); |
609 } | 619 } |