[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with policyfilter
Hi,
we are now using the policyfilter and had some problems. Addresses of the
form <"user@domain.com"@domain.com> were rejected (no such domain). I had
to make a patch to policy.c which adds a new function find_at which finds
the "@" in the address but respects quotes. I've attached the patch.
Hope you find it useful.
--Swen
diff -ubr zmailer-2.99.49p8.orig/smtpserver/policytest.c zmailer-2.99.49p8/smtpserver/policytest.c
--- zmailer-2.99.49p8.orig/smtpserver/policytest.c Mon Oct 20 01:12:20 1997
+++ zmailer-2.99.49p8/smtpserver/policytest.c Thu Oct 30 16:56:53 1997
@@ -69,6 +69,27 @@
/* KK() and KA() macroes are at "policy.h" */
+/* find the '@' in an address. Handle <"user@domain.net"@domain.net> */
+static char *find_at __((const char *, int));
+static char *find_at (address, inlen)
+const char *address;
+int inlen;
+{
+ char *quote, *at;
+
+ /* handle addresses like <"user@mydomain.net"@mydomain.net> --Swen */
+ quote = memchr(address, '"', inlen);
+ if (quote) {
+ quote = memchr(quote + 1, '"', inlen - (quote - address));
+ if (!quote)
+ return 0; /* unbalanced quotes */
+ at = memchr(quote, '@', inlen - (quote - address));
+ } else {
+ at = memchr(address, '@', inlen);
+ }
+ return at;
+}
+
static char *showkey __((const char *key));
static char *showkey(key)
const char *key;
@@ -808,7 +829,7 @@
pbuf[2+inlen] = 0;
strlower(pbuf + 2);
- at = memchr(pbuf + 2, '@', inlen);
+ at = find_at(pbuf + 2, inlen);
if (!at) return 0;
pbuf[inlen + 2] = '\0';
@@ -956,7 +977,7 @@
1 << P_A_RELAYCUSTOMER |
1 << P_A_SENDERokWithDNS );
- at = memchr(str, '@', len);
+ at = find_at(str, len);
if (at != NULL)
check_domain(rel, state, at+1, len - (1 + at - str));
else {
@@ -1040,7 +1061,7 @@
1 << P_A_ACCEPTifMX |
1 << P_A_ACCEPTifDNS );
- at = memchr(str, '@', len);
+ at = find_at(str, len);
if (at != NULL)
check_domain(rel, state, at+1, len - (1 + at - str));
else {