Skip to Content.
Sympa Menu

en - patching sympa 3.2.* to disable command parsing in subject/body

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Tom Bailly-Salins <address@concealed>
  • To: address@concealed
  • Subject: patching sympa 3.2.* to disable command parsing in subject/body
  • Date: Thu, 07 Jun 2001 11:36:17 -0400

Hi if anyone is interested

here are 3 files that summarize the changes I did to add options in
sympa.conf
that allow the turning on and off of the command parsing feature that
sympa uses
to scan for commands in the subject and the body of messages

I made thoses changes because users complained that they often had
rejected messages
because of commands found in the subject or body of their messages

TOM


26c26
< antivirus_path antivirus_args
---
> antivirus_path antivirus_args check_for_commands
> max_nb_lines
90a91,92
> 'check_for_commands' => 1,
> 'max_nb_lines' => 15,
168c170
< $Conf{$i} = $o{$i}[0] || $Default_Conf{$i};
---
> $Conf{$i} = defined($o{$i}[0]) ? $o{$i}[0] : $Default_Conf{$i};

//----------------------- Add these 2 variables to SYMPA.CONF
----------------------

## Variable used to enable/desable the command parsing feature in the subject
## and body of messages, to enable that feature set check_for_commands to 1
check_for_commands 0

## Variable used to set the minimum length of the message body above which
## the parsing of commands in the body will not be activated default is 15
max_nb_lines 10


//---------------------------------- ORIGINAL
-----------------------------------------------------------------


sub checkcommand {
my($msg, $sender) = @_;
do_log('debug2', 'tools::checkcommand(msg->head->get(subject):
%s,%s)',$msg->head->get('Subject'), $sender);

my($avoid, $i);

my $hdr = $msg->head;

## Check for commands in the subject.
my $subject = $msg->head->get('Subject');
if ($subject) {
foreach $avoid (@avoid_hdr) {
if ($subject =~ /^\s*(quiet)?($avoid)(\s+|$)/im) {
&rejectMessage($msg, $sender);
return 1;
}
}
}

return 0 if ($#{$msg->body} >= 15); ## More than 15 lines in the text.

foreach $i (@{$msg->body}) {
foreach $avoid (@avoid_hdr) {
if ($i =~ /^\s*(quiet)?($avoid)(\s+|$)/im) { ## Suspicious line
&rejectMessage($msg, $sender);
return 1;
}
}
## Control is only applied to first non-blank line
last unless $i =~ /^\s*$/;

}
return 0;
}

//--------------------------------------------------------------------------------------------------------------



//------------------------------------- CHANGED
----------------------------------------------------------------



sub checkcommand {
my($msg, $sender) = @_;
do_log('debug2', 'tools::checkcommand(msg->head->get(subject):
%s,%s)',$msg->head->get('Subject'), $sender);

my($avoid, $i);

my $hdr = $msg->head;

if ($Conf{'check_for_commands'}) {
## Check for commands in the subject.
my $subject = $msg->head->get('Subject');
if ($subject) {
foreach $avoid (@avoid_hdr) {
if ($subject =~ /^\s*(quiet)?($avoid)(\s+|$)/im) {
&rejectMessage($msg, $sender);
return 1;
}
}
}
}

return 0 if ($#{$msg->body} >= $Conf{'max_nb_lines'}); ## More than
max_nb_lines lines in the text.

if ($Conf{'check_for_commands'}) {
foreach $i (@{$msg->body}) {
foreach $avoid (@avoid_hdr) {
if ($i =~ /^\s*(quiet)?($avoid)(\s+|$)/im) { ## Suspicious line
&rejectMessage($msg, $sender);
return 1;
}
}
## Control is only applied to first non-blank line
last unless $i =~ /^\s*$/;

}
}
return 0;
}

//--------------------------------------------------------------------------------------------------------------






  • patching sympa 3.2.* to disable command parsing in subject/body, Tom Bailly-Salins, 06/07/2001

Archive powered by MHonArc 2.6.19+.

Top of Page