Weave on Fennec will no longer attempt to generate SSH keys -- for this release, you need to have a Weave account already and then connect Fennec to it.
authorjonathandicarlo@user-64-9-236-168.googlewifi.com
Sun, 21 Dec 2008 14:41:17 -0800
changeset 45127 8906eacd7374ede19b53ecc957950ce4e1803bc4
parent 45126 6c8ac5d6d05450a050300c278aa171d087bb0b1a
child 45128 c5fac5771b6d05573b7971981f11a96680e360bc
push idunknown
push userunknown
push dateunknown
Weave on Fennec will no longer attempt to generate SSH keys -- for this release, you need to have a Weave account already and then connect Fennec to it.
services/sync/modules/service.js
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -112,16 +112,17 @@ WeaveSvc.prototype = {
   _notify: Wrap.notify,
   _localLock: Wrap.localLock,
   _catchAll: Wrap.catchAll,
   _osPrefix: "weave:service:",
   _cancelRequested: false,
   _isQuitting: false,
   _loggedIn: false,
   _syncInProgress: false,
+  _keyGenEnabled: true,
 
   __os: null,
   get _os() {
     if (!this.__os)
       this.__os = Cc["@mozilla.org/observer-service;1"]
         .getService(Ci.nsIObserverService);
     return this.__os;
   },
@@ -195,16 +196,19 @@ WeaveSvc.prototype = {
   get isLoggedIn() this._loggedIn,
 
   get isQuitting() this._isQuitting,
   set isQuitting(value) { this._isQuitting = value; },
 
   get cancelRequested() this._cancelRequested,
   set cancelRequested(value) { this._cancelRequested = value; },
 
+  get keyGenEnabled() this._keyGenEnabled,
+  set keyGenEnabled(value) { this._keyGenEnabled = value; },
+
   get enabled() Utils.prefs.getBoolPref("enabled"),
 
   get schedule() {
     if (!this.enabled)
       return 0; // manual/off
     return Utils.prefs.getIntPref("schedule");
   },
 
@@ -507,18 +511,24 @@ WeaveSvc.prototype = {
       // make sure we have a matching privkey
       let privkey = yield PrivKeys.get(self.cb, pubkey.privateKeyUri);
       if (privkey) {
         needKeys = false;
         ret = true;
       }
     }
 
+    if (this._keyGenEnabled) {
     // TODO: do not try the following if we're on Fennec:
-    if (needKeys) {
+      this._log.warn("Key generation is enabled.");
+    } else {
+      this._log.warn("Key generation is disabled.");
+    }
+
+    if (needKeys && this._keyGenEnabled) {
       let pass = yield ID.get('WeaveCryptoID').getPassword(self.cb);
       if (pass) {
         let keys = PubKeys.createKeypair(pass, PubKeys.defaultKeyUri,
                                          PrivKeys.defaultKeyUri);
         try {
           yield keys.pubkey.put(self.cb);
           yield keys.privkey.put(self.cb);
           ret = true;
@@ -526,16 +536,20 @@ WeaveSvc.prototype = {
           this._log.error("Could not upload keys: " + Utils.exceptionStr(e));
           this._log.error(keys.pubkey.lastRequest.responseText);
         }
       } else {
         this._log.warn("Could not get encryption passphrase");
       }
     }
 
+    if (needKeys && !this._keyGenEnabled) {
+      this._log.warn("Can't get keys from server and local keygen disabled.");
+    }
+
     self.done(ret);
   },
 
   // These are per-engine
 
   _sync: function WeaveSvc__sync() {
     let self = yield;