comparison src/context.cpp @ 211:4db1457cd11a stable-6-0-18

Extend auto-whitelisting when receiving mail even if the auto whitelist is specified in a parent context. Fixes for Solaris from sm-archive.
author Carl Byington <carl@five-ten-sg.com>
date Sat, 22 Mar 2008 11:19:36 -0700
parents 92a5c866bdfa
children 82886d4dd71f
comparison
equal deleted inserted replaced
210:cf2ecf5bacc9 211:4db1457cd11a
16 #include <sys/ioctl.h> 16 #include <sys/ioctl.h>
17 #include <sys/socket.h> 17 #include <sys/socket.h>
18 #include <sys/stat.h> 18 #include <sys/stat.h>
19 #include <sys/un.h> 19 #include <sys/un.h>
20 #include <unistd.h> 20 #include <unistd.h>
21
22 static char* context_version="$Id$";
23 21
24 char *token_autowhite; 22 char *token_autowhite;
25 char *token_black; 23 char *token_black;
26 char *token_cctld; 24 char *token_cctld;
27 char *token_content; 25 char *token_content;
806 return (i == rcpt_per_hour.end()) ? default_rcpt_rate : (*i).second; 804 return (i == rcpt_per_hour.end()) ? default_rcpt_rate : (*i).second;
807 } 805 }
808 806
809 807
810 char *CONTEXT::find_from(char *from, bool update_white) { 808 char *CONTEXT::find_from(char *from, bool update_white) {
811 if (whitelister && whitelister->is_white(from)) { 809 WHITELISTERP w = whitelister;
810 CONTEXTP p = parent;
811 while (!w && p) {
812 w = p->whitelister;
813 p = p->parent;
814 }
815 if (w && w->is_white(from)) {
812 if (update_white) { 816 if (update_white) {
813 // update senders timestamp to extend the whitelisting period 817 // update senders timestamp to extend the whitelisting period
814 if (debug_syslog > 1) { 818 if (debug_syslog > 1) {
815 char buf[maxlen]; 819 char buf[maxlen];
816 char msg[maxlen]; 820 char msg[maxlen];
817 snprintf(msg, sizeof(msg), "extend whitelist reply from <%s> in context %s", from, get_full_name(buf,maxlen)); 821 snprintf(msg, sizeof(msg), "extend whitelist reply from <%s> in context %s", from, get_full_name(buf,maxlen));
818 my_syslog(msg); 822 my_syslog(msg);
819 } 823 }
820 whitelister->sent(strdup(from)); 824 w->sent(strdup(from));
821 } 825 }
822 return token_white; 826 return token_white;
823 } 827 }
824 char *rc = env_from_default; 828 char *rc = env_from_default;
825 string_map::iterator i = env_from.find(from); 829 string_map::iterator i = env_from.find(from);