Skip Menu |

This queue is for tickets about the Net-IPAddress CPAN distribution.

Report information
The Basics
Id: 72050
Status: new
Priority: 0/
Queue: Net-IPAddress

People
Owner: Nobody in particular
Requestors: yigal.moshkovich [...] dothill.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.10
Fixed in: (no value)



Subject: function validaddr accepted invalid IP
Perl version: v5.8.8 OS: Solaris (SunOS ncl1 5.10 Generic_144489-09 i86pc i386 i86pc) I have a function that asks the user to input an IP string for example: 1.1.1.1 and validate it using "validaddr" if the input is: yyyyy or 1.1.1.999 there is no problem the error returns correctly meaning I get 0 and not 1 as RC but for some reason: 1.1.1.x or a.a.a.a passes with no problem recommendation to add check if each of the number passes the following test: if ($number =~ /^[+-]?\d+$/) {} else {print "\tparameter isn't a number\n"; this is an extract from the user wizard: How many UPS's will be connected to the Storage system? 1/2 [2]: Enter IP address for UPS1: bbb.999.1.1 Invalid IP Enter IP address for UPS1: a.a.a.a Enter IP address for UPS2: 1.1.1.x this is the relevant section of code for IP validation: ${upsA} = &prompt("\tHow many UPS's will be connected to the Storage system? 1/2 ", "2"); if ($upsA eq 1) { print "\tUPS IP's can report via Management or Client networks\n"; UPS_A_IP: { $upsIP = &prompt("\tEnter IP address for UPS1"); if ((validaddr$upsIP) eq 1) { `cat $prmtmpfile | sed -e 's/<ups1S1>/$upsIP/g' > $finalparamfile`; `cp $finalparamfile $prmtmpfile`; } else { print "\tInvalid IP\n"; goto UPS_A_IP; } } regards igal