[Mimedefang] Adding filter_helo support
Philip Prindeville
philipp_subx at redfish-solutions.com
Tue Jan 17 15:45:43 EST 2006
Jan Pieter Cornet wrote:
>Also, your code assumes you cannot call smfi_setreply in the helo()
>callback, but that assumption is wrong. At least, it is according to
>the milter API documentation. It's probably very useful to set a reply
>after HELO!
>
Ok, here are part of the revised diffs to mimedefang.c:
*** 556,561 ****
--- 559,595 ----
data->heloArg = NULL;
}
data->heloArg = strdup_with_log(helohost);
+
+ if (doHeloCheck) {
+ char buf2[SMALLBUF];
+ int n = MXHeloOK(MultiplexorSocketName, buf2, data->hostip,
+ data->hostname, data->heloArg);
+ if (n == 0) {
+ set_dsn(ctx, buf2, 5);
+ /* We reject connections from this relay */
+ cleanup(ctx);
+ DEBUG_EXIT("helo", __LINE__, "SMFIS_REJECT");
+ return SMFIS_REJECT;
+ }
+ if (n < 0) {
+ set_dsn(ctx, buf2, 4);
+ cleanup(ctx);
+ DEBUG_EXIT("helo", __LINE__, "SMFIS_TEMPFAIL");
+ return SMFIS_TEMPFAIL;
+ }
+ if (n == 2) {
+ set_dsn(ctx, buf2, 2);
+ cleanup(ctx);
+ return SMFIS_ACCEPT;
+ }
+ if (n == 3) {
+ set_dsn(ctx, buf2, 2);
+ cleanup(ctx);
+ return SMFIS_DISCARD;
+ }
+ }
+
+ DEBUG_EXIT("helo", __LINE__, "SMFIS_CONTINUE");
return SMFIS_CONTINUE;
}
I'm wondering, however, if this is the correct handling... What about "n
== 1"?
Suggestion for the future... perhaps have an enum for these values
that's a little more intuitive.
-Philip
More information about the MIMEDefang
mailing list