From de02abca9899bdf36b16872888064f11efdbc08a Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Thu, 27 Oct 2022 00:02:46 -0500 Subject: [PATCH] Remove parse_directory_line and guess_uploader_email The former has been merged into interpret_directive, and the latter is no longer useful. Both are now removed. --- gatekeeper.pl | 57 --------------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index e289189..e0c95db 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1557,63 +1557,6 @@ sub gather_packets { return @ret; } - -# -# - [AN] Authentication -# - -sub parse_directory_line { - my $tainted_val = shift; - my $directive_file_contents = shift; - $tainted_val =~ s/\r\n/\n/g; # deal with dos-based line endings... - # Some people like to put spaces after their commands ... - $tainted_val =~ s/\s+$/\n/; - $tainted_val =~ s/^\s+//; # ... or even *before* their commands - - # $do_not_fail is set to 1 if this sub is called as a last resort in an - # attempt to find *someone* to report an error to. When it is set, this - # sub will not die with fatal. - my $do_not_fail = shift; - # Can't let it start with - . / or contain strange characters. - # This disallows .. as a file name component since no component - # can start with a . at all. - $tainted_val =~ m,^($RE_filename_relative)$, - or fatal("invalid directory $tainted_val\n$directive_file_contents", - 1,$directive_file_contents); - my $val = $1; # so far so good - - my @dirs = File::Spec::Unix->splitdir($1); - my $dir_depth = scalar @dirs; - - # A couple of subdir levels are ok, but don't allow hundreds. - fatal("$dir_depth levels is too deep, in $val",1,$directive_file_contents) - if ($dir_depth > MAX_DIRECTORY_DEPTH and not $do_not_fail); - - # Only let them specify one directory directive. - fatal("Only one directory directive is allowed per directive file. " - ."Error at directory directive: $val",1,$directive_file_contents) - if (exists $info{"directory"} and not $do_not_fail); - - - $info{"directory"} = $val; # ok. - $info{"package"} = $dirs[0]; # top-level name, no subdir - # Set email addresses - my @a = email_addresses($info{package}); - foreach my $address (@a) { - # Do not include duplicates - push (@{$info{email}}, $address) - unless (grep($_ eq $address,@{$info{email}}) > 0); - } -} - -sub guess_uploader_email { - my $directive_file_contents = shift; - if ($directive_file_contents =~ /^Directory:? (.*)$/im) { - # case-insensitive match above, with or without a colon - parse_directory_line($1, $directive_file_contents,1); - } -} - # # - [PV] Parsing and Validation -- 2.25.1