Commit de749f33 authored by Leigh Stoller's avatar Leigh Stoller

Fix the bug that was causing iminds to blow up. They might be out of

data and not sent us an image deletion, or we missed it somehow. And
when a new image with the same urn (different uuid) came in, our bug
messed up on deleting the old one. That is fixed and iminds is turned
back on.
parent b2e0fb50
......@@ -195,6 +195,9 @@ sub PostImageInfo($)
"Not allowed to postimageinfo for the image domain")
if ($image_hrn->domain() ne $caller_hrn->domain());
return GeniResponse->MalformedArgsResponse("IMINDS is messed up")
if (0 && $image_hrn->domain() eq "");
......@@ -259,6 +262,13 @@ sub VerifyBlob($)
return GeniResponse->MalformedArgsResponse("Missing $key")
if (! (exists($blob->{$key}) && defined($blob->{$key})));
return GeniResponse->MalformedArgsResponse("URN too long $key")
if (length($blob->{$key}) >= 128);
my @tokens = split(/[\n\r]/, $blob->{$key});
return GeniResponse->MalformedArgsResponse("URN has newlines $key")
if (scalar(@tokens) > 1);
return GeniResponse->MalformedArgsResponse("Malformed URN: $key")
if (!GeniHRN::IsValid($blob->{$key}));
......@@ -459,17 +469,19 @@ sub NewImage($)
return GeniResponse->Create(GENIRESPONSE_ERROR);
if ($query_result->numrows) {
while (my ($old_uuid) = $query_result->fetchrow_array()) {
print STDERR "Deleting existing image $image_urn with ".
"stale uuid $image_uuid\n";
"stale uuid $old_uuid\n";
$DB->QueryWarn("delete images,image_versions from images ".
"inner join image_versions on ".
" images.urn=image_versions.urn and ".
" images.image_uuid=image_versions.image_uuid ".
"where images.urn=$safe_urn and ".
" images.image_uuid=$safe_uuid")
" images.image_uuid='$old_uuid'")
or GeniResponse->Create(GENIRESPONSE_ERROR);
# Create an entry in the images table if one does not exist.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment