Changeset 885 for trunk/cgi-bin/ipdb-rpc.cgi
- Timestamp:
- 07/21/16 16:34:59 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/ipdb-rpc.cgi
r876 r885 450 450 return $result; 451 451 } # rpc_getBackupList() 452 453 454 sub rpc_findAllocation { 455 my %args = @_; 456 457 _commoncheck(\%args, 'n'); 458 459 die "IP to search for required\n" if !$args{ip} || $args{ip} !~ /^\d+\.\d+\.\d+\.\d+$/; 460 461 my $sql = "SELECT cidr,custid,type FROM searchme WHERE cidr >>= ?"; 462 # first, check if it's even on our network 463 my $isours = $ip_dbh->selectall_arrayref($sql." AND type = 'mm'", undef, $args{ip}); 464 die $ip_dbh->errstr."\n" if $ip_dbh->err; # do we care? 465 die "IP not on our network\n" if !@$isours; 466 467 # now, find the specific allocation 468 my $result = $ip_dbh->selectall_arrayref($sql." AND NOT type LIKE '_m' ORDER BY cidr DESC", 469 { Slice => {} }, $args{ip}); 470 die $ip_dbh->errstr."\n" if $ip_dbh->err; 471 472 return $result; 473 } # rpc_findAllocation()
Note:
See TracChangeset
for help on using the changeset viewer.