-/* $Id: mmsmtpd.c,v 1.74.2.3 2005/11/24 09:01:36 mmondor Exp $ */
+/* $Id: mmsmtpd.c,v 1.74.2.4 2006/04/24 21:26:51 mmondor Exp $ */
/*
* Copyright (C) 2001-2004, Matthew Mondor
MMCOPYRIGHT("@(#) Copyright (c) 2001-2004\n\
\tMatthew Mondor. All rights reserved.\n");
-MMRCSID("$Id: mmsmtpd.c,v 1.74.2.3 2005/11/24 09:01:36 mmondor Exp $");
+MMRCSID("$Id: mmsmtpd.c,v 1.74.2.4 2006/04/24 21:26:51 mmondor Exp $");
if ((mm_strncasecmp(" FROM:<>", &clenv->buffer[4], 8)) == 0) {
/* Some systems use empty MAIL FROM like this, make sure
* that IP address or hostname is allowed to do this.
+ * If so, we also want to make sure not to perform any type
+ * of envelope based filtering for this post.
*/
valid = check_nofrom(clenv->c_ipaddr, clenv->c_hostname);
if (valid)
*addr = '\0';
- } else
+ clenv->nofrom = TRUE;
+ } else {
valid = valid_address(clenv, addr, 128, clenv->buffer,
(CONF.RESOLVE_MX_MAIL) ? HOST_RES_MX : HOST_NORES);
+ clenv->nofrom = FALSE;
+ }
if (valid) {
if ((clenv->from = (char *)mmstrdup(addr)) != NULL)
/* These only apply to local addresses */
if (!relay) {
- /* Ensure to observe allow filters if any set for box */
- if (boxinfo.filter) {
+ /*
+ * Ensure to observe allow filters if any set for box, except for mail
+ * with an empty FROM address from allowed servers
+ */
+ if (boxinfo.filter && !clenv->nofrom) {
if (!box_filter_allow(addr, clenv->from, boxinfo.filter_type)) {
reason = RCPT_FILTER;
if (CONF.STATFAIL_FILTER)
*/
ptr = host;
while (*ptr != '\0') {
- if (!isalnum(*ptr))
+ if (!isalnum((int)*ptr))
return FALSE;
/* Find next host part */
while (*ptr != '\0' && *ptr != '.') ptr++;
} else return (FALSE);
if (*addr == '\0')
break;
- } else if (isdigit(*addr))
+ } else if (isdigit((int)*addr))
*uptr++ = *addr;
else
return (FALSE);
* spaces/tabs.
*/
if (*line != '\t' && *line != ' ') {
- for (ptr = line; *ptr != '\0' && (isalnum(*ptr) || *ptr == '-');
+ for (ptr = line; *ptr != '\0' && (isalnum((int)*ptr) ||
+ *ptr == '-');
ptr++) ;
if (*ptr != ':')
goto endheader;
-/* $Id: mmsmtpd.h,v 1.33.2.3 2005/11/24 09:08:51 mmondor Exp $ */
+/* $Id: mmsmtpd.h,v 1.33.2.4 2006/04/24 21:26:51 mmondor Exp $ */
/*
* Copyright (C) 2001-2004, Matthew Mondor
long mesg_size; /* Current cached message size in bytes */
long errors; /* Total number of errors that occured */
int timeout; /* Timeout in ms */
+ bool nofrom; /* If empty MAIL FROM from allowed server */
unsigned long id; /* Our connection ID */
unsigned long messages; /* Messages user sent us */
unsigned long rcpts; /* Number of RCPT accepted */