Weave server does not store newly generated RSA keys

RESOLVED FIXED

Status

Cloud Services
General
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: anant, Assigned: telliott)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
Created attachment 349343 [details] [diff] [review]
Fix case where payload is an Array

PUT requests to http://server/weave/0.3/user/keys/pubkey and http://server/weave/0.3/user/keys/privkey does not result in the storage of the keys in the DB (I'm using the SQLite backend).

The PUT request contains a payload that is an array as described in the API. However, store_object() in weave_storage.inc assumes that the payload is either an object or a string and the following warning is generated:

[Fri Nov 21 03:17:40 2008] [error] [client ::1] PHP Notice:  Array to string conversion in /Users/anant/Code/weave/server/server/weave_storage.inc on line 437

A subsequent check on the store database reveals that the pubkey and privkey payloads are incorrectly stored as 'Array'. The fix attached adds a case where the payload is an Array and stores its JSON equivalent in the DB.
(Assignee)

Comment 1

9 years ago
Odd. I would have expected that to decode to an object.

Consolidated it down to

if (is_object($payload) || is_array($payload))
(Assignee)

Updated

9 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
(Reporter)

Comment 2

9 years ago
Umm, I don't that would really work because the statement inside the if is:

json_encode($payload())

"$payload()" doesn't make sense if $payload is an Array :)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 3

9 years ago
it doesn't make sense if $payload is an object, either :)

It's a typo and I've pulled it. Should just be json_encode($payload)
Status: REOPENED → RESOLVED
Last Resolved: 9 years ago9 years ago
Resolution: --- → FIXED

Updated

9 years ago
Component: Weave → General
Product: Mozilla Labs → Weave
Target Milestone: -- → ---
QA Contact: weave → general
You need to log in before you can comment on or make changes to this bug.