chiark / gitweb /
Normalise commodity name case (from uploads)
[ypp-sc-tools.db-live.git] / yarrg / commod-update-receiver
index e03a91828424c7da947aeb3af599402d59e4e005..0258a51e04130c96ff24a3151095132dbfc3faee 100755 (executable)
 # are used without permission.  This program is not endorsed or
 # sponsored by Three Rings.
 
+BEGIN { unshift @INC, qw(.) }
+
 use strict (qw(vars));
 use POSIX;
 use MIME::Entity;
 
 use Commods;
 
+no warnings qw(exec);
+
 $CGI::POST_MAX= 3*1024*1024;
 
 use CGI qw/:standard -private_tempfiles/;
@@ -93,7 +97,7 @@ addlog("receiving");
 
 $o{'clientname'}= must_param('clientname',$re_any);
 my $clientinfo= $clients{$o{'clientname'}};
-fail('unknown client') unless defined $clientinfo;
+fail('unknown client '.errsan($o{'clientname'})) unless defined $clientinfo;
 
 my $clientfixes= must_param('clientfixes', "^([-0-9a-z ]*)\$");
 my @clientfixes= sort grep { m/./ } split /\s+/, $clientfixes;
@@ -115,7 +119,7 @@ $o{'ocean'}= must_param('ocean', $re_any);
 $o{'island'}= must_param('island', $re_any);
 
 my $arches= $oceans{$o{'ocean'}};
-fail("unknown ocean") unless $arches;
+fail("unknown ocean ".errsan($o{'ocean'})) unless $arches;
 
 parse_info_serverside_ocean($o{'ocean'});
 
@@ -126,10 +130,10 @@ foreach my $islands (values %$arches) {
     die if $island_found;
     $island_found= $sources;
 }
-fail("unknown island") unless $island_found;
+fail("unknown island ".errsan($o{'island'})) unless $island_found;
 
 $o{'timestamp'}= must_param('timestamp', "^([1-9]\\d{1,20})\$");
-fail("clock skew") if $o{'timestamp'} >= $now;
+fail("clock skew") if $o{'timestamp'} > $now;
 
 my $indatafh= upload('data');
 defined $indatafh or fail("data is not a file");