From 43715460c6ecba2f893e2fcfe1622faca6e41075 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 18 Mar 2017 13:19:51 +0100 Subject: [PATCH] Fix SASL SCRAM-SHA-1(-PLUS) priority Fixes SMACK-749. Thanks to Grigory Fedorov for reporting this and to Kim Alvefur for helping to diagnose the issue. --- .../jivesoftware/smack/sasl/core/SCRAMSHA1Mechanism.java | 6 ++++-- .../smack/sasl/core/ScramSha1PlusMechanism.java | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1Mechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1Mechanism.java index 6573fa4a5..29d774dc3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1Mechanism.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1Mechanism.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014-2016 Florian Schmaus + * Copyright 2014-2017 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,8 @@ import org.jivesoftware.smack.util.MAC; public class SCRAMSHA1Mechanism extends ScramMechanism { + static final int PRIORITY = 110; + static { SHA_1_SCRAM_HMAC = new ScramHmac() { @Override @@ -47,7 +49,7 @@ public class SCRAMSHA1Mechanism extends ScramMechanism { @Override public int getPriority() { - return 110; + return PRIORITY; } @Override diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramSha1PlusMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramSha1PlusMechanism.java index 05312c9e4..34de148bf 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramSha1PlusMechanism.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramSha1PlusMechanism.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016 Florian Schmaus + * Copyright 2016-2017 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class ScramSha1PlusMechanism extends ScramPlusMechanism { @Override public int getPriority() { - return 110; + return SCRAMSHA1Mechanism.PRIORITY - 10; } @Override