#!/usr/bin/perl -w
# Version 2005-01-11
-#
+#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# This script will combine any pubring.gpg/oldring.gpg files found in the packages
-# directories into a global public keyring, which can then be used to verify all
+#
+# This script will combine any pubring.gpg/oldring.gpg files found in the packages
+# directories into a global public keyring, which can then be used to verify all
# packages on the ftp server.
#
# Written by Ward Vandewege (ward@gnu.org), 2005-01-11
# was expired / changed.
my $dummy2 = system("gpg --no-default-keyring --keyring $RING --import $EXPIRED_KEYRING >> /dev/null 2>&1");
-
-
#!/bin/bash
#
-# Adds a specified user & their key to the maintainer keyring on
+# Adds a specified user & their key to the maintainer keyring on
# ftp.gnu.org.
#
if ( ([ "$1" = "" ]) || ([ "$2" = "" ]) || ([ "$3" = "" ]) )
then
- echo "ftp-addkey.sh <project name> <maintainer email> <public key>"
- exit
+ echo "ftp-addkey.sh <project name> <maintainer email> <public key>"
+ exit
fi
if ! [ -d $PACKAGES/$1 ]
chmod -R 755 $PACKAGES/$1
echo "Done."
-
#!/bin/bash
f=/home/ftp/gnu/gnu-keyring.gpg
-for k in $( gpg --list-keys < $f | grep ^pub | grep -v expired | grep -v revoked | awk '{ print $2 }' | cut -d/ -f 2 )
+for k in $( gpg --list-keys < $f | grep ^pub | grep -v expired | grep -v revoked | awk '{ print $2 }' | cut -d/ -f 2 )
do
gpg --keyserver hkp://pgp.mit.edu --send-keys $k < $f
done
# make sure our directories all exist, or it's hopeless.
# Use die instead of fatal - this error should "never" happen.
for my $dir ($package_config_base, $incoming_dir, $incoming_tmp,
- $destfinal, $desttmp) {
+ $destfinal, $desttmp) {
-d $dir || ftp_die("FATAL: configuration problem, $dir is not a directory");
}
# the chdir simplifies our filename parsing, so the base names don't
my $retval = &read_directive_file ($files->{"directive"},$files->{"upload"},$files->{"directive_only"});
if ($retval == 0) {
- # do the work
- &execute_commands($files,%info);
-
- # report success
- if (!$files->{"directive_only"}) {
- &success_upload($files->{"sig"}, $files->{"upload"},$files->{"directive"});
- } else {
- &success_directive($files->{directive});
- }
+ # do the work
+ &execute_commands($files,%info);
+
+ # report success
+ if (!$files->{"directive_only"}) {
+ &success_upload($files->{"sig"}, $files->{"upload"},$files->{"directive"});
+ } else {
+ &success_directive($files->{directive});
+ }
}
};
ftp_warn ("eval failed: $@") if $@;
-
+
# clean up files if we abort while processing a triplet
cleanup ($files->{"sig"}, $files->{"upload"}, $files->{"directive"}) if ($@);
# clear out the current package that we just finished processing
my $target = $1;
# Get current working dir
my $cwd = getcwd;
- # Make sure there are no double dots in the path, and that it is absolute.
+ # Make sure there are no double dots in the path, and that it is absolute.
# A bit paranoid, but hey...
- &fatal("invalid directory $cwd",1,'')
- if (($cwd =~ /\.\./) || (!($cwd =~ m,^/,)));
+ &fatal("invalid directory $cwd",1,'')
+ if (($cwd =~ /\.\./) || (!($cwd =~ m,^/,)));
# Now untaint the getcwd output
$cwd =~ /^(.*)$/;
$cwd = $1;
chdir($destdir);
# if the symlink already exists, remove it
if (-l $info{$key}{link}) {
- unlink($info{$key}{link}) || &fatal("removal of symlink $info{$key}{link} failed: $!",1);
+ unlink($info{$key}{link}) || &fatal("removal of symlink $info{$key}{link} failed: $!",1);
}
# symlink away!
symlink("$target",$info{$key}{link}) || &fatal("creation of symlink $info{$key}{link} to $target in $destdir failed: $!",1);
# here, before even reading the directive file; otherwise, perl could
# consume lots of memory reading it.
if (exists($possible{$base}) && exists($possible{$sig}) && exists($possible{$directive})
- && (-s $directive < 50*1024) && (-s $sig < 50*1024)) {
+ && (-s $directive < 50*1024) && (-s $sig < 50*1024)) {
push (@ret, { "directive" => $directive, "sig" => $sig,
- "upload" => $base, "directive_only" => 0 });
+ "upload" => $base, "directive_only" => 0 });
ftp_syslog('info', "($log_style) processing [$directive:$sig:$base]");
# Do atomic rename to temp incoming directory before reading
# anything, for safety.
#
for my $f (($directive, $sig, $base)) {
- rename ($f, "$incoming_tmp/$f")
+ rename ($f, "$incoming_tmp/$f")
|| &fatal("rename $incoming_dir/$f to $incoming_tmp/$f failed: $!",0);
}
my $racecondition = 0;
open(TMP,$base);
while (<TMP>) {
- if (/^Filename:/i) {
- $racecondition = 1;
- last;
- }
+ if (/^Filename:/i) {
+ $racecondition = 1;
+ last;
+ }
}
close(TMP);
if ($racecondition) {
- # Most likely a race condition. We've found a directive file but not the accompanying file(s).
- # Just ignore this directive file for now.
- ftp_syslog('info',"($log_style) Found directive file with filename directive ($base), but no accompanying files. Ignoring directive file in this run.");
+ # Most likely a race condition. We've found a directive file but not the accompanying file(s).
+ # Just ignore this directive file for now.
+ ftp_syslog('info',"($log_style) Found directive file with filename directive ($base), but no accompanying files. Ignoring directive file in this run.");
} else {
- # Directive file only, no actual file to deal with
- # This can happen when dealing with symlink/rmsymlink/archive options
- push (@ret, { "directive" => $base, "sig" => '',
- "upload" => '', "directive_only" => 1 });
- # Do atomic rename to temp incoming directory before reading
- # anything, for safety.
- rename ($base, "$incoming_tmp/$base")
- || &fatal("rename $incoming_dir/$base to $incoming_tmp/$base failed: $!",0);
+ # Directive file only, no actual file to deal with
+ # This can happen when dealing with symlink/rmsymlink/archive options
+ push (@ret, { "directive" => $base, "sig" => '',
+ "upload" => '', "directive_only" => 1 });
+ # Do atomic rename to temp incoming directory before reading
+ # anything, for safety.
+ rename ($base, "$incoming_tmp/$base")
+ || &fatal("rename $incoming_dir/$base to $incoming_tmp/$base failed: $!",0);
}
delete $possible{$base};
} elsif ((-f $directive) && ((-s $directive) >= 50*1024)) {
# The while loop below needs a proper scalar to work.
my $e = $tmp[1];
while ($e =~ /([[:graph:]]+@[[:graph:]]+)/g) {
- my $f = $1;
- $f =~ s/[<>,]//g;
+ my $f = $1;
+ $f =~ s/[<>,]//g;
push (@ret, $f) unless exists {map { $_ => 1 } @ret}->{$f};
}
}
# Only let them specify one filename directive.
&fatal("Only one filename directive is allowed per directive file. Error at filename directive: $val.",1,$directive_file_contents)
- if exists $info{"filename"};
+ if exists $info{"filename"};
$info{"filename"} = {"value" => $val, "order" => $cnt++}; # ok.
} elsif ($tainted_cmd =~ /^Version:?$/i) { # case-insensitive, w or w/o the :
# We have three files
# Are we in version 1.0 compatibility mode?
if ($V1_COMPAT_ALLOWED) {
- # We're in backwards compatibility mode
- # That means: three files, and ONLY a directory directive in the directive file
- $info{'v1_compat_mode'} = 1;
- if ($directory_command_only == 0) {
- &fatal("no filename directive specified in $directive_file",1)
- } else {
- ftp_syslog('info',"($log_style) running in legacy V1 compatibility mode");
- }
+ # We're in backwards compatibility mode
+ # That means: three files, and ONLY a directory directive in the directive file
+ $info{'v1_compat_mode'} = 1;
+ if ($directory_command_only == 0) {
+ &fatal("no filename directive specified in $directive_file",1)
+ } else {
+ ftp_syslog('info',"($log_style) running in legacy V1 compatibility mode");
+ }
} elsif (!$V1_COMPAT_ALLOWED) {
- # This is not allowed - we require a filename directive. No backwards compatibility.
- &fatal("no filename directive specified in $directive_file. Upgrade to the latest version! See http://www.gnu.org/prep/maintain/maintain.html",1)
+ # This is not allowed - we require a filename directive. No backwards compatibility.
+ &fatal("no filename directive specified in $directive_file. Upgrade to the latest version! See http://www.gnu.org/prep/maintain/maintain.html",1)
}
} else {
# We only have a directive file
flock(SERIALS,2); # Take exclusive lock
@serials = <SERIALS>;
foreach (@serials) {
- my ($tmp1,$tmp2) = /(.*?):(.*?)\n/;
- $tmp1 =~ s/\s+//g;
- $tmp2 =~ s/\s+//g;
- $serials{$tmp1} = $tmp2;
+ my ($tmp1,$tmp2) = /(.*?):(.*?)\n/;
+ $tmp1 =~ s/\s+//g;
+ $tmp2 =~ s/\s+//g;
+ $serials{$tmp1} = $tmp2;
}
}
seek(SERIALS,0,0);
# Hence the silly trick with storing the return code of gpgv in
# the command output
my @verify_args = ("/usr/bin/gpgv", "--keyring", $_,
- $directive_file,"2>&1",";echo \$?");
+ $directive_file,"2>&1",";echo \$?");
my $verify_str = join(' ',@verify_args);
foreach my $keyring (@keyrings) {
# Verify that the file has been correctly signed with a valid signature.
my @verify_args = ("/usr/bin/gpgv", "--keyring", $keyring,
- $sig_file, $upload_file);
+ $sig_file, $upload_file);
if (!system (@verify_args)) {
$valid = 1;
last;
my $found_makefile = 0;
while (defined (my $line = <TAR>)) {
if ($line =~ /Makefile.in/i) {
- $found_makefile = 1;
- last;
+ $found_makefile = 1;
+ last;
}
}
close(TAR); # We don't care about errors here; the pipe can cause non-zero exit codes when tar is unhappy that it's asked to stop
my $error_string = '';
while (defined (my $line = <TAR>)) {
if ($line =~ /perm -777 -exec chmod a\+rwx|chmod 777 \$\(distdir\)/) {
- $found_cve_2009_4029 = 1;
+ $found_cve_2009_4029 = 1;
}
if ($line =~ /chmod a\+w \$\(distdir\)/) {
- $found_cve_2012_3386 = 1;
+ $found_cve_2012_3386 = 1;
}
}
close(TAR); # We don't care about errors here; the pipe can cause non-zero exit codes when tar is unhappy that it's asked to stop
my $mtime = $tmp[9];
$mtime =~ /^(.*)$/; $mtime = $1;
ftp_syslog('debug',"($log_style) DEBUG: Removing $file, older than 24 hours (mtime: $tmp[9])\n") if ((time() > ($tmp[9]+24*3600)) && ($DEBUG > 0));
- unlink ("$dir/.$file"); # don't worry if it doesn't exist
- rename ("$dir/$file", "$dir/.$file") if (time() > ($mtime+24*3600));
+ unlink ("$dir/.$file"); # don't worry if it doesn't exist
+ rename ("$dir/$file", "$dir/.$file") if (time() > ($mtime+24*3600));
}
}
my @blacklist = ();
my @tomail = @emaillist;
if (-f $email_blacklist) {
- open(BLACKLIST, "<$email_blacklist");
- @blacklist = <BLACKLIST>;
- close(BLACKLIST);
- chomp(@blacklist);
-
- my %blacklist = map{$_ => 1 } @blacklist;
- my %emaillist = map{$_ => 1 } @emaillist;
-
- @tomail = grep(!defined $blacklist{$_}, @emaillist);
+ open(BLACKLIST, "<$email_blacklist");
+ @blacklist = <BLACKLIST>;
+ close(BLACKLIST);
+ chomp(@blacklist);
+
+ my %blacklist = map{$_ => 1 } @blacklist;
+ my %emaillist = map{$_ => 1 } @emaillist;
+
+ @tomail = grep(!defined $blacklist{$_}, @emaillist);
}
return @tomail;
if ($NOMAIL) {
if ($subject ne '') {
- ftp_syslog('info', "($log_style) Subject: '$subject'");
+ ftp_syslog('info', "($log_style) Subject: '$subject'");
} elsif (defined $info{package}) {
- ftp_syslog('info', "($log_style) Subject: $info{package}");
+ ftp_syslog('info', "($log_style) Subject: $info{package}");
} else {
- ftp_syslog('warning', "($log_style) Error uploading package: $msg");
- ftp_syslog('info', "($log_style) Subject: generic failure");
+ ftp_syslog('warning', "($log_style) Error uploading package: $msg");
+ ftp_syslog('info', "($log_style) Subject: generic failure");
}
ftp_syslog('info', "($log_style) Body: $msg");
} else {
$smtp->datasend("Message-ID: <$mid>\r\n");
$smtp->datasend("Date: " . strftime("%a, %e %b %Y %H:%M:%S %z", localtime) . "\r\n");
if ($subject ne '') {
- $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $subject");
- ftp_syslog('info', "($log_style) Subject: '$subject'");
+ $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $subject");
+ ftp_syslog('info', "($log_style) Subject: '$subject'");
} elsif (defined $info{package}) {
- $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $info{package}");
- ftp_syslog('info', "($log_style) Subject: $info{package}");
+ $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $info{package}");
+ ftp_syslog('info', "($log_style) Subject: $info{package}");
} else {
- $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] generic failure");
- ftp_syslog('warning', "($log_style) Error uploading package: $msg");
- ftp_syslog('info', "($log_style) Subject: generic failure");
+ $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] generic failure");
+ ftp_syslog('warning', "($log_style) Error uploading package: $msg");
+ ftp_syslog('info', "($log_style) Subject: generic failure");
}
$smtp->datasend ("\n\n");
ftp_syslog('info', "($log_style) Body: $msg");
# make sure our directories all exist, or it's hopeless.
# Use die instead of fatal - this error should "never" happen.
for my $dir ($package_config_base, $incoming_dir, $incoming_tmp,
- $destfinal, $desttmp) {
+ $destfinal, $desttmp) {
-d $dir || ftp_die("FATAL: configuration problem, $dir is not a directory");
}
# the chdir simplifies our filename parsing, so the base names don't
my $retval = &read_directive_file ($files->{"directive"},$files->{"upload"},$files->{"directive_only"});
if ($retval == 0) {
- # do the work
- &execute_commands($files,%info);
-
- # report success
- if (!$files->{"directive_only"}) {
- &success_upload($files->{"sig"}, $files->{"upload"},$files->{"directive"});
- } else {
- &success_directive($files->{directive});
- }
+ # do the work
+ &execute_commands($files,%info);
+
+ # report success
+ if (!$files->{"directive_only"}) {
+ &success_upload($files->{"sig"}, $files->{"upload"},$files->{"directive"});
+ } else {
+ &success_directive($files->{directive});
+ }
}
};
ftp_warn ("eval failed: $@") if $@;
-
+
# clean up files if we abort while processing a triplet
cleanup ($files->{"sig"}, $files->{"upload"}, $files->{"directive"}) if ($@);
# clear out the current package that we just finished processing
my $target = $1;
# Get current working dir
my $cwd = getcwd;
- # Make sure there are no double dots in the path, and that it is absolute.
+ # Make sure there are no double dots in the path, and that it is absolute.
# A bit paranoid, but hey...
- &fatal("invalid directory $cwd",1,'')
- if (($cwd =~ /\.\./) || (!($cwd =~ m,^/,)));
+ &fatal("invalid directory $cwd",1,'')
+ if (($cwd =~ /\.\./) || (!($cwd =~ m,^/,)));
# Now untaint the getcwd output
$cwd =~ /^(.*)$/;
$cwd = $1;
chdir($destdir);
# if the symlink already exists, remove it
if (-l $info{$key}{link}) {
- unlink($info{$key}{link}) || &fatal("removal of symlink $info{$key}{link} failed: $!",1);
+ unlink($info{$key}{link}) || &fatal("removal of symlink $info{$key}{link} failed: $!",1);
}
# symlink away!
symlink("$target",$info{$key}{link}) || &fatal("creation of symlink $info{$key}{link} to $target in $destdir failed: $!",1);
# being uploaded.
if ($TSTAMPCHECK) {
for my $ent (keys %possible) {
- my @stat = stat($ent);
- if ($stat[9] >= time - 120) {
- ftp_syslog('debug', "($log_style) DEBUG: " . "$ent has been modified in the last 2 minutes, skipping") if $DEBUG;
- delete ($possible{$ent});
- next;
- }
- }
+ my @stat = stat($ent);
+ if ($stat[9] >= time - 120) {
+ ftp_syslog('debug', "($log_style) DEBUG: " . "$ent has been modified in the last 2 minutes, skipping") if $DEBUG;
+ delete ($possible{$ent});
+ next;
+ }
+ }
}
# For each remaining possibility, do some more checks
# here, before even reading the directive file; otherwise, perl could
# consume lots of memory reading it.
if (exists($possible{$base}) && exists($possible{$sig}) && exists($possible{$directive})
- && (-s "$incoming_dir/$directive" < 50*1024) && (-s "$incoming_dir/$sig" < 50*1024)) {
+ && (-s "$incoming_dir/$directive" < 50*1024) && (-s "$incoming_dir/$sig" < 50*1024)) {
push (@ret, { "directive" => $directive, "sig" => $sig,
- "upload" => $base, "directive_only" => 0 });
+ "upload" => $base, "directive_only" => 0 });
ftp_syslog('info', "($log_style) processing [$directive:$sig:$base]");
# Do atomic rename to temp incoming directory before reading
# anything, for safety.
#
for my $f (($directive, $sig, $base)) {
- rename ($f, "$incoming_tmp/$f")
+ rename ($f, "$incoming_tmp/$f")
|| &fatal("rename $incoming_dir/$f to $incoming_tmp/$f failed: $!",0);
}
my $racecondition = 0;
open(TMP,$base);
while (<TMP>) {
- if (/^Filename:/i) {
- $racecondition = 1;
- last;
- }
+ if (/^Filename:/i) {
+ $racecondition = 1;
+ last;
+ }
}
close(TMP);
if ($racecondition) {
- # Most likely a race condition. We've found a directive file but not the accompanying file(s).
- # Just ignore this directive file for now.
- ftp_syslog('info',"($log_style) Found directive file with filename directive ($base), but no accompanying files. Ignoring directive file in this run.");
+ # Most likely a race condition. We've found a directive file but not the accompanying file(s).
+ # Just ignore this directive file for now.
+ ftp_syslog('info',"($log_style) Found directive file with filename directive ($base), but no accompanying files. Ignoring directive file in this run.");
} else {
- # Directive file only, no actual file to deal with
- # This can happen when dealing with symlink/rmsymlink/archive options
- push (@ret, { "directive" => $base, "sig" => '',
- "upload" => '', "directive_only" => 1 });
- # Do atomic rename to temp incoming directory before reading
- # anything, for safety.
- rename ($base, "$incoming_tmp/$base")
- || &fatal("rename $incoming_dir/$base to $incoming_tmp/$base failed: $!",0);
+ # Directive file only, no actual file to deal with
+ # This can happen when dealing with symlink/rmsymlink/archive options
+ push (@ret, { "directive" => $base, "sig" => '',
+ "upload" => '', "directive_only" => 1 });
+ # Do atomic rename to temp incoming directory before reading
+ # anything, for safety.
+ rename ($base, "$incoming_tmp/$base")
+ || &fatal("rename $incoming_dir/$base to $incoming_tmp/$base failed: $!",0);
}
delete $possible{$base};
} elsif ((-f $directive) && ((-s $directive) >= 50*1024)) {
# The while loop below needs a proper scalar to work.
my $e = $tmp[1];
while ($e =~ /([[:graph:]]+@[[:graph:]]+)/g) {
- my $f = $1;
- $f =~ s/[<>,]//g;
+ my $f = $1;
+ $f =~ s/[<>,]//g;
push (@ret, $f) unless exists {map { $_ => 1 } @ret}->{$f};
}
}
# Only let them specify one filename directive.
&fatal("Only one filename directive is allowed per directive file. Error at filename directive: $val.",1,$directive_file_contents)
- if exists $info{"filename"};
+ if exists $info{"filename"};
$info{"filename"} = {"value" => $val, "order" => $cnt++}; # ok.
} elsif ($tainted_cmd =~ /^Version:?$/i) { # case-insensitive, w or w/o the :
# We have three files
# Are we in version 1.0 compatibility mode?
if ($V1_COMPAT_ALLOWED) {
- # We're in backwards compatibility mode
- # That means: three files, and ONLY a directory directive in the directive file
- $info{'v1_compat_mode'} = 1;
- if ($directory_command_only == 0) {
- &fatal("no filename directive specified in $directive_file",1)
- } else {
- ftp_syslog('info',"($log_style) running in legacy v1 compatibility mode");
- }
+ # We're in backwards compatibility mode
+ # That means: three files, and ONLY a directory directive in the directive file
+ $info{'v1_compat_mode'} = 1;
+ if ($directory_command_only == 0) {
+ &fatal("no filename directive specified in $directive_file",1)
+ } else {
+ ftp_syslog('info',"($log_style) running in legacy v1 compatibility mode");
+ }
} elsif (!$V1_COMPAT_ALLOWED) {
- # This is not allowed - we require a filename directive. No backwards compatibility.
- &fatal("no filename directive specified in $directive_file. Upgrade to the latest version! See http://www.gnu.org/prep/maintain/maintain.html",1)
+ # This is not allowed - we require a filename directive. No backwards compatibility.
+ &fatal("no filename directive specified in $directive_file. Upgrade to the latest version! See http://www.gnu.org/prep/maintain/maintain.html",1)
}
} else {
# We only have a directive file
flock(SERIALS,2); # Take exclusive lock
@serials = <SERIALS>;
foreach (@serials) {
- my ($tmp1,$tmp2) = /(.*?):(.*?)\n/;
- $tmp1 =~ s/\s+//g;
- $tmp2 =~ s/\s+//g;
- $serials{$tmp1} = $tmp2;
+ my ($tmp1,$tmp2) = /(.*?):(.*?)\n/;
+ $tmp1 =~ s/\s+//g;
+ $tmp2 =~ s/\s+//g;
+ $serials{$tmp1} = $tmp2;
}
}
seek(SERIALS,0,0);
# Hence the silly trick with storing the return code of gpgv in
# the command output
my @verify_args = ("/usr/bin/gpgv", "--keyring", $_,
- $directive_file,"2>&1",";echo \$?");
+ $directive_file,"2>&1",";echo \$?");
my $verify_str = join(' ',@verify_args);
foreach my $keyring (@keyrings) {
# Verify that the file has been correctly signed with a valid signature.
my @verify_args = ("/usr/bin/gpgv", "--keyring", $keyring,
- $sig_file, $upload_file);
+ $sig_file, $upload_file);
if (!system (@verify_args)) {
$valid = 1;
last;
my $mtime = $tmp[9];
$mtime =~ /^(.*)$/; $mtime = $1;
ftp_syslog('debug',"($log_style) DEBUG: Removing $file, older than 24 hours (mtime: $tmp[9])\n") if ((time() > ($tmp[9]+24*3600)) && ($DEBUG > 0));
- unlink ("$dir/.$file"); # don't worry if it doesn't exist
- rename ("$dir/$file", "$dir/.$file") if (time() > ($mtime+24*3600));
+ unlink ("$dir/.$file"); # don't worry if it doesn't exist
+ rename ("$dir/$file", "$dir/.$file") if (time() > ($mtime+24*3600));
}
}
my @blacklist = ();
my @tomail = @emaillist;
if (-f $email_blacklist) {
- open(BLACKLIST, "<$email_blacklist");
- @blacklist = <BLACKLIST>;
- close(BLACKLIST);
- chomp(@blacklist);
-
- my %blacklist = map{$_ => 1 } @blacklist;
- my %emaillist = map{$_ => 1 } @emaillist;
-
- @tomail = grep(!defined $blacklist{$_}, @emaillist);
+ open(BLACKLIST, "<$email_blacklist");
+ @blacklist = <BLACKLIST>;
+ close(BLACKLIST);
+ chomp(@blacklist);
+
+ my %blacklist = map{$_ => 1 } @blacklist;
+ my %emaillist = map{$_ => 1 } @emaillist;
+
+ @tomail = grep(!defined $blacklist{$_}, @emaillist);
}
return @tomail;
if ($NOMAIL) {
if ($subject ne '') {
- ftp_syslog('info', "($log_style) Subject: '$subject'");
+ ftp_syslog('info', "($log_style) Subject: '$subject'");
} elsif (defined $info{package}) {
- ftp_syslog('info', "($log_style) Subject: $info{package}");
+ ftp_syslog('info', "($log_style) Subject: $info{package}");
} else {
- ftp_syslog('warning', "($log_style) Error uploading package: $msg");
- ftp_syslog('info', "($log_style) Subject: generic failure");
+ ftp_syslog('warning', "($log_style) Error uploading package: $msg");
+ ftp_syslog('info', "($log_style) Subject: generic failure");
}
ftp_syslog('info', "($log_style) Body: $msg");
} else {
$smtp->datasend("Message-ID: <$mid>\r\n");
$smtp->datasend("Date: " . strftime("%a, %e %b %Y %H:%M:%S %z", localtime) . "\r\n");
if ($subject ne '') {
- $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $subject");
- ftp_syslog('info', "($log_style) Subject: '$subject'");
+ $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $subject");
+ ftp_syslog('info', "($log_style) Subject: '$subject'");
} elsif (defined $info{package}) {
- $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $info{package}");
- ftp_syslog('info', "($log_style) Subject: $info{package}");
+ $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] $info{package}");
+ ftp_syslog('info', "($log_style) Subject: $info{package}");
} else {
- $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] generic failure");
- ftp_syslog('warning', "($log_style) Error uploading package: $msg");
- ftp_syslog('info', "($log_style) Subject: generic failure");
+ $smtp->datasend ("Subject: [$m_style gnu-ftp-upload] generic failure");
+ ftp_syslog('warning', "($log_style) Error uploading package: $msg");
+ ftp_syslog('info', "($log_style) Subject: generic failure");
}
$smtp->datasend ("\n\n");
ftp_syslog('info', "($log_style) Body: $msg");