Commit a183991f authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Check that IDs have valid type

parent 16578880
......@@ -11,6 +11,10 @@ def get_volume(user_id, volume_id, for_update=False,
volumes = models.Volume.objects
if for_update:
volumes = volumes.select_for_update()
volume_id = int(volume_id)
except (TypeError, ValueError):
raise faults.BadRequest("Invalid volume id: %s" % volume_id)
return volumes.get(id=volume_id, userid=user_id)
except models.Volume.DoesNotExist:
......@@ -34,6 +38,10 @@ def get_image(user_id, image_id, exception=faults.ItemNotFound):
def get_server(user_id, server_id, for_update=False,
server_id = int(server_id)
except (TypeError, ValueError):
raise faults.BadRequest("Invalid server id: %s" % server_id)
return get_vm(server_id, user_id, for_update=for_update,
non_deleted=True, non_suspended=True)
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