Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use npx in package.json scripts #2729

Merged
merged 7 commits into from
Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

### Fixes

* TLS: don't abort loading certs in config/tls dir when an error is encountered.
Process every cert file and then emit errors. #2729


## 2.8.25 - 2019-10-11

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
},
"scripts": {
"test": "node run_tests",
"lint": "node node_modules/.bin/eslint *.js outbound/*.js plugins/*.js plugins/*/*.js tests/*.js tests/*/*.js tests/*/*/*.js bin/haraka bin/spf bin/dkimverify",
"lintfix": "node node_modules/.bin/eslint --fix *.js outbound/*.js plugins/*.js plugins/*/*.js tests/*.js tests/*/*.js tests/*/*/*.js bin/haraka bin/spf bin/dkimverify",
"cover": "NODE_ENV=cov node_modules/.bin/nyc --reporter=lcovonly npm run test"
"lint": "npx eslint *.js outbound/*.js plugins/*.js plugins/*/*.js tests/*.js tests/*/*.js tests/*/*/*.js bin/haraka bin/spf bin/dkimverify",
"lintfix": "npx eslint --fix *.js outbound/*.js plugins/*.js plugins/*/*.js tests/*.js tests/*/*.js tests/*/*/*.js bin/haraka bin/spf bin/dkimverify",
"cover": "NODE_ENV=cov npx nyc --reporter=lcovonly -x tests npm run test"
}
}
2 changes: 1 addition & 1 deletion spf.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class SPF {
let strip = /(\d+)/.exec(match[2]);
if (strip) strip = strip[1];

const reverse = (((`${match[2]}`).indexOf('r')) !== -1 ? true : false);
const reverse = (((`${match[2]}`).indexOf('r')) !== -1);
let replace;
let kind;
switch (match[1]) {
Expand Down
6 changes: 6 additions & 0 deletions tests/spf.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ exports.SPF = {
this.SPF.check_host('212.70.129.94', 'gmail.com', 'haraka.mail@gmail.com', (err, rc) => {
test.equal(null, err);
switch (rc) {
case 1:
if (['win32','win64'].includes(process.platform)) {
test.equal(rc, 1, "none");
console.log('Why does DNS lookup not find gmail SPF record when running on GitHub Actions?');
}
break;
case 3:
test.equal(rc, 3, "fail");
break;
Expand Down
14 changes: 10 additions & 4 deletions tls_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,16 @@ exports.get_certs_dir = (tlsDir, done) => {

const parsed = exports.parse_x509(file.data.toString());
if (!parsed.key) {
return iter_done(`no PRIVATE key in ${file.path}`);
return iter_done(null, {
err: new Error(`no PRIVATE key in ${file.path}`),
file
});
}
if (!parsed.cert) {
log.logerror(`no CERT in ${file.path}`);
return iter_done(`no CERT in ${file.path}`);
return iter_done(null, {
err: new Error(`no CERT in ${file.path}`),
file
});
}

const x509args = { noout: true, text: true };
Expand All @@ -432,7 +437,7 @@ exports.get_certs_dir = (tlsDir, done) => {

const expire = tlss.parse_x509_expire(file, as_str);
if (expire && expire < new Date()) {
log.logerror(`${file.path } expired on ${expire}`);
log.logerror(`${file.path} expired on ${expire}`);
}

iter_done(null, {
Expand All @@ -458,6 +463,7 @@ exports.get_certs_dir = (tlsDir, done) => {
certs.forEach(cert => {
if (cert.err) {
log.logerror(`${cert.file} had error: ${cert.err.message}`);
return;
}

log.logdebug(cert);
Expand Down