Skip to content

Commit

Permalink
fixed verification of unsigned e-mails which are marked as should be …
Browse files Browse the repository at this point in the history
…signed by sign rules (#20)
  • Loading branch information
lieser committed Dec 11, 2013
1 parent 5659bc1 commit 46f0811
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 27 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.0.3 [2013-12-12]
------------------
- fixed bug in sign rules if from address contains capital letters
- fixed verification of unsigned e-mails which are marked as should be signed by sign rules

1.0.2 [2013-11-22]
------------------
- fixed internal error if sign rules are disabled
Expand Down
61 changes: 34 additions & 27 deletions modules/dkimVerifier.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Verifies the DKIM-Signatures as specified in RFC 6376
* http://tools.ietf.org/html/rfc6376
*
* Version: 1.0.1 (22 November 2013)
* Version: 1.0.2 (12 December 2013)
*
* Copyright (c) 2013 Philippe Lieser
*
Expand Down Expand Up @@ -948,34 +948,41 @@ var Verifier = (function() {
* handeles Exeption
*/
function handleExeption(e, msg) {
if (e instanceof DKIM_SigError) {
// return result
msg.result = {
version : "1.1",
result : "PERMFAIL",
errorType : e.errorType,
SDID : msg.DKIMSignature.d,
selector : msg.DKIMSignature.s,
shouldBeSignedBy : msg.shouldBeSigned.sdid,
hideFail : msg.shouldBeSigned.hideFail,
};
returnResult(msg);

log.warn(exceptionToStr(e));
} else {
// return result
msg.result = {
version : "1.0",
result : "TEMPFAIL",
errorType : e.errorType
};
returnResult(msg);

if (e instanceof DKIM_InternalError) {
log.error(exceptionToStr(e));
try {
if (e instanceof DKIM_SigError) {
// return result
if (!msg.DKIMSignature) {
msg.DKIMSignature = {}
}
msg.result = {
version : "1.1",
result : "PERMFAIL",
errorType : e.errorType,
SDID : msg.DKIMSignature.d,
selector : msg.DKIMSignature.s,
shouldBeSignedBy : msg.shouldBeSigned.sdid,
hideFail : msg.shouldBeSigned.hideFail,
};
returnResult(msg);

log.warn(exceptionToStr(e));
} else {
log.fatal(exceptionToStr(e));
// return result
msg.result = {
version : "1.0",
result : "TEMPFAIL",
errorType : e.errorType
};
returnResult(msg);

if (e instanceof DKIM_InternalError) {
log.error(exceptionToStr(e));
} else {
log.fatal(exceptionToStr(e));
}
}
} catch (exception) {
log.fatal("handleExeption: "+exception);
}
}

Expand Down

0 comments on commit 46f0811

Please sign in to comment.