Properly reject invalid handshake data
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 21 Sep 2010 06:46:55 +0000 (08:46 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 21 Sep 2010 06:58:01 +0000 (08:58 +0200)
Currently, if a client attempts to configure a core's storage backend
even though it is already configured, the core will ignore the attempt
silently (e.g. the existing storage backends will simply drop the request,
but the client also won't receive an error message). This can never happen
unless you use an alternative client with a buggy handshake sequence though,
since quasselclient checks if the core is already configured beforehand.

Nonetheless, it makes sense to properly error out from the core side, just in case
we're getting new storage backends in the future that don't properly check this,
or alternative clients which might be confused by not receiving an error when they should.

Thanks to JodaZ for pointing this out.

src/core/core.cpp

index 378e3a4..f9b08df 100644 (file)
@@ -272,8 +272,7 @@ QString Core::setupCore(QVariantMap setupData) {
   if(user.isEmpty() || password.isEmpty()) {
     return tr("Admin user or password not set.");
   }
-  _configured = initStorage(setupData, true);
-  if(!_configured) {
+  if(_configured || !(_configured = initStorage(setupData, true))) {
     return tr("Could not setup storage!");
   }
   CoreSettings s;