summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-10-11 01:39:17 +0000
committerivan <ivan>2009-10-11 01:39:17 +0000
commit0e3d27730f91e10abb8f655d578eb0fd51b82cd1 (patch)
tree3500fc028f22c566243f2ded576946b8664980af
parent183e872ce5c856e54399bf06dfc55b4262805596 (diff)
::1 becomes 127.0.0.1 in IP checks
-rw-r--r--FS/FS/Record.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index f17b24036..d4d7ca137 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -2204,12 +2204,14 @@ sub ut_hexn {
}
=item ut_ip COLUMN
-Check/untaint ip addresses. IPv4 only for now.
+Check/untaint ip addresses. IPv4 only for now, though ::1 is auto-translated
+to 127.0.0.1.
=cut
sub ut_ip {
my( $self, $field ) = @_;
+ $self->setfield($field, '127.0.0.1') if $self->getfield($field) eq '::1';
$self->getfield($field) =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
or return "Illegal (IP address) $field: ". $self->getfield($field);
for ( $1, $2, $3, $4 ) { return "Illegal (IP address) $field" if $_ > 255; }
@@ -2219,7 +2221,8 @@ sub ut_ip {
=item ut_ipn COLUMN
-Check/untaint ip addresses. IPv4 only for now. May be null.
+Check/untaint ip addresses. IPv4 only for now, though ::1 is auto-translated
+to 127.0.0.1. May be null.
=cut