make authentications work with null password
This commit is contained in:
parent
f982885d2e
commit
f16603742f
|
@ -1,6 +1,7 @@
|
|||
package im.conversations.android.xmpp.sasl;
|
||||
|
||||
import android.util.Base64;
|
||||
import com.google.common.base.Strings;
|
||||
import eu.siacs.conversations.utils.CryptoHelper;
|
||||
import im.conversations.android.database.model.Account;
|
||||
import im.conversations.android.database.model.Credential;
|
||||
|
@ -54,7 +55,7 @@ public class DigestMd5 extends SaslMechanism {
|
|||
+ ":"
|
||||
+ account.address.getDomain()
|
||||
+ ":"
|
||||
+ credential.password;
|
||||
+ Strings.nullToEmpty(credential.password);
|
||||
final MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
final byte[] y = md.digest(x.getBytes(Charset.defaultCharset()));
|
||||
final String cNonce = CryptoHelper.random(100);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package im.conversations.android.xmpp.sasl;
|
||||
|
||||
import android.util.Base64;
|
||||
import com.google.common.base.Strings;
|
||||
import im.conversations.android.database.model.Account;
|
||||
import im.conversations.android.database.model.Credential;
|
||||
import java.nio.charset.Charset;
|
||||
|
@ -31,6 +32,7 @@ public class Plain extends SaslMechanism {
|
|||
|
||||
@Override
|
||||
public String getClientFirstMessage(final SSLSocket sslSocket) {
|
||||
return getMessage(account.address.getEscapedLocal(), credential.password);
|
||||
return getMessage(
|
||||
account.address.getEscapedLocal(), Strings.nullToEmpty(credential.password));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package im.conversations.android.xmpp.sasl;
|
|||
import android.util.Base64;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.hash.HashFunction;
|
||||
|
@ -215,7 +216,7 @@ abstract class ScramMechanism extends SaslMechanism {
|
|||
try {
|
||||
keys =
|
||||
getKeyPair(
|
||||
CryptoHelper.saslPrep(credential.password),
|
||||
CryptoHelper.saslPrep(Strings.nullToEmpty(credential.password)),
|
||||
salt,
|
||||
iterationCount);
|
||||
} catch (ExecutionException e) {
|
||||
|
|
Loading…
Reference in a new issue