gecko/toolkit/crashreporter/client/maemo-unit/test_maemo_certs.js
Ted Mielczarek 019fb8dad6 bug 557113 - sort out crash report certificate issues on Maemo. r=mfinkle,johnath
--HG--
extra : rebase_source : 5bd378a2721eeef2cb3abc3b54e15429be7c2416
2010-04-09 16:52:04 -04:00

32 lines
1.4 KiB
JavaScript

/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/*
* This test validates that OpenSSL running on this system can
* validate the server certificate in crashreports.crt against the
* list of CA certificates in crashreporter.crt. On Maemo systems,
* OpenSSL has a bug where the ordering of certain certificates
* in the CA certificate file can cause validation to fail.
* This test is intended to catch that condition in case the NSS
* certificate list changes in a way that would trigger the bug.
*/
function run_test() {
let file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("/bin/sh");
let process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
let shscript = do_get_file("opensslverify.sh");
let cacerts = do_get_file("crashreporter.crt");
let servercert = do_get_file("crashreports.crt");
let args = [shscript.path, cacerts.path, servercert.path];
process.run(true, args, args.length);
dump('If the following test fails, the logic in toolkit/crashreporter/client/certdata2pem.py needs to be fixed, otherwise crash report submission on Maemo will fail.\n');
do_check_eq(process.exitValue, 0);
}