Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

feat(security): treat negotiation succeed if server is old version #145

Merged
merged 5 commits into from
Dec 29, 2020
Merged
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
13 changes: 13 additions & 0 deletions src/main/java/com/xiaomi/infra/pegasus/security/Negotiation.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ private class RecvHandler implements Runnable {
public void run() {
try {
if (op.rpc_error.errno != error_code.error_types.ERR_OK) {
// ERR_HANDLER_NOT_FOUND means server is old version, which doesn't support authentication
levy5307 marked this conversation as resolved.
Show resolved Hide resolved
// In this case we consider this session will expose no privacy at all, so we can just
// go on without negotiation.
if (op.rpc_error.errno == error_code.error_types.ERR_HANDLER_NOT_FOUND) {
negotiationSucceed();
return;
}
throw new ReplicationException(op.rpc_error.errno);
}
handleResponse();
Expand All @@ -86,6 +93,12 @@ private void handleResponse() throws Exception {
throw new Exception("RecvHandler received a null response, abandon it");
}

// make the negotiation succeed if server doesn't enable auth
if (resp.status == negotiation_status.SASL_AUTH_DISABLE) {
negotiationSucceed();
return;
}

switch (status) {
case SASL_LIST_MECHANISMS:
onRecvMechanisms(resp);
Expand Down