Closed Bug 468697 Opened 16 years ago Closed 16 years ago

Password sync support

Categories

(Cloud Services :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hello, Assigned: anant)

References

Details

Attachments

(2 files, 5 obsolete files)

Sync logins from pwmanager.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Reopening as this is the real bug for 0.3
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Assignee: nobody → anant
Depends on: 459860
This component sets itself as a LoginManagerStorage module so that Weave may intercept LoginManager activity in it's password module tracker. The component uses the actual StorageManager to store the login data it receives.
Attachment #361389 - Flags: review?(thunder)
A note on observer notifications created by the components: event, topic, data -- addLogin, "weave:login-shim", "added" removeLogin, "weave:login-shim", "removed" modifyLogin, "weave:login-shim", "modified" removeAllLogins, "weave:login-shim", "deleted"
Comment on attachment 361389 [details] [diff] [review] LoginManagerStorage shim for Weave >+ addLogin : function (aLogin) { >+ this.log("--- addLogin ---"); >+ this._tee.addLogin(aLogin); >+ this._observer.notifyObservers(this, "weave:login-shim", "added"); >+ }, I think what you actually want is: this._observer.notifyObservers(this, "weave:login-shim:added", aLogin); (and similar changes for removed, modified). removeAllLogins should have a topic like "...:remove-all" or such. "deleted" makes it sound like it's only one.
Attachment #361389 - Flags: review?(thunder) → review-
Justin, if you are planning to add observer notifications to login manager and would prefer we use the same topics you intend to use, we can do that. Just let Anant know.
Depends on: 438356
Depends on: 475282
No longer depends on: 475282
Attached patch Password sync engine for 0.3 (obsolete) — Splinter Review
Following resolution of bugs 477917 and 467463, here's an updated version of the Password sync engine. The changeItemID and update method haven't been implemented because I don't understand their purpose and if they'll be applicable to the password store. I've also not created a new type_record for passwords, creating an object directly in createRecord instead. Also, we're iterating over a list of logins to find the one with a particular GUID. We can change this to use findLogins() when the interface to query by GUID is provided.
Attachment #361389 - Attachment is obsolete: true
Attachment #364313 - Flags: review?(thunder)
Attachment #364313 - Flags: review?(thunder) → review-
Comment on attachment 364313 [details] [diff] [review] Password sync engine for 0.3 >+ __proto__: SyncEngine.prototype, >+ name: "Passwords", nit: we use lowercase for the name, to keep the collection names all lowercase. >+ changeItemID: function PasswordStore__changeItemID(oldID, newID) { >+ /* FIXME: What does this mean? */ >+ this._log.debug("changeItemID called, unimplemented!"); >+ }, This means two clients have the same login:password:realm:whatever combination, but with different IDs. In that case, the engine will change the local ID to match the remote one, so they in effect become the same item across the two clients. Simply search for the local item with 'oldID', and change its GUID to be 'newID'. >+ createRecord: function PasswordStore__createRecord(id) { >+ let record = {}; >+ let login = this._getByGUID(id); >+ >+ if (login) { >+ record.GUID = id; >+ record.cleartext = {}; >+ record.cleartext.hostname = login.hostname; ... You should implement a LoginRecord type that derives from CryptoWrapper. Or at the very least create a CryptoWrapper here (though a typed record would be preferred). If you don't have the encrypt/decrypt methods this code will fail: http://hg.mozilla.org/labs/weave/file/tip/modules/engines.js#l427 Using a type record makes it cleaner because you don't have the 'cleartext' in there (since your type record can have getters for that info). >+ update: function PasswordStore__update(record) { >+ /* FIXME: Use nsILoginManagerStorage modifyLogin? */ >+ this._log.debug("update called, unimplemented!"); Please implement :-) >+ _init: function PasswordTracker_init() { >+ this.__proto__.__proto__._init.call(this); >+ let observerService = Cc["@mozilla.org/observer-service;1"]. >+ getService(Ci.nsIObserverService); >+ observerService.addObserver(this, 'passwordmgr-storage-changed', false); nit: Observers module is preferred. Your tracker is missing code to track which items have changed, so they can be synced up on the next sync.
Okay, updated with implemented type record and missing methods. For some reason, resource gets called with a URI of 'null', causing an exception when a new channel is created. Is this because I've not implemented the typed record correctly?
Attachment #364313 - Attachment is obsolete: true
Attachment #364495 - Flags: review?(thunder)
Attached file Password sync engine for 0.3 (v3) (obsolete) —
Fixes null Resource problem--createRecord has to set the encryption URI. Also fixes a typo when calling nsIPropertyBag2's setPropertyAsAUTF8String. There are 3 problems with this patch still: 1) Sync fails when applying records: Error while applying incoming record: Could not convert JavaScript argument arg 0 [nsILoginManager.addLogin] 2) It is too slow when there are a lot of existing passwords 3) It's missing the UI bits in the pref pane
Attachment #364495 - Attachment is obsolete: true
Attachment #364495 - Flags: review?(thunder)
Okay, one more pass at this. We're caching loginInfo items now. Reconciliation works fine, but oddly enough addLogin was never called even once in my tests, it always tried to change the GUIDs to something that already exists (a case which results in the code not doing the guid change)
Attachment #364927 - Attachment is obsolete: true
Attachment #364962 - Flags: review?(thunder)
5 times' a charm! (I promise it works this time) :)
Attachment #364962 - Attachment is obsolete: true
Attachment #364962 - Flags: review?(thunder)
here's my current version. there are several differences from v5 (it doesn't derive from v5, I started with v3) This version doesn't work because the password store gets created twice somehow, and the second one never gets the loginInfo cache created, which causes itemExists to fail.
I think we're more or less done with this; we can reopen if any other major bugs are found down the road :)
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
Depends on: 482829
Component: Weave → General
Product: Mozilla Labs → Weave
QA Contact: weave → general
Flags: in-testsuite?
Investigating this bug for being potential crossweave automation test case candidate.
Investigating this bug for being potential crossweave automation test case candidate.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: