- Fixed compiler warnings related to using ctype macros on characters. pthread-branch
authorMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 24 Apr 2006 21:26:51 +0000 (21:26 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Mon, 24 Apr 2006 21:26:51 +0000 (21:26 +0000)
  An int cast was added.
- Servers for which MAIL FROM:<> is allowed can now bypass the mailbox filters.

mmsoftware/mmmail/src/mmsmtpd/mmsmtpd.c
mmsoftware/mmmail/src/mmsmtpd/mmsmtpd.h

index e7f17fc..7427548 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -83,7 +83,7 @@
 
 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 $");
 
 
 
@@ -744,13 +744,18 @@ all_mail(clientenv *clenv)
            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)
@@ -881,8 +886,11 @@ all_rcpt(clientenv *clenv)
 
     /* 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)
@@ -1563,7 +1571,7 @@ valid_host(clientenv *clenv, char *host, int res, bool addr, bool sanity)
         */
        ptr = host;
        while (*ptr != '\0') {
-           if (!isalnum(*ptr))
+           if (!isalnum((int)*ptr))
                return FALSE;
            /* Find next host part */
            while (*ptr != '\0' && *ptr != '.') ptr++;
@@ -1620,7 +1628,7 @@ valid_ipaddress(const char *addr)
            } else return (FALSE);
            if (*addr == '\0')
                break;
-       } else if (isdigit(*addr))
+       } else if (isdigit((int)*addr))
            *uptr++ = *addr;
        else
            return (FALSE);
@@ -1670,7 +1678,8 @@ validate_msg_line(char *line, ssize_t *len, int *res, void *udata)
         * 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;
index 2676f4c..5b352f8 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -154,6 +154,7 @@ typedef struct clientenv {
     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 */