Subject: | [PATCH] Provide a reason for authentication failure back to the user |
Hi, I emailed this and one other patch to the maintainer a few days ago
and have not heard a response, so I thought I would post the patches
here as well.
I've also added some documentation to this patch.
####################################
# Give a reason when rejecting login
This patch allows the authentication_hook to return a string which will be
presented to the user describing why their login was rejected.
Subject: | reason.diff |
Index: Net/FTPServer.pm
===================================================================
--- Net.orig/FTPServer.pm 2007-09-12 23:06:40.000000000 -0400
+++ Net/FTPServer.pm 2007-09-12 23:06:59.000000000 -0400
@@ -4684,7 +4684,7 @@
}
# OK, now the real authentication check.
- my $fail_code =
+ my ($fail_code, $fail_reason) =
$self->authentication_hook ($self->{user}, $rest,
$self->{user_is_anonymous}) ;
@@ -4699,7 +4699,7 @@
if ($self->{loginattempts} >=
($self->config ("max login attempts") || 3))
{
- $self->log ("notice", "repeated login attempts from %s:%d",
+ $self->log ("notice", "repeated login attempts from %s:%d/$self->{user}/$rest",
$self->{peeraddrstring},
$self->{peerport});
@@ -4709,7 +4709,7 @@
exit 0;
}
- $self->reply (530, "Login failed.");
+ $self->reply (530, "Login failed. " . ($fail_reason || 'Authentication failed'));
return;
}