Sam, a long time ago a couple of users asked that Courier log the name
of a filter that caused problems when they occur. Would you consider
accepting the attached patch?
--- courier-0.60.0/courier/cdfilters.C.orig 2008-07-18 15:05:40.000000000
-0700
+++ courier-0.60.0/courier/cdfilters.C 2008-07-18 15:10:42.000000000 -0700
@@ -33,6 +33,7 @@
#define FILTER_LIST_INCREMENT 8
#define MEMORY_ERROR "432 Out of memory when processing mail filters.\n"
+#define FILTER_ERROR "432 Mail filters temporarily unavailable.\n"
static int run_filter_dir(const char *filterdir,
const char *filename,
@@ -109,6 +110,17 @@
return 0;
}
+static int dofilter_err(const char *err,
+ std::string sockname)
+{
+ clog_msg_prerrno();
+ clog_msg_start_err();
+ clog_msg_str(err);
+ clog_msg_str(sockname.c_str());
+ clog_msg_send();
+ std::cout << FILTER_ERROR << std::flush;
+}
+
static int dofilter(std::string sockname,
const char *filename,
unsigned nmsgids,
@@ -153,9 +165,7 @@
if (errno != EINPROGRESS)
{
- clog_msg_prerrno();
- std::cout << "432 Mail filters temporarily
unavailable.\n"
- << std::flush;
+ dofilter_err("Failed to connect to: ", sockname);
close(s);
return (1);
}
@@ -166,17 +176,14 @@
FD_SET(s, &fds);
if (select(s+1, &fds, 0, 0, &tv) <= 0)
{
- std::cout << "432 Mail filters temporarily
unavailable.\n"
- << std::flush;
+ dofilter_err("Failed to connect to: ", sockname);
close(s);
return (1);
}
if (connect(s, (struct sockaddr *)&ssun, sizeof(ssun)) &&
errno != EISCONN)
{
- clog_msg_prerrno();
- std::cout << "432 Mail filters temporarily
unavailable.\n"
- << std::flush;
+ dofilter_err("Failed to connect to: ", sockname);
close(s);
return (1);
}
@@ -202,20 +209,16 @@
if (sockstream.bad())
{
+ dofilter_err("Connection closed when processing: ", sockname);
sockstream.close();
- clog_msg_prerrno();
- std::cout << "432 Mail filters temporarily unavailable.\n"
- << std::flush;
close(s);
return (1);
}
if ( std::getline(sockstream, sockname).fail())
{
+ dofilter_err("Connection closed when processing: ", sockname);
sockstream.close();
- clog_msg_prerrno();
- std::cout << "432 Mail filters temporarily unavailable.\n"
- << std::flush;
close(s);
return (1);
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users