/// <summary> /// Perform an authentication against a 4.1.1 server /// </summary> private void Authenticate411() { if ((connectionFlags & ClientFlags.SECURE_CONNECTION) == 0) { AuthenticateOld(); } stream.Write(Crypt.Get411Password(connectionString.Password, encryptionSeed)); if ((connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 && connectionString.Database != null) { stream.WriteString(connectionString.Database); } stream.Flush(); // this result means the server wants us to send the password using // old encryption stream.OpenPacket(); if (stream.IsLastPacket) { stream.StartOutput(0, false); stream.WriteString(Crypt.EncryptPassword( connectionString.Password, encryptionSeed.Substring(0, 8), true)); stream.Flush(); ReadOk(true); } else { ReadOk(false); } }
/// <summary>Perform an authentication against a 4.1.1 server</summary> private void Authenticate411() { if ((connectionFlags & ClientFlags.SECURE_CONNECTION) == 0) { AuthenticateOld(); } writer.Write(Crypt.Get411Password(connectionString.Password, this.encryptionSeed)); if ((connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 && connectionString.Database != null) { writer.WriteString(connectionString.Database); } writer.Flush(); reader.OpenPacket(); // this result means the server wants us to send the password using // old encryption if (reader.IsLastPacket) { writer.StartPacket(0); writer.WriteString(Crypt.EncryptPassword( connectionString.Password, this.encryptionSeed.Substring(0, 8), true)); writer.Flush(); reader.ReadOk(); } }
/// <summary> /// Perform an authentication against a 4.1.1 server /// </summary> 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); } }
private void AuthenticateOld() { this.writer.WriteString(Crypt.EncryptPassword(this.connectionString.Password, this.encryptionSeed, this.protocol > 9)); if ((this.connectionFlags & ClientFlags.CONNECT_WITH_DB) != (ClientFlags)0 && this.connectionString.Database != null) { this.writer.WriteString(this.connectionString.Database); } this.writer.Flush(); this.reader.ReadOk(); }
private void AuthenticateOld() { writer.WriteString(Crypt.EncryptPassword( connectionString.Password, encryptionSeed, protocol > 9)); if ((connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 && connectionString.Database != null) { writer.WriteString(connectionString.Database); } writer.Flush(); reader.ReadOk(); }
private void AuthenticateOld() { packet.WriteString(Crypt.EncryptPassword( Settings.Password, encryptionSeed, true)); if ((connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 && Settings.Database != null) { packet.WriteString(Settings.Database); } stream.SendPacket(packet); ReadOk(true); }
/// <summary> /// Perform an authentication against a 4.1.1 server /// <param name="reset"> /// True, if this function is called as part of CHANGE_USER request /// (connection reset) /// False, for first-time logon /// </param> /// </summary> private void AuthenticateNew(bool reset) { 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. } if (Settings.IntegratedSecurity) { // Append authentication method after the database name in the // handshake authentication packet.If we're sending CHANGE_USER // also write charset number after database name prior to plugin name if (reset) { packet.WriteInteger(8, 2); // Charset number } packet.WriteString(AuthenticationWindowsPlugin); stream.SendPacket(packet); AuthenticateSSPI(); return; } else { 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); } }
private void Authenticate411() { if ((this.connectionFlags & ClientFlags.SECURE_CONNECTION) == (ClientFlags)0) { this.AuthenticateOld(); } this.writer.Write(Crypt.Get411Password(this.connectionString.Password, this.encryptionSeed)); if ((this.connectionFlags & ClientFlags.CONNECT_WITH_DB) != (ClientFlags)0 && this.connectionString.Database != null) { this.writer.WriteString(this.connectionString.Database); } this.writer.Flush(); this.reader.OpenPacket(); if (this.reader.IsLastPacket) { this.writer.StartPacket(0L); this.writer.WriteString(Crypt.EncryptPassword(this.connectionString.Password, this.encryptionSeed.Substring(0, 8), true)); this.writer.Flush(); this.reader.ReadOk(); } }