Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit client flags to server capabilities #2262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/commands/server_handshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ServerHandshake extends Command {

readClientReply(packet, connection) {
// check auth here
const clientHelloReply = Packets.HandshakeResponse.fromPacket(packet);
const clientHelloReply = Packets.HandshakeResponse.fromPacket(packet, this.args.capabilityFlags);
// TODO check we don't have something similar already
connection.clientHelloReply = clientHelloReply;
if (this.args.authCallback) {
Expand Down
4 changes: 2 additions & 2 deletions lib/packets/handshake_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ class HandshakeResponse {
const p = this.serializeResponse(Packet.MockBuffer());
return this.serializeResponse(Buffer.alloc(p.offset));
}
static fromPacket(packet) {
static fromPacket(packet, serverFlags) {
const args = {};
args.clientFlags = packet.readInt32();
function isSet(flag) {
return args.clientFlags & ClientConstants[flag];
return (args.clientFlags & serverFlags) & ClientConstants[flag];
}
args.maxPacketSize = packet.readInt32();
args.charsetNumber = packet.readInt8();
Expand Down
Loading