Closed gitwart closed 5 months ago
Interesting that it appeared to at least load the lens for you. I needed 194e18dcab32d2f122dda2bf43db1a6a62a655bd to load it.
Removing the underscore from the destination address (sampleuser@example.com) makes the error go away. Adding an underscore to the
word
definition in postfixcanonical.aug line 35 seems to fix the problem: `let word = store /[A-Za-z0-9@*.+-]+/`
Can you submit a patch for that? Ideally with tests.
Hi, from RFC 3696 (informational only but referring to RFC 2821 and RFC 2822):
Without quotes, local-parts may consist of any combination of
alphabetic characters, digits, or any of the special characters
! # $ % & ' * + - / = ? ^ _ ` . { | } ~
period (".") may also appear, but may not be used to start or end the
local part, nor may two or more consecutive periods appear. Stated
differently, any ASCII graphic (printing) character other than the
at-sign ("@"), backslash, double quote, comma, or square brackets may
appear without quoting. If any of that list of excluded characters
are to appear, they must be quoted.
So it looks like the regex should be made much more complex in order to support all possible local parts.. On my side I am affected by the lack of the underscore as well, and I'm willing to contribute a patch/test. @ekohl what do you think would be the best approach? I feel like a complete rewrite of that lens would be overkill.
Sounds like you should submit a patch to add at least _
here:
https://github.com/voxpupuli/puppet-postfix/blob/2c326befd68bcd1c36a9f6a6ce68d22d6976b483/lib/augeas/lenses/postfix_canonical.aug#L35
But I'll be honest and say that I know little about Augeas lenses.
OK cool - I'll work on a patch then.
I guess we can also tolerate quoted addresses too, and matching correctness this with a regular expression is probably not possible. So I would not mind if you can pass invalid addresses that are accepted by augeas but break postfix later (I did not checked but I suspect it is already the case), that seems better than rejecting valid addresses that should work.
Maybe matching non-blank for word
is enough? Adding "weird" addresses into spec/defines/postfix_canonical_spec.rb
should show if it behaves as expected.
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
What are you seeing
The puppet agent generates an error:
The debug output from the puppet agent:
What behaviour did you expect instead
The address mapping is added to the canonical file
Output log
Any additional information you'd like to impart
Removing the underscore from the destination address (sampleuser@example.com) makes the error go away. Adding an underscore to the
word
definition in postfixcanonical.aug line 35 seems to fix the problem: `let word = store /[A-Za-z0-9@*.+-]+/`