TeamAmaze / AmazeFileManager

Material design file manager for Android
https://teamamaze.xyz
GNU General Public License v3.0
5.25k stars 1.56k forks source link

SMB with user/pass never worked (for me) at any version | Crash in an old tablet #3010

Open LukasThyWalls opened 2 years ago

LukasThyWalls commented 2 years ago

Hello.

I will need to modify the issue template a little bit to explain this, because i was testing Amaze for something and the i realized that the issue is bigger than i thought (in fact, seems they are two but one lead me to the another). In the end is a summary, meanwhile the rest in entering in details.

First, a little bit of context. I was trying to use Amaze in an old tablet that i mostly use to play music and play some old games, it's very old, i uses Android 4.1.1, but because it's easier than copy via USB, i was looking to copy throw the lan with SMB some files from time to time, i was thinking to use Amaze because it's still can use in 4.x (it said that in Google Play) so i tried.

So, when i tried to create a SMB connection:

  1. Open Amaze
  2. "+" Button
  3. Cloud Connection
  4. SMB Connection
  5. Custom IP (It doesn't found anything in the auto search, i will point that out later)
  6. Put Name/IP/Name and Password (If needed, i will explain that later)
  7. Push "Create".

And It simply crash:

Crash log for Amaze 3.6.7 in the Android 4.1.1 tablet

* __App Name:__ Administrador de Archivos Amaze * __Package:__ com.amaze.filemanager * __Version:__ 3.6.7 * __User Action:__ UI Error * __Request:__ Application crash * __OS:__ Linux Android 4.1.1 - 16 * __Device:__ wmid * __Model:__ WM8850-mid * __Product:__ wmid ``` java.lang.NullPointerException: The callable returned a null value at io.reactivex.internal.functions.ObjectHelper.requireNonNull(ObjectHelper.java:39) at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44) at io.reactivex.Single.subscribe(Single.java:3603) at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89) at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578) at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66) at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856) ```

So, i was thinking, ok it's a very old tablet, it's normal that it doesn't work anymore (the stock browser doesn't work anymore because some SSL thing...) so maybe is related to that and there isn't anything to do here to fix it. So i was to write here to think to drop at least 4.x and 4.1.x compatibility, or maybe the crash can be catched and show an message that thing doesn't work anymore in that old Android, because the normal file browser works fine and for some old things that still are somewhere can be useful.

But then i tried something more: I tested some Amaze old versions to see when it works and i can use SMB in that Android. For that i tested these ones:

So, with ANY of them i cannot connect to a SMB share with user and password, but i can to one without them, and after 3.5.x, it directly crash. Also, it didn't auto find the computers in my network above 3.1.

So then i need to point this out: I can use Samba shares in the tablet with VLC 3.0.13 and Ghost Commander 1.60a1, both are older versions because they doesn't update anymore for this tablet's Android version, but they work and i use the same IP/Share/User/Password in all of them, so other things works, the config is right and it's not the tablet hardware itself (and any of them are as old as Amaze 3.1).

But the crash for sure seems to be because the tablet is pretty old. So, i did a test with my Xiaomi Mi 9 Lite (Android 10) with Amaze 3.6.7: It didn't crash, but still i can't connect to my SMB share with user and password, but i can to one without any. So, i did the same test to see if there is something different:

So, in short, in a newer device that should work it does the same thing as the old tablet except the crash since 3.5.3. I need to point out also that in that Xiaomi i use CX Explorer, VLC and SyncMe Wireless (all lastest versions) to browse in my samba shares without any issues and using the same configuration i used to config all versions of Amaze.

Other detail i need to adress is that my user name has a space in it. I say this because i search here and in the past there where issues with passwords with spaces or other characters, and maybe is simply as that. Besides that i don't recall anything that can be an obvious issue, and like i said, other apps works with both devices.

Summarizing

Also to say that the crash log was create for Amaze, the logs in the old tablet with aLogcat ROOT and in the Xiaomi device with Logs (both filtered with the keyword "Amaze").

Sorry for the text bulk, but i don't think i can explain this better than this way.

Thanks!

TranceLove commented 2 years ago

This is really a tough question to answer.

The NullPointerException thrown, as seen above, when running 3.6.7 codebase on Galaxy Nexus emulator running Android 4.1, beneath seems to be

2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err: jcifs.CIFSException: The default OEM encoding Cp850 does not appear to be supported by this JRE.
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at jcifs.config.BaseConfiguration.initDefaults(BaseConfiguration.java:764)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at jcifs.config.PropertyConfiguration.<init>(PropertyConfiguration.java:162)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.smb.CifsContexts.create$lambda-3(CifsContexts.kt:90)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.smb.CifsContexts.$r8$lambda$qdgqU5SxyWcJVLYxs5ZbPP868es(CifsContexts.kt)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at com.amaze.filemanager.filesystem.smb.CifsContexts$$ExternalSyntheticLambda1.call(Unknown Source)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at io.reactivex.Single.subscribe(Single.java:3603)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
2021-11-20 22:27:33.593 3273-3335/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
2021-11-20 22:27:33.603 3273-3335/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:150)
2021-11-20 22:27:33.603 3273-3335/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:264)
2021-11-20 22:27:33.603 3273-3335/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
2021-11-20 22:27:33.603 3273-3335/com.amaze.filemanager.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
2021-11-20 22:27:33.603 3273-3335/com.amaze.filemanager.debug W/System.err:     at java.lang.Thread.run(Thread.java:856)

