cuckoobox/cuckoo — pull request #119 by benjamin-small (2013-06-06 14:30:33+00:00)
Title: Address "browse" bug

I ran into an issue with the "browse" feature of the bottle interface. Tracking it backwards, it looks like calls to Database.view_sample were giving a sample_id. When looking at the database module the Database.view_sample method expects a task_id. This issue doesn't crop up unless the system is receiving URLs and Samples for processing. When both are received, the task_id is no longer aligned with the sample_id, so calls to "view_task" are mismatched.

Looking through the code base it's only used in a couple of places, and they both pass a sample_id. It makes sense to change this method to accept a sample_id, since you can always get a sample_id from the task object, which you can get from the task_id.

-Ben

```
grep -r view_sample cuckoo
cuckoo/lib/cuckoo/core/database.py: def view_sample(self, task_id):
cuckoo/utils/api.py: sample = db.view_sample(sample_id)
cuckoo/utils/web.py: sample = db.view_sample(row.sample_id)
```