In case anyone else needs it, here is my "quick hack" that stops mail 
coming from facebook to a local user called  cem.duran:

In spamdyke.c:
1) Find the line that starts with
      filter_identical_from_to(current_settings, 
&current_settings->current_options->   (etc -- huge line)

2) copy and paste that line right under it, just change the function 
name to
      filter_facebook(.....)
so it looks like:
         filter_identical_from_to(current_settings, 
&current_settings->current_options->filter_action, 
&current_settings->current_opti....
         filter_facebook(current_settings, 
&current_settings->current_options->filter_action, 
&current_settings->current_options->filt.....
         filter_recipient_graylist(current_sett.....

3) in filter.c, add this function somewhere:

int filter_facebook(struct filter_settings *current_settings, int 
*target_action, int *return_action_locked, struct rejection_data 
**target_rejection, struct rejection_data *target_rejection_buf, char 
*target_message_buf, int size_target_message_buf)
   {
   int return_value;
   char tmp_sender_address[MAX_ADDRESS + 1];
   char tmp_recipient_address[MAX_ADDRESS + 1];
   int strlen_sender_address;
   int strlen_recipient_address;

   return_value = FILTER_DECISION_UNDECIDED;

   /* Check if the sender and recipient addresses are the same. */
   reassemble_address(current_settings->sender_username, 
current_settings->sender_domain, NULL, tmp_sender_address, MAX_ADDRESS, 
&strlen_sender_address);
   reassemble_address(current_settings->recipient_username, 
current_settings->recipient_domain, NULL, tmp_recipient_address, 
MAX_ADDRESS, &strlen_recipient_address);

   if (strstr(current_settings->sender_domain,"facebook") && 
strstr(current_settings->recipient_username,"cem.duran"))
   {
       *target_action = FILTER_DECISION_TRANSIENT_DO_FILTER;
       set_rejection(current_settings, REJECTION_IDENTICAL_FROM_TO, 
target_rejection, target_rejection_buf, target_message_buf, 
size_target_message_buf, NULL, NULL, NULL, 0);
       SPAMDYKE_LOG_VERBOSE(current_settings, 
LOG_VERBOSE_FILTER_IDENTICAL_FROM_TO, tmp_sender_address, 
tmp_recipient_address);
       return_value = FILTER_DECISION_TRANSIENT_DO_FILTER;
   }
   return(return_value);
}


4) done, make and copy resulting spamdyke to /usr/local/bin  (at least 
thats where mine is)

5) PS: Since this function is a copy of the same-sender-and-recipient 
function, in the logs you'll see DENIED_IDENTICAL_SENDER_RECIPIENT
in the logs. I said it was a quick hack :)

-turgut


On 01/08/2012 12:57 AM, turgut kalfaoglu wrote:
> Unfortunately my plesk-qmail does not seem to have that patch installed.
> It's a huge pain to recompile qmail with plesk's patches, plus the empf.. -t
>
> On 07.01.2012 18:02, Eric Shubert wrote:
>> On 01/07/2012 07:39 AM, turgut kalfaoğlu wrote:
>>> For some reason, we have massive amounts of mail coming from facebook,
>>> to one local user.
>>> I am unable to stop it, because the From is different every time, there
>>> are hundreds of users in the To: header,
>>> and the local recipient is always one local poor guy.
>>>
>>> I'm good at C programming and I'd like to put something like
>>>        if (strstr(sender,"facebook)&&    strstr(recipient,"localsucker"))
>>> rejectmail++;
>>> into spamdyke..
>>>
>>> I'd appreciate any *pointers where to place a such code and how it
>>> should read.
>>>
>>> Many thanks, -turgut
>> Do you have the eMPF patch (http://www.inter7.com/?page=empf-install)
>> applied to qmail? If you do, I believe that can be used to accomplish
>> such a rule (and more). FWIW.
>>
> _______________________________________________
> spamdyke-users mailing list
> spamdyke-users@spamdyke.org
> http://www.spamdyke.org/mailman/listinfo/spamdyke-users

_______________________________________________
spamdyke-users mailing list
spamdyke-users@spamdyke.org
http://www.spamdyke.org/mailman/listinfo/spamdyke-users

Reply via email to