Skip to content

Commit

Permalink
Release v1.1.4 (#9)
Browse files Browse the repository at this point in the history
* update changes
* test: increase timeout by 1s
  • Loading branch information
msimerson authored Jan 19, 2023
1 parent 3a7eda0 commit 2e818d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
6 changes: 6 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
### Unreleased


### [1.1.4] - 2023-01-19

- Export SPF class (#8)


### [1.1.3] - 2022-12-23

- fix print log (#6)
Expand Down Expand Up @@ -37,3 +42,4 @@
[1.0.1]: https://github.com/haraka/haraka-plugin-spf/releases/tag/1.0.1
[1.1.2]: https://github.com/haraka/haraka-plugin-spf/releases/tag/1.1.2
[1.1.3]: https://github.com/haraka/haraka-plugin-spf/releases/tag/1.1.3
[1.1.4]: https://github.com/haraka/haraka-plugin-spf/releases/tag/1.1.4
29 changes: 23 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('return_results', function () {
done()
}, this.connection, spf, 'mfrom', spf.SPF_NONE, '[email protected]');
})

it('result, none, reject=true', function (done) {

this.plugin.cfg.deny.mfrom_none=true;
Expand All @@ -52,76 +53,85 @@ describe('return_results', function () {
done()
}, this.connection, spf, 'mfrom', spf.SPF_NONE, '[email protected]');
})

it('result, neutral', function (done) {
this.plugin.return_results(function next () {
assert.equal(undefined, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_NEUTRAL, '[email protected]');
})

it('result, pass', function (done) {
this.plugin.return_results(function next () {
assert.equal(undefined, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_PASS, '[email protected]');
})
it('result, softfail, reject=false', function (done) {

it('result, softfail, reject=false', function (done) {
this.plugin.cfg.deny.mfrom_softfail=false;
this.plugin.return_results(function next () {
assert.equal(undefined, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_SOFTFAIL, '[email protected]');
})

it('result, softfail, reject=true', function (done) {
this.plugin.cfg.deny.mfrom_softfail=true;
this.plugin.return_results(function next () {
assert.equal(DENY, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_SOFTFAIL, '[email protected]');
})

it('result, fail, reject=false', function (done) {
this.plugin.cfg.deny.mfrom_fail=false;
this.plugin.return_results(function next () {
assert.equal(undefined, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_FAIL, '[email protected]');
})

it('result, fail, reject=true', function (done) {
this.plugin.cfg.deny.mfrom_fail=true;
this.plugin.return_results(function next () {
assert.equal(DENY, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_FAIL, '[email protected]');
})

it('result, temperror, reject=false', function (done) {
this.plugin.cfg.defer.mfrom_temperror=false;
this.plugin.return_results(function next () {
assert.equal(undefined, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_TEMPERROR, '[email protected]');
})

it('result, temperror, reject=true', function (done) {
function next () {
this.plugin.cfg.defer.mfrom_temperror=true;
this.plugin.return_results(function next () {
assert.equal(DENYSOFT, arguments[0]);
done()
}
this.plugin.cfg.defer.mfrom_temperror=true;
this.plugin.return_results(next, this.connection, spf, 'mfrom', spf.SPF_TEMPERROR, '[email protected]');
}, this.connection, spf, 'mfrom', spf.SPF_TEMPERROR, '[email protected]');
})

it('result, permerror, reject=false', function (done) {
this.plugin.cfg.deny.mfrom_permerror=false;
this.plugin.return_results(function next () {
assert.equal(undefined, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_PERMERROR, '[email protected]');
})

it('result, permerror, reject=true', function (done) {
this.plugin.cfg.deny.mfrom_permerror=true;
this.plugin.return_results( function next () {
assert.equal(DENY, arguments[0]);
done()
}, this.connection, spf, 'mfrom', spf.SPF_PERMERROR, '[email protected]');
})

it('result, unknown', function (done) {
this.plugin.return_results(function next () {
assert.equal(undefined, arguments[0]);
Expand All @@ -142,6 +152,7 @@ describe('hook_helo', function () {
this.plugin.helo_spf(next, this.connection);
this.plugin.helo_spf(next, this.connection, 'helo.sender.com');
})

it('IPv4 literal', function (done) {
this.connection.remote.ip='190.168.1.1';
this.plugin.helo_spf(function next (rc) {
Expand All @@ -163,6 +174,7 @@ describe('hook_mail', function () {
done()
}, this.connection, [test_addr]);
})

it('rfc1918 relaying', function (done) {
this.connection.set('remote.is_private', true);
this.connection.set('remote.ip','192.168.1.1');
Expand All @@ -172,6 +184,7 @@ describe('hook_mail', function () {
done()
}, this.connection, [test_addr]);
})

it('no txn', function (done) {
this.connection.remote.ip='207.85.1.1';
delete this.connection.transaction;
Expand All @@ -180,6 +193,7 @@ describe('hook_mail', function () {
done()
}, this.connection);
})

it('txn, no helo', function (done) {
this.plugin.cfg.deny.mfrom_fail = false;
this.connection.remote.ip='207.85.1.1';
Expand All @@ -188,6 +202,7 @@ describe('hook_mail', function () {
done()
}, this.connection, [test_addr]);
})

it('txn', function (done) {
this.connection.set('remote', 'ip', '207.85.1.1');
this.connection.set('hello', 'host', 'mail.example.com');
Expand All @@ -196,6 +211,7 @@ describe('hook_mail', function () {
done()
}, this.connection, [test_addr]);
})

it('txn, relaying', function (done) {
this.connection.set('remote.ip', '207.85.1.1');
this.connection.relaying=true;
Expand All @@ -205,8 +221,9 @@ describe('hook_mail', function () {
done()
}, this.connection, [test_addr]);
})

it('txn, relaying, is_private', function (done) {
this.timeout(4000)
this.timeout(6000)
this.plugin.cfg.relay.context='myself';
this.plugin.cfg.deny_relay.mfrom_fail = true;
this.connection.set('remote.ip', '127.0.1.1');
Expand Down

0 comments on commit 2e818d9

Please sign in to comment.