Wietse Venema wrote:
Instead of having to maintain a bazillion different reply parameters,
would not it be sufficient to have one generic reply line that
gets appended to all those reject commands?
Hi Wietse,
If the dilemma is between:
* Implementing your proposed work-around quickly, or
* Waiting several months (or longer) for the "ideal" solution
then yes, I could make do with one global error message. Heck,
Microsoft has been doing that for years: "A General Error has occurred.
Press any key to reboot."
However, I'm not sure I understand where the additional burden comes in;
nine times out of ten, a site administrator can simply accept the
defaults, and override only the specific messages he or she deems
necessary (so SHE doesn't have to maintain a bazillion different reply
parameters); and smtpd_check.c already *HAS* the bazillion different
reply strings burned in. This would simply[*] be a matter of extracting
those hard-coded strings from the source, and moving them into the
configuration file.
* - It seems "simple" to my untrained eye, anyway... If the regression
process makes adding new configuration parameters onerous, or there's
something else going on behind the scenes that I'm not aware of, then by
all means, please feel free to enlighten me.
Is it because of the "%s" placeholders? I'd be fine with a set of
optional "_why" strings that are /appended/ to the current error
messages, but ideally, I'm sure I'd want the ability to customize each
message, rather than one catch-all 'Press any key to continue' blanket
statement.
Another consideration, I suppose, is if the ";" semicolon separator
between the error code and the from=<> and to=<> diagnostics is
"magic". In that case, users should avoid using semicolons in their
"_reason" lines, and I'm sure the "correct" thing to do would be to spit
out a warning (which, yeah, is a lot of work...)
Anyway, I didn't feel like holding my breath waiting for these changes
to propagate upstream; I just went ahead and voided my warranty, editing
the source from the OpenBSD 4.5 ports.tgz. Attached is a patch that
adds support for an "unknown_client_reject_reason" parameter (char
*var_unk_client_why). Similar params should be pretty straightforward,
methinks.
Thanks Wietse! :-D
--
:- Dabe
--
:- Dabrien "Dabe" Murphy
:- Sr. Solutions Engineer
:- Parabon Computation, Inc.
:- Frontier® Grid Support Operations Center
--
:- www.Parabon.com
:- "Computing Outside the Box"
--
:- Email: d...@parabon.com
diff -ur w-postfix-2.6.20090125/postfix-2.6-20090125/src/global/mail_params.h
DABE__w-postfix-2.6.20090125/postfix-2.6-20090125/src/global/mail_params.h
--- w-postfix-2.6.20090125/postfix-2.6-20090125/src/global/mail_params.h
Thu Jan 22 16:16:34 2009
+++ DABE__w-postfix-2.6.20090125/postfix-2.6-20090125/src/global/mail_params.h
Thu Aug 13 01:02:01 2009
@@ -1945,6 +1945,10 @@
#define DEF_UNK_CLIENT_CODE 450
extern int var_unk_client_code;
+#define VAR_UNK_CLIENT_WHY "unknown_client_reject_reason"
+#define DEF_UNK_CLIENT_WHY ""
+extern char *var_unk_client_why;
+
#define PERMIT_INET_INTERFACES "permit_inet_interfaces"
#define PERMIT_MYNETWORKS "permit_mynetworks"
diff -ur w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd.c
DABE__w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd.c
--- w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd.c Fri Jan
9 20:36:15 2009
+++ DABE__w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd.c Thu Aug
13 01:03:02 2009
@@ -1058,6 +1058,7 @@
char *var_data_checks;
char *var_eod_checks;
int var_unk_client_code;
+char *var_unk_client_why;
int var_bad_name_code;
int var_unk_name_code;
int var_unk_addr_code;
@@ -4974,6 +4975,7 @@
VAR_MILT_DAEMON_NAME, DEF_MILT_DAEMON_NAME, &var_milt_daemon_name, 1, 0,
VAR_MILT_V, DEF_MILT_V, &var_milt_v, 1, 0,
VAR_STRESS, DEF_STRESS, &var_stress, 0, 0,
+ VAR_UNK_CLIENT_WHY, DEF_UNK_CLIENT_WHY, &var_unk_client_why, 0, 0,
VAR_UNV_FROM_WHY, DEF_UNV_FROM_WHY, &var_unv_from_why, 0, 0,
VAR_UNV_RCPT_WHY, DEF_UNV_RCPT_WHY, &var_unv_rcpt_why, 0, 0,
0,
diff -ur w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd_check.c
DABE__w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd_check.c
--- w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd_check.c Fri Jan
9 18:15:08 2009
+++ DABE__w-postfix-2.6.20090125/postfix-2.6-20090125/src/smtpd/smtpd_check.c
Thu Aug 13 00:59:29 2009
@@ -948,8 +948,8 @@
return (smtpd_check_reject(state, MAIL_ERROR_POLICY,
state->name_status >= SMTPD_PEER_CODE_PERM ?
var_unk_client_code : 450, "4.7.1",
- "Client host rejected: cannot find your hostname, [%s]",
- state->addr));
+ "Client host rejected: cannot find your hostname, [%s] %s",
+ state->addr, var_unk_client_why));
return (SMTPD_CHECK_DUNNO);
}
@@ -4754,6 +4754,7 @@
char *var_smtpd_sasl_opts;
char *var_local_rwr_clients;
char *var_smtpd_relay_ccerts;
+char *var_unk_client_why;
char *var_unv_from_why;
char *var_unv_rcpt_why;
char *var_stress;
@@ -4800,6 +4801,7 @@
VAR_SMTPD_SASL_OPTS, DEF_SMTPD_SASL_OPTS, &var_smtpd_sasl_opts,
VAR_LOC_RWR_CLIENTS, DEF_LOC_RWR_CLIENTS, &var_local_rwr_clients,
VAR_RELAY_CCERTS, DEF_RELAY_CCERTS, &var_smtpd_relay_ccerts,
+ VAR_UNK_CLIENT_WHY, DEF_UNK_CLIENT_WHY, &var_unk_client_why,
VAR_UNV_FROM_WHY, DEF_UNV_FROM_WHY, &var_unv_from_why,
VAR_UNV_RCPT_WHY, DEF_UNV_RCPT_WHY, &var_unv_rcpt_why,
VAR_STRESS, DEF_STRESS, &var_stress,