From 2d425a6a17632ef94588b87b5cb5b4117ef22f9e Mon Sep 17 00:00:00 2001 From: Hai Zhang Date: Sun, 7 Apr 2024 13:43:32 -0700 Subject: [PATCH] Revert "[Feature] Update SMBJ." To work around regression in SMB anonymous authentication. See also https://github.com/hierynomus/smbj/issues/792 This reverts commit d9ce4e604bd11ff32794966798c3addd13f6293f. Bug: #1181 --- app/build.gradle | 8 ++++---- .../android/files/provider/smb/client/FileByteChannel.kt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4c02e423e..ed3a6ada8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -148,8 +148,10 @@ dependencies { implementation 'com.drakeet.drawer:drawer:1.0.3' implementation 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:1.0.0' implementation 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:1.0.0' - implementation ('com.hierynomus:smbj:0.13.0') { - exclude group: 'org.bouncycastle', module: 'bcprov-jdk18on' + implementation ('com.hierynomus:smbj:0.11.5') { + // org.bouncycastle:bcprov-jdk15on uses bytecode version unsupported by Jetifier, so use + // org.bouncycastle:bcprov-jdk15to18 instead. + exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on' } // SSHJ 0.36.0 requires Java 8. //noinspection GradleDependency @@ -162,8 +164,6 @@ dependencies { // SMBJ-RPC depends on the JRE flavor of Guava which targets Java 8. exclude group: 'com.google.guava', module: 'guava' exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on' - // This comes from the dependency on SMBJ. - exclude group: 'org.bouncycastle', module: 'bcprov-jdk18on' } implementation 'com.google.guava:guava:33.0.0-android' // Guava conflicts with com.google.guava:listenablefuture:1.0 pulled in by AndroidX Core diff --git a/app/src/main/java/me/zhanghai/android/files/provider/smb/client/FileByteChannel.kt b/app/src/main/java/me/zhanghai/android/files/provider/smb/client/FileByteChannel.kt index fbf576117..ab7339881 100644 --- a/app/src/main/java/me/zhanghai/android/files/provider/smb/client/FileByteChannel.kt +++ b/app/src/main/java/me/zhanghai/android/files/provider/smb/client/FileByteChannel.kt @@ -62,7 +62,7 @@ class FileByteChannel( override fun onWrite(position: Long, source: ByteBuffer) { val sourcePosition = source.position() val bytesWritten = try { - file.write(ByteBufferChunkProvider(source, position)).toInt() + file.write(ByteBufferChunkProvider(source, position)) } catch (e: SMBRuntimeException) { throw e.toIOException() }