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

Fix #50 remove unnecessary rewrite_from_domains config #54

Merged
merged 4 commits into from
Nov 14, 2022

Conversation

schellj
Copy link
Contributor

@schellj schellj commented Nov 3, 2022

No description provided.

@schellj schellj changed the title Fix #50 remove unnecessary rewrite_from_domains config Fix #50 remove unnecessary rewrite_from_domains config Nov 3, 2022
@schellj schellj force-pushed the 50-remove-rewrite-from-domains branch 2 times, most recently from 896494e to 97e4ef5 Compare November 3, 2022 18:52
@schellj schellj force-pushed the 50-remove-rewrite-from-domains branch from 97e4ef5 to f3d7c72 Compare November 3, 2022 19:17
Copy link
Member

@robnagler robnagler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One question. Merge as you see fit. @moellep will need to generate a release. Maybe wait after Schwab is out of beta.

Mail/Outgoing.pm Outdated
@@ -407,11 +407,6 @@ sub _rewrite_from {
return 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something about the above code bothers me. I think it's only necessary for test, but it seems like if the allow_resend_re fails to match, it should fall through to the rewrite lookup. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if $cfg->{allow_resend_from_re} && $old_email !~ $cfg->{allow_resend_from_re}, then the rewrite will occur, but the dmarc check (_rewrite_from_lookup) wouldn't have occurred. Is the lack of the dmarc check in that case what's bothering you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there should always be a dmarc check unless allow_resend_from_re matches. At least that's how I read the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You understand the intent of this code better than I, but that would seem to make sense. In that case, 405-407 could be changed to:

    if ($cfg->{allow_resend_from_re} && $old_email =~ $cfg->{allow_resend_from_re}) {
        return 1;

(it won't let me do a multi-line code suggestion here)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use code suggestions. :) I don't think that's quite right. I think the else has to get removed so that it falls through if the pattern doesn't match.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the change in my previous comment, the _rewrite_from_lookup dmarc check would get evaluated if the allow_resend_from_re didn't match. I'm not sure what you're saying should change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6e5b2c6 is what i mean

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that's what I would have figured you meant. I wasn't sure because, with the change to the if clause and return from that block, the code is functionally equivalent whether the else is removed or not. The intent is probably more clear with the else removed, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see what you mean now... sorry.

@robnagler robnagler merged commit 8260796 into master Nov 14, 2022
@robnagler robnagler deleted the 50-remove-rewrite-from-domains branch November 14, 2022 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants