diff options
author | 2012-05-08 14:19:12 +0800 | |
---|---|---|
committer | 2012-05-08 14:19:12 +0800 | |
commit | 08095abadba2df76318e2fadcae442e21e1f2a1c (patch) | |
tree | cb95c18360f05ff520411fb6083d129f3d44e2ab /Bugzilla/Auth.pm | |
parent | Bug 663747: Add an option to disable 'New: ' prefix on bugmail (diff) | |
download | bugzilla-08095abadba2df76318e2fadcae442e21e1f2a1c.tar.gz bugzilla-08095abadba2df76318e2fadcae442e21e1f2a1c.tar.bz2 bugzilla-08095abadba2df76318e2fadcae442e21e1f2a1c.zip |
Bug 729001: Reverse resolves the IP address in account lockout notifications
r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Auth.pm')
-rw-r--r-- | Bugzilla/Auth.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm index 93ee45b54..477dbffaa 100644 --- a/Bugzilla/Auth.pm +++ b/Bugzilla/Auth.pm @@ -22,6 +22,7 @@ use Bugzilla::User::Setting (); use Bugzilla::Auth::Login::Stack; use Bugzilla::Auth::Verify::Stack; use Bugzilla::Auth::Persist::Cookie; +use Socket; sub new { my ($class, $params) = @_; @@ -199,10 +200,18 @@ sub _handle_login_result { my $default_settings = Bugzilla::User::Setting::get_defaults(); my $template = Bugzilla->template_inner( $default_settings->{lang}->{default_value}); + my $address = $attempts->[0]->{ip_addr}; + # Note: inet_aton will only resolve IPv4 addresses. + # For IPv6 we'll need to use inet_pton which requires Perl 5.12. + my $n = inet_aton($address); + if ($n) { + $address = gethostbyaddr($n, AF_INET) . " ($address)" + } my $vars = { locked_user => $user, attempts => $attempts, unlock_at => $unlock_at, + address => $address, }; my $message; $template->process('email/lockout.txt.tmpl', $vars, \$message) |