This is indeed due to the use of updated jcifs library, that is a modern one supporting SMBv2, instead of the legacy jcifs which had been stopped development after 2018.

The next problem, concerning versions >= 3.4 cannot connect to SMB requiring authentication, it's due to CryptUtil using AES-GCM algorithm which doesn't exist until Android 4.4.

I may post a PR to fix this problem, but unfortunately this shall not solve your problem, due to the use of newer generations of jcifs library at the first place.

LukasThyWalls commented 2 years ago

Like i said in the issue, i don't expect that it would work in the old Android 4.1 tablet, my original intention was to report to rise the 4.0 compatibility, or isolate the exception to make work everything else except this without crashing in a 4.x device, but when i tested the SMB share in an Android 10.0 and tested olders versions of Amaze (to look a version that works in that old tablet) and in all of them do the same in every version (except the crash) about connecting a SMB share with user/password, that's why i tried to recollect all the data i could, because it look like a long running bug that never got fixed.

NanyangTaiji commented 2 years ago

Smb with user/password combinations never work for me as well, for devices with Android 29, 30 , and 31. But "anonymous login" works.

jtorres010 commented 10 months ago

Similar problem here with newer app version, below the details.

Describe the bug Amaze File Manager cannot connect to SMB share.

To Reproduce Steps to reproduce the behavior:

  1. Add SMB connection
  2. Use custom IP
  3. Fill in all the applicable fields: Connection name, Server IP address, Domain, User name, Password.
  4. Click on 'Create'
  5. Pop-up message "Oops, something went wrong!"
  6. Conneccion entry is actually created, but I get the same error every time I click on it

Expected behavior Connect to SMB share and display folder contents.

Screenshots The error message just says "Oops, something went wrong!" Logcat details at the same time (filtered by 'amaze') as follows:

2023-11-19 17:09:56.950 31838-31838 TextInputLayout         com.amaze.filemanager                I  EditText added is not a TextInputEditText. Please switch to using that class instead.
2023-11-19 17:09:56.977 31838-31838 chatty                  com.amaze.filemanager                I  uid=10705(com.amaze.filemanager) identical 4 lines
2023-11-19 17:09:56.983 31838-31838 TextInputLayout         com.amaze.filemanager                I  EditText added is not a TextInputEditText. Please switch to using that class instead.
2023-11-19 17:09:57.057 28135-28135 GoogleInpu...hodService com...gle.android.inputmethod.latin  I  GoogleInputMethodService.onStartInput():1883 onStartInput(EditorInfo{EditorInfo{packageName=com.amaze.filemanager, inputType=0, inputTypeString=NULL, enableLearning=false, autoCorrection=false, autoComplete=false, imeOptions=0, privateImeOptions=null, actionName=UNSPECIFIED, actionLabel=null, initialSelStart=-1, initialSelEnd=-1, initialCapsMode=0, label=null, fieldId=-1, fieldName=null, extras=null, hintText=null, hintLocales=[]}}, false)
2023-11-19 17:10:00.463  1770-4654  NotificationService     system_server                        W  Toast already killed. pkg=com.amaze.filemanager token=android.os.BinderProxy@797babb

Smartphone:

Additional context SMB share running on Ubuntu Server. min protocol = SMB3 All SMB connection fields double-checked for typing errors. They are all correct. I also tried other Adroid file manager apps, and they connect fine to the same SMB share.

DevLomoSE commented 6 months ago

min protocol = SMB3

im not sure if it is an issue or it's related to the protocol on adrorid device itself, but i had a similar issue, once i changed the min protocol to 2, it worked on my phone.

TranceLove commented 6 months ago

@DevLomoSE Probably yes... as the upstream jcifs-ng library doesn't fully support SMB3 yet.

The other possibility is related to the use of okhttp for discovery via wsdd. The library doesn't support KitKat...

May fix it by routing KitKats to use old school HttpURLConnection method, but with Google is also dropping support for KitKats, I too may not put this fix on high priority🥲

jtorres010 commented 6 months ago

@DevLomoSE @TranceLove Thank you so much for the advice. That was the reason in my case.

I changed "min protocol = SMB2" in the server configuration file, restarted the service and got everything working. I'm using Amaze v3.10 now.

I'll keep this configuration and wait until SMB3 is fully supported. The app is really worth it.

DevLomoSE commented 6 months ago

Glad it helps