From c5669fbd88cdbfd72ba94be8e209c808a72c0f9c Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Fri, 29 Mar 2013 13:14:42 -0700 Subject: [PATCH] fix broken nullmailer quote handling --- sshsendmail | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sshsendmail b/sshsendmail index 081f0e3..047d9a8 100755 --- a/sshsendmail +++ b/sshsendmail @@ -82,6 +82,27 @@ my %options = (debug => 0, 'sendmail-options' => '', ); +# this is really janky, but because nullmailer doesn't properly handle +# quotes, we must do it for it. +my @fixed_argv; +my $concatenate_to_last; +my $p; +for my $opt (@ARGV) { + if ($concatenate_to_last) { + $fixed_argv[-1].=' '.$opt; + if (/$p/) { + $concatenate_to_last = 0; + } + next; + } + if (/(['"])(.+)/ && $2 !~ /$1/) { + $p = $1; + $concatenate_to_last = 1; + } + push @fixed_argv,$opt; +} +@ARGV=@fixed_argv; + GetOptions(\%options,'identity|i=s','username|l=s','daemon|d', 'syslog|s', 'sendmail-options|o=s', 'help|h|?','man|m'); -- 2.39.5