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

Adding the possibility to use a third party milter without activating #1

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

wolfyzvf
Copy link

@wolfyzvf wolfyzvf commented Mar 23, 2017

Per default you can't configure a milter wihtout activating the one build in with Zimbra.
The proposed patch add a third scenario where you can use one or several milter wihtout activating the Zimbra one.

Normal Behavior with Milter Zimbra Activated

We add an additional milter with the zimbra milter activated

$zmprov gs `zmhostname` zimbraMilterServerEnabled
# name zimbra87.zimbra.lab
zimbraMilterServerEnabled: TRUE

$zmprov ms `zmhostname` zimbraMtaSmtpdMilters "inet:localhost:10000"

$zmprov gs `zmhostname` zimbraMtaSmtpdMilters
zimbraMtaSmtpdMilters: inet:localhost:10000, inet:127.0.0.1:7026

$zmconfigdctl restart
$postconf smtpd_milters
smtpd_milters = inet:localhost:10000, inet:127.0.0.1:7026

Normal Behavior without Milter Zimbra Activated

We add an additional milter with the zimbra milter desactivated

$zmprov gs `zmhostname` zimbraMilterServerEnabled
# name zimbra87.zimbra.lab
zimbraMilterServerEnabled: FALSE

$zmprov ms `zmhostname` zimbraMtaSmtpdMilters "inet:localhost:10000"
$zmprov gs `zmhostname` zimbraMtaSmtpdMilters
zimbraMtaSmtpdMilters: inet:localhost:10000

$zmconfigdctl restart
$postconf smtpd_milters
smtpd_milters =

After patch

$zmprov gs `zmhostname` zimbraMilterServerEnabled
# name zimbra87.zimbra.lab
zimbraMilterServerEnabled: FALSE

$zmprov gs `zmhostname` zimbraMtaSmtpdMilters
zimbraMtaSmtpdMilters: inet:localhost:10000

$zmconfigdctl restart
$postconf smtpd_milters
smtpd_milters = inet:localhost:10000

@CLAassistant
Copy link

CLAassistant commented Mar 23, 2017

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Frdric Maussion seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.


if self["zimbraMtaSmtpdMilters"] is not None and milter is not None:
self["zimbraMtaSmtpdMilters"] = "%s, %s" % (self["zimbraMtaSmtpdMilters"], milter)
elif self["zimbraMtaSmtpdMilters"] is None and milter is not None:
self["zimbraMtaSmtpdMilters"] = milter
elif self["zimbraMtaSmtpdMilters"] is not None and milter is None:
self["zimbraMtaSmtpdMilters"] = "%s, %s" % (self["zimbraMtaSmtpdMilters"])

Choose a reason for hiding this comment

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

The template string is incorrect here (line 147). The template string is set to accept two strings ("%s, %s"), but only one is provided.

This also seems a bit redundant, since the value is already set and this logic would just simply reset the self["zimbraMtaSmtpdMilters"] value with the value it already has. What would the purpose of the logic on line 146/147 be?

@wolfyzvf
Copy link
Author

wolfyzvf commented Jan 5, 2018

Finally manage to take the time to take a look.
I've simplified the code to take into account the third scenario.

@wolfyzvf
Copy link
Author

@jeastman any chance to review the latest commit ?

@Prashantsurana
Copy link

Hi @jeastman can you please comment on this?

Copy link

@plobbes plobbes left a comment

Choose a reason for hiding this comment

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

I may have missed something, but if not, I think this could be simplified as identified below...

@@ -137,12 +137,14 @@ def load(self, hostname):
if (self["zimbraMilterServerEnabled"] == "TRUE"):
milter = "inet:%s:%s" % (self["zimbraMilterBindAddress"],self["zimbraMilterBindPort"])
else:
self["zimbraMtaSmtpdMilters"] = ""
milter = None
Copy link

Choose a reason for hiding this comment

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

milter is set to None on line 136. No need set that again. Why not just remove lines 139 and 140?


if self["zimbraMtaSmtpdMilters"] is not None and milter is not None:
self["zimbraMtaSmtpdMilters"] = "%s, %s" % (self["zimbraMtaSmtpdMilters"], milter)
elif self["zimbraMtaSmtpdMilters"] is None and milter is not None:
self["zimbraMtaSmtpdMilters"] = milter
else:
Copy link

Choose a reason for hiding this comment

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

Forgive my ignorance, but is this else and the next line even necessary?

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.

5 participants