From 0e3d27730f91e10abb8f655d578eb0fd51b82cd1 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 11 Oct 2009 01:39:17 +0000 Subject: [PATCH] ::1 becomes 127.0.0.1 in IP checks --- FS/FS/Record.pm | 7 +++++-- 1 file 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 -- 2.11.0