Now, to get rid of this problem, I made a patch that adds an exception
class that carries both an exit code as per <sysexits.h> and a
message. It's ugly and can be optimized to merge common code, so
consider this a proof-of-concept draft. The Invalid-User exit code is
changed to EX_NOUSER (was EX_TEMPFAIL).
Apply against the latest beta.
Please state if (and subject to which conditions) this patch can be
merged. Permission to relicense herewith granted, provided that my name
with my address <matt...@gmx.de> is mentioned in the ChangeLog.
diff -ur maildrop-1.3.8.20020418/maildrop/maildrop.C
maildrop-1.3.8.20020418-ma1/maildrop/maildrop.C
--- maildrop-1.3.8.20020418/maildrop/maildrop.C Sun Dec 31 07:04:00 2000
+++ maildrop-1.3.8.20020418-ma1/maildrop/maildrop.C Tue Apr 23 17:09:04 2002
@@ -74,6 +74,15 @@
cleanup();
return (r);
}
+ catch (Except e)
+ {
+ merr << argv[0] << ": " << e.string << "\n";
+#if SYSLOG_LOGGING
+ syslog(LOG_INFO, e.string);
+#endif
+ cleanup();
+ return (e.exit_code);
+ }
catch (const char *p)
{
merr << argv[0] << ": " << p << "\n";
diff -ur maildrop-1.3.8.20020418/maildrop/maildrop.h
maildrop-1.3.8.20020418-ma1/maildrop/maildrop.h
--- maildrop-1.3.8.20020418/maildrop/maildrop.h Fri Sep 10 04:10:05 1999
+++ maildrop-1.3.8.20020418-ma1/maildrop/maildrop.h Tue Apr 23 17:08:31 2002
@@ -16,6 +16,13 @@
#include "mio.h"
#include "config.h"
+class Except {
+public:
+ int exit_code;
+ const char *string;
+ Except(int ex, const char *s) { exit_code = ex; string = s; }
+};
+
class Maildrop {
public:
int verbose_level; // Current verbose level
diff -ur maildrop-1.3.8.20020418/maildrop/main.C
maildrop-1.3.8.20020418-ma1/maildrop/main.C
--- maildrop-1.3.8.20020418/maildrop/main.C Fri Feb 15 14:37:15 2002
+++ maildrop-1.3.8.20020418-ma1/maildrop/main.C Tue Apr 23 17:04:09 2002
@@ -90,8 +90,8 @@
static void nouser()
{
- errexit=EX_TEMPFAIL;
- throw "Invalid user specified.";
+ errexit=EX_NOUSER;
+ throw Except(errexit, "Invalid user specified.");
}
static void nochangeuidgid()