Skip to content

Commit

Permalink
authres: Put 'reason' before other properies
Browse files Browse the repository at this point in the history
  • Loading branch information
foxcpp authored and emersion committed Oct 21, 2019
1 parent 18668a7 commit dc24987
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions authres/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ func resultMethod(r Result) string {
func formatParams(params map[string]string) string {
keys := make([]string, 0, len(params))
for k := range params {
if k == "reason" {
continue
}
keys = append(keys, k)
}
sort.Strings(keys)
if params["reason"] != "" {
keys = append([]string{"reason"}, keys...)
}

s := ""
i := 0
Expand Down
8 changes: 8 additions & 0 deletions authres/msgauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ var msgauthTests = []msgauthTest{
&SPFResult{Value: ResultPass, From: "example.net"},
},
},
{
value: "example.com;" +
" spf=fail reason=bad smtp.mailfrom=example.net",
identifier: "example.com",
results: []Result{
&SPFResult{Value: ResultFail, Reason: "bad", From: "example.net"},
},
},
{
value: "example.com;" +
" auth=pass [email protected];" +
Expand Down

0 comments on commit dc24987

Please sign in to comment.