Handle invalid handshake data properly in the core
[quassel.git] / src / core / sqlitestorage.cpp
index 0b640f4..e71c537 100644 (file)
@@ -130,7 +130,7 @@ UserId SqliteStorage::addUser(const QString &user, const QString &password)
         query.prepare(queryString("insert_quasseluser"));
         query.bindValue(":username", user);
         query.bindValue(":password", hashPassword(password));
-        query.bindValue(":hashversion", Storage::HashVersion::latest);
+        query.bindValue(":hashversion", Storage::HashVersion::Latest);
         lockForWrite();
         safeExec(query);
         if (query.lastError().isValid() && query.lastError().number() == 19) { // user already exists - sadly 19 seems to be the general constraint violation error...
@@ -160,7 +160,7 @@ bool SqliteStorage::updateUser(UserId user, const QString &password)
         query.prepare(queryString("update_userpassword"));
         query.bindValue(":userid", user.toInt());
         query.bindValue(":password", hashPassword(password));
-        query.bindValue(":hashversion", Storage::HashVersion::latest);
+        query.bindValue(":hashversion", Storage::HashVersion::Latest);
         lockForWrite();
         safeExec(query);
         success = query.numRowsAffected() != 0;
@@ -968,7 +968,7 @@ void SqliteStorage::setChannelPersistent(UserId user, const NetworkId &networkId
         QSqlQuery query(db);
         query.prepare(queryString("update_buffer_persistent_channel"));
         query.bindValue(":userid", user.toInt());
-        query.bindValue(":networkId", networkId.toInt());
+        query.bindValue(":networkid", networkId.toInt());
         query.bindValue(":buffercname", channel.toLower());
         query.bindValue(":joined", isJoined ? 1 : 0);
 
@@ -990,7 +990,7 @@ void SqliteStorage::setPersistentChannelKey(UserId user, const NetworkId &networ
         QSqlQuery query(db);
         query.prepare(queryString("update_buffer_set_channel_key"));
         query.bindValue(":userid", user.toInt());
-        query.bindValue(":networkId", networkId.toInt());
+        query.bindValue(":networkid", networkId.toInt());
         query.bindValue(":buffercname", channel.toLower());
         query.bindValue(":key", key);
 
@@ -1808,6 +1808,7 @@ bool SqliteMigrationReader::readMo(QuasselUserMO &user)
     user.id = value(0).toInt();
     user.username = value(1).toString();
     user.password = value(2).toString();
+    user.hashversion = value(3).toInt();
     return true;
 }