diff --git a/ca-store-generator.js b/ca-store-generator.js index ee82bc7..9094634 100644 --- a/ca-store-generator.js +++ b/ca-store-generator.js @@ -74,18 +74,17 @@ function parseBody(current, lines) { function parseCertData(lines) { var certs = [] - , line , current , skipped = 0 , match , finished ; - while (lines.length > 0) { - line = lines.shift(); - + function parseLine(line) { // nuke whitespace and comments - if (line.match(/^#|^\s*$/)) continue; + if (line.match(/^#|^\s*$/)) { + return; + } if (line.match(/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/)) { current = new Certificate(); @@ -110,6 +109,10 @@ function parseCertData(lines) { } } + while (lines.length > 0) { + parseLine(lines.shift()); + } + console.info("Skipped %s untrusted certificates.", skipped); console.info("Processed %s certificates.", certs.length);