Hello,
many domains reject mails which fails DMARC with p=reject providing detailed SMTP reject reasons. If you have this need, the attached patch allows to customize the SMTP reject reason when RejectFailures is true.
I have added the RejectString option, with the special word "%s", replaced by the RFC5322.From domain. In this implementation only one "%s" is admitted (it's easier), but you could consider to improve the mechanism.
Hope this help. I tested it only for few days, any feedback is appreciated.
the \s trigger a compiler warning:
opendmarc.c: In function ‘dmarcf_config_load’:
opendmarc.c:1397:55: warning: unknown escape sequence: '\s'
snprintf(err, errlen, "%s: The RejectString doesn't contain %%\s!",
I assume the backslash may be removed.
Of course, without the backslash the warning disappears and OpenDMARC works as expected. I attached the modified patch, which differs only on the two wrong backslashes. Thank you.
I'm not sure this is complete. If I provide a RejectString of "hi there %%s", it passes your one occurrence test, but in fact when passed to snprintf() the domain substitution won't take place; the output will always be a literal "hi there %s". Internally there will still be a dangling parameter passed to snprintf().