wolpi / prim-ftpd

FTP server app for android
Other
583 stars 78 forks source link

Tab expansion breaks connection in read-only SAF mode #283

Open castilma opened 1 year ago

castilma commented 1 year ago

Set prim-ftpd to read-only SAF mode and login:

Connected to s8.
sftp> ls  <TAB>
# the output is changed to
Connected to s8.
Connection closed.  
Connection closed
mcd@T500: ~
[255]$  # typing here does not show any characters. something is wrong with the terminal. sftp probably didn't exit cleanly.

Typing TAB breaks something.

$ sftp -v s8
OpenSSH_9.1p1, OpenSSL 1.1.1q  5 Jul 2022
debug1: Reading configuration data /home/mcd/.ssh/config
debug1: /home/mcd/.ssh/config line 9: Applying options for s8
debug1: /home/mcd/.ssh/config line 49: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: auto-mux: Trying existing master
debug1: Control socket "/tmp/ssh_mux_192.168.178.98_1234_mcd" does not exist
debug1: Connecting to 192.168.178.98 [192.168.178.98] port 1234.
debug1: Connection established.
debug1: identity file /home/mcd/.ssh/t2s8new type 3
debug1: identity file /home/mcd/.ssh/t2s8new-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.1
debug1: Remote protocol version 2.0, remote software version ${POM.ARTIFACTID}-${POM.VERSION}
debug1: compat_banner: no match: ${POM.ARTIFACTID}-${POM.VERSION}
debug1: Authenticating to 192.168.178.98:1234 as 'mcd'
debug1: load_hostkeys: fopen /home/mcd/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:YXGPy6x88H4OkI/hKRROKmDqmJC4D/WDHhrXyyCatKU
debug1: load_hostkeys: fopen /home/mcd/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '[192.168.178.98]:1234' is known and matches the ED25519 host key.
debug1: Found key in /home/mcd/.ssh/known_hosts:29
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /home/mcd/.ssh/t2s8new ED25519 SHA256:87b1x6GU1onTcOkumkKvP4svRY9jgpm/Hh+uc8BaMLk explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password,keyboard-interactive,publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/mcd/.ssh/t2s8new ED25519 SHA256:87b1x6GU1onTcOkumkKvP4svRY9jgpm/Hh+uc8BaMLk explicit
debug1: Server accepts key: /home/mcd/.ssh/t2s8new ED25519 SHA256:87b1x6GU1onTcOkumkKvP4svRY9jgpm/Hh+uc8BaMLk explicit
Authenticated to 192.168.178.98 ([192.168.178.98]:1234) using "publickey".
debug1: setting up multiplex master socket
debug1: channel 0: new [/tmp/ssh_mux_192.168.178.98_1234_mcd]
debug1: channel 1: new [client-session]
debug1: Entering interactive session.
debug1: pledge: id
debug1: Sending subsystem: sftp
Connected to s8.
sftp> ls debug1: client_input_channel_req: channel 1 rtype exit-status reply 0
debug1: channel 1: free: client-session, nchannels 2
debug1: channel 0: free: /tmp/ssh_mux_192.168.178.98_1234_mcd, nchannels 1
Transferred: sent 2272, received 1512 bytes, in 2.0 seconds
Bytes per second: sent 1134.1, received 754.8
debug1: Exit status 0
Connection closed.  
Connection closed

here is the logfile. using primftp 6.14. prim-ftpd-log-2022-10-21-21-04-14.csv

wolpi commented 1 year ago

Well, there are issues with SAF API. It does not work as documented 🤷