Commit 6cd71b1c authored by Sam Varshavchik's avatar Sam Varshavchik

Fixes

parent 03a33037
2019-02-05 Sam Varshavchik <mrsam@courier-mta.com>
* courier/libs/comsts.c (open_and_lock_cached_policy_file): Fix
errno getting clobbered by isatty().
* courier/filters/verifyfilter.c: -n option explicitly suppresses
stderr.
* courier/filters/verifysender: Pass the -n option to verifysmtp.
2019-02-03 Sam Varshavchik <mrsam@courier-mta.com>
* testmxlookup: implement the Strict Transport Security policy for
......
......@@ -465,11 +465,15 @@ void lookup(int argc, char **argv)
memset(&my_env, 0, sizeof(my_env));
while ((opt=getopt(argc, argv, "cm:t:")) != -1)
while ((opt=getopt(argc, argv, "cnm:t:")) != -1)
{
switch (opt) {
case 'c':
break;
case 'n':
close(2);
open("/dev/null", O_WRONLY);
break;
case 't':
trackdir=optarg;
break;
......@@ -478,7 +482,7 @@ void lookup(int argc, char **argv)
break;
default:
fprintf(stderr,
"Usage: verifysmtp [-t trackingdirectory] [-m full|base|domain]\n");
"Usage: verifysmtp [-t trackingdirectory] [-m full|base]\n");
exit(1);
}
}
......
......@@ -32,11 +32,6 @@
</group>
<arg choice="plain">verifyfilter</arg>
</cmdsynopsis>
<cmdsynopsis sepchar=" ">
<command>verifysmtp</command>
<arg choice="req">user@domain</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
......@@ -89,10 +84,14 @@
<refsect2>
<title>The <command>verifysmtp</command> command</title>
<cmdsynopsis sepchar=" ">
<command>@bindir@/verifysmtp</command>
<command>verifysmtp</command>
<arg choice="opt">-n</arg>
<arg choice="opt">-t <replaceable>directory</replaceable></arg>
<arg choice="opt">-m {full|base}</arg>
<arg choice="req">user@domain</arg>
</cmdsynopsis>
</cmdsynopsis>
<para>
The <command>verifysmtp</command> command creates a network connection
......@@ -108,6 +107,21 @@
all given E-mail addresses passed. A non-zero exit code indicates that
one or more of the given addresses were rejected.
</para>
<para>
The <option>-m</option> option is analogous to the
<filename>verifyfilter-logmode</filename> setting, described below,
that specifies how E-mail addresses are compared against the cached
verification results.
The <option>-t</option> enables caching of verification results,
and specifies the directory for storing the cached results.
</para>
<para>
The <option>-n</option> option suppresses internal error messages
from getting logged to standard error. This is used in the
<command>verifyfilter</command> global mail filter.
</para>
</refsect2>
<refsect2>
......
......@@ -11,7 +11,7 @@
# Must mkdir $HOME/.trackdir before using this.
import SENDER
system '@bindir@/verifysmtp -t $HOME/.trackdir'
system '@bindir@/verifysmtp -n -t $HOME/.trackdir'
if ($RETURNCODE != 0)
{
......
......@@ -8,7 +8,7 @@
# Must mkdir $HOME/.trackdir before using this.
import SENDER
system '@bindir@/verifysmtp -m full -t $HOME/.trackdir'
system '@bindir@/verifysmtp -n -m full -t $HOME/.trackdir'
if ($RETURNCODE != 0)
{
......
......@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
static char *policy_filename_for_domain(const char *domain);
static FILE *open_and_lock_cached_policy_file(const char *filename,
......@@ -350,6 +351,7 @@ static FILE *open_and_lock_cached_policy_file(const char *filename,
int *readwrite)
{
int fd;
int save_errno;
*readwrite=1;
fd=open(filename, O_RDWR | O_CREAT, 0644);
......@@ -369,10 +371,12 @@ static FILE *open_and_lock_cached_policy_file(const char *filename,
** script let's bark this somewhere where someone will hopefully
** notice this.
*/
save_errno=errno;
if (!isatty(2))
{
errno=save_errno;
perror(filename);
}
if (fd >= 0)
close(fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment