use of com.alibaba.cobar.net.mysql.BinaryPacket in project cobar by alibaba.
the class MySQLChannel method auth323.
/**
* 323协议认证
*/
private void auth323(byte packetId, byte[] seed) throws IOException {
Reply323Packet r323 = new Reply323Packet();
r323.packetId = ++packetId;
String passwd = dsc.getPassword();
if (passwd != null && passwd.length() > 0) {
r323.seed = SecurityUtil.scramble323(passwd, new String(seed)).getBytes();
}
r323.write(out);
out.flush();
BinaryPacket bin = receive();
switch(bin.data[0]) {
case OkPacket.FIELD_COUNT:
afterSuccess();
break;
case ErrorPacket.FIELD_COUNT:
ErrorPacket err = new ErrorPacket();
err.read(bin);
throw new ErrorPacketException(new String(err.message, charset));
default:
throw new UnknownPacketException(bin.toString());
}
}
Aggregations