From 4c38c480fa5747df7ca440048f25fc60b6a1a4d2 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 27 Jun 2023 16:30:44 +0200 Subject: [PATCH] Use libidn for stringprep Which actually validates according to spec instead of just being lazy. --- build.gradle | 1 + .../siacs/conversations/services/XmppConnectionService.java | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 44e352367..ba81efdad 100644 --- a/build.gradle +++ b/build.gradle @@ -67,6 +67,7 @@ dependencies { implementation 'com.github.natario1:Egloo:v0.4.0' implementation 'org.jxmpp:jxmpp-jid:1.0.3' + implementation 'org.jxmpp:jxmpp-stringprep-libidn:1.0.3' implementation 'org.osmdroid:osmdroid-android:6.1.11' implementation 'org.hsluv:hsluv:0.2' implementation 'org.conscrypt:conscrypt-android:2.5.2' diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index dcb613399..d24b22edc 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -33,7 +33,6 @@ import android.os.Bundle; import android.os.Environment; import android.os.IBinder; import android.os.Messenger; -import android.os.Parcelable; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.SystemClock; @@ -60,6 +59,7 @@ import com.google.common.base.Optional; import com.google.common.base.Strings; import org.conscrypt.Conscrypt; +import org.jxmpp.stringprep.libidn.LibIdnXmppStringprep; import org.openintents.openpgp.IOpenPgpService2; import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpServiceConnection; @@ -68,7 +68,6 @@ import java.io.File; import java.security.Security; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; -import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -81,7 +80,6 @@ import java.util.ListIterator; import java.util.Map; import java.util.Set; import java.util.WeakHashMap; -import java.util.concurrent.Callable; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; @@ -131,7 +129,6 @@ import eu.siacs.conversations.ui.UiCallback; import eu.siacs.conversations.ui.interfaces.OnAvatarPublication; import eu.siacs.conversations.ui.interfaces.OnMediaLoaded; import eu.siacs.conversations.ui.interfaces.OnSearchResultsAvailable; -import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.Compatibility; import eu.siacs.conversations.utils.ConversationsFileObserver; import eu.siacs.conversations.utils.CryptoHelper; @@ -1157,6 +1154,7 @@ public class XmppConnectionService extends Service { @SuppressLint("TrulyRandom") @Override public void onCreate() { + LibIdnXmppStringprep.setup(); if (Compatibility.runsTwentySix()) { mNotificationService.initializeChannels(); }