Skip to content

Commit

Permalink
Don't try to come up with the e-mail address of the user as
Browse files Browse the repository at this point in the history
the anonymous password.  Patch by Eduardo Pérez <eperez@dei.inf.uc3m.es>.
  • Loading branch information
gisle committed Dec 30, 2001
1 parent 3054984 commit 7f1e29d
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions URI/ftp.pm
Expand Up @@ -5,8 +5,6 @@ require URI::_userpass;
@ISA=qw(URI::_server URI::_userpass);

use strict;
use vars qw($whoami $fqdn);
use URI::Escape qw(uri_unescape);

sub default_port { 21 }

Expand All @@ -31,25 +29,14 @@ sub password
my $user = $self->user;
if ($user eq 'anonymous' || $user eq 'ftp') {
# anonymous ftp login password
unless (defined $fqdn) {
eval {
require Net::Domain;
$fqdn = Net::Domain::hostfqdn();
};
if ($@) {
$fqdn = '';
}
}
unless (defined $whoami) {
$whoami = $ENV{USER} || $ENV{LOGNAME} || $ENV{USERNAME};
unless ($whoami) {
if ($^O eq 'MSWin32') { $whoami = Win32::LoginName() }
else {
$whoami = getlogin || getpwuid($<) || 'unknown';
}
}
}
$pass = "$whoami\@$fqdn";
# If there is no ftp anonymous password specified
# then we'll just use 'anonymous@'
# We don't try to send the read e-mail address because:
# - We want to remain anonymous
# - We want to stop SPAM
# - We don't want to let ftp sites to discriminate by the user,
# host, country or ftp client being used.
$pass = 'anonymous@';
}
}
$pass;
Expand Down

0 comments on commit 7f1e29d

Please sign in to comment.