private void AuthenticateNew()
{
if ((connectionFlags & ClientFlags.SECURE_CONNECTION) == 0)
AuthenticateOld();
packet.Write(Crypt.Get411Password(Settings.Password, encryptionSeed));
if ((connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 && Settings.Database != null)
packet.WriteString(Settings.Database);
else
packet.WriteString(""); // Add a null termination to the string.
stream.SendPacket(packet);
// this result means the server wants us to send the password using
// old encryption
packet = stream.ReadPacket();
if (packet.IsLastPacket)
{
packet.Clear();
packet.WriteString(Crypt.EncryptPassword(
Settings.Password, encryptionSeed.Substring(0, 8), true));
stream.SendPacket(packet);
ReadOk(true);
}
else
ReadOk(false);
}