return @ret;
}
-\f
-#
-# - [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);
- }
-}
-
\f
#
# - [PV] Parsing and Validation