From 1c56dffeb54429c82d3cf6ba48243bc13834ce2b Mon Sep 17 00:00:00 2001 From: lars Date: Sat, 6 May 2006 04:17:09 +0000 Subject: [PATCH] wrong option parsing for "make" fixed --- Ezmlm/trunk/Ezmlm.pm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Ezmlm/trunk/Ezmlm.pm b/Ezmlm/trunk/Ezmlm.pm index 24c3d64..4da764f 100644 --- a/Ezmlm/trunk/Ezmlm.pm +++ b/Ezmlm/trunk/Ezmlm.pm @@ -91,10 +91,16 @@ sub make { my $commandline = ''; $commandline = '-' . $list{'-switches'} if(defined($list{'-switches'})); my @commandline; - # UGLY! - foreach (split(/["'](.+?)["']|(\s-\w+)/, $commandline)) { - next if (!defined($_) or !$_ or $_ eq ' '); - push @commandline, $_; + foreach ("ewords('\s+', 1, $commandline)) { + next if (!defined($_)); + # untaint input + $_ =~ s/['"]//g; + $_ =~ m/^([\w _\/,\.\@:'"-]*)$/; + if ($_ =~ /^\s*$/) { + push @commandline, ""; + } else { + push @commandline, $1; + } } # These three variables are essential @@ -148,19 +154,12 @@ sub update { $switches = '-e' . $switches; my @switch_list; - # UGLY! - #foreach (split(/["'](.+?)["']|(-\w+)/, $switches)) { - # next if (!defined($_)); - # # untaint input - # $_ =~ m/^([\w _\/,\.\@:'"-]*)$/; - # push @switches, $1; - #} foreach ("ewords('\s+', 1, $switches)) { next if (!defined($_)); # untaint input $_ =~ s/['"]//g; $_ =~ m/^([\w _\/,\.\@:'"-]*)$/; - if ($_ eq '') { + if ($_ =~ /^\s*$/) { push @switch_list, ""; } else { push @switch_list, $1;