swiftp icon indicating copy to clipboard operation
swiftp copied to clipboard

Service running but FTP not working

Open srdrsvml1986 opened this issue 5 years ago • 5 comments

service starts smoothly. and when i try to connect via FTP filezilla i can't connect. I get an error "FtpCmd subclass lacks expected constructor" in android studio Logcat. This is nonsense for no reason at all.

srdrsvml1986 avatar Sep 26 '20 11:09 srdrsvml1986

also all logcat print; 2020-09-26 14:20:27.966 27712-28338/myapp I/o0: New connection, spawned thread 2020-09-26 14:20:27.966 27712-28338/myapp D/m0: State cleared 2020-09-26 14:20:27.978 27712-28338/myapp D/FsService: Cleaning up finished session... 2020-09-26 14:20:27.979 27712-28338/myapp D/FsService: Thread joined 2020-09-26 14:20:27.979 27712-28338/myapp D/FsService: Registered session thread 2020-09-26 14:20:27.979 27712-28599/myapp I/n0: SessionThread started 2020-09-26 14:20:27.986 27712-28599/myapp D/n0: Received line from client: AUTH TLS 2020-09-26 14:20:27.986 27712-28599/myapp D/k0: Ignoring unrecognized FTP verb: AUTH 2020-09-26 14:20:27.990 27712-28599/myapp D/n0: Received line from client: AUTH SSL 2020-09-26 14:20:27.991 27712-28599/myapp D/k0: Ignoring unrecognized FTP verb: AUTH 2020-09-26 14:20:27.996 27712-28599/myapp D/n0: Received line from client: USER ftp 2020-09-26 14:20:27.996 27712-28599/myapp E/k0: FtpCmd subclass lacks expected constructor

srdrsvml1986 avatar Sep 26 '20 11:09 srdrsvml1986

That is a strange error. I'm not seeing any errors like this. Do you also get this behavior with the build from the play store of f-droid (free app)?

ppareit avatar Sep 26 '20 12:09 ppareit

constructor = cmdClasses[i].getCommand().getConstructor( SessionThread.class, String.class); this is in file FtpCMD.java and another try: cmdClasses[i].getCommand().getConstructors().length to result equal Zero so, no Constructors. but all class below as:

public class CmdUSER extends FtpCmd implements Runnable { private static final String TAG = CmdUSER.class.getSimpleName();

protected String input;

public CmdUSER(SessionThread sessionThread, String input) {
    super(sessionThread);
    this.input = input;
    Log.e(TAG, "input: "+input);

}

srdrsvml1986 avatar Sep 26 '20 14:09 srdrsvml1986

Signed build only. Caused by proguard minify messing with the Cmd*** class constructors. To keep it enabled would need a choice below:

1. eg go into CmdUSER class and add @Keep on the constructor. Plus same for all classes.

2. proguard-rules.pro: Use a wildcard one for all
  -keep public class be.ppareit.swiftp.server.* {
    public <init>(...);
  }

3. proguard-rules.pro: Add specific one for each class eg
-keepclassmembers,allowobfuscation @be.ppareit.swiftp.server.CmdUSER class * {
    public <init>(...);
  }

4. Perhaps there's another proguard variation or whatever.

All 3 tested as working. Personally, I like 1 or 2 only. 3 would be quite a bit of stuff.

Needs a pull request.

Xavron avatar Jan 27 '24 13:01 Xavron

Can be closed. Pull Request created: https://github.com/ppareit/swiftp/pull/221

Xavron avatar Jan 30 '24 15:01 Xavron