Ticket #3937 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

mc crashes right after it tries to open an SFTP link

Reported by: szotsaki Owned by: andrew_b
Priority: major Milestone: 4.8.22
Component: mc-vfs Version: 4.8.21
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

When I try to open an SFTP connection to a specific address (root@192.168.1.21) mc crashes immediately.

I start mc with "mc -d" all the time.

Version info:

GNU Midnight Commander 4.8.21
Built with GLib 2.56.1
Using the S-Lang library with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, smbfs
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

GDB tells this:

#0  __strstr_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strstr-sse2-unaligned.S:40
#1  0x00005555556179d0 in sftpfs_recognize_auth_types (super=0x555555801ba0, super=0x555555801ba0) at connection.c:181
#2  sftpfs_open_connection (super=super@entry=0x555555801ba0, mcerror=mcerror@entry=0x7fffffffd890) at connection.c:474
#3  0x000055555560d9af in sftpfs_cb_open_connection (super=0x555555801ba0, vpath=<optimized out>, vpath_element=0x5555557fcc70) at vfs_subclass.c:124
#4  0x00005555555c6fd2 in vfs_s_get_path (vpath=vpath@entry=0x5555557f8660, archive=archive@entry=0x7fffffffd910, flags=flags@entry=0) at direntry.c:1157
#5  0x00005555555c744a in vfs_s_inode_from_path (vpath=vpath@entry=0x5555557f8660, flags=flags@entry=5) at direntry.c:378
#6  0x00005555555c7653 in vfs_s_opendir (vpath=0x5555557f8660) at direntry.c:408
#7  0x00005555555c76b9 in vfs_s_chdir (vpath=<optimized out>) at direntry.c:475
#8  0x0000555555591157 in mc_chdir (vpath=vpath@entry=0x55555580ab50) at interface.c:703
#9  0x000055555559e784 in _do_panel_cd (panel=0x5555557ebcb0, new_dir_vpath=0x55555580ab50, cd_type=<optimized out>) at panel.c:3289
#10 0x000055555559f4bd in do_panel_cd (panel=0x5555557ebcb0, new_dir_vpath=new_dir_vpath@entry=0x55555580ab50, cd_type=cd_type@entry=cd_parse_command) at panel.c:4614
#11 0x00005555555fa0b8 in nice_cd (text=<optimized out>, xtext=0x7ffff7fe1082 "Gépnév (részletek: F1 billentyű):", help=help@entry=0x555555641d38 "[SFTP (SSH File Transfer Protocol) filesystem]", 
    history_name=history_name@entry=0x555555641d18 ":sftplink_cmd: SFTP to machine ", prefix=prefix@entry=0x555555641b54 "sftp://", to_home=1, strip_password=1) at cmd.c:463
#12 0x00005555555fbe7b in sftplink_cmd () at cmd.c:1335
#13 0x000055555559a025 in midnight_execute_cmd (sender=0x5555557c6970, command=122) at midnight.c:1223
#14 0x00005555555cbefd in send_message (data=0x0, parm=<optimized out>, msg=MSG_ACTION, sender=0x5555557c6970, w=<optimized out>) at ../../lib/widget/widget-common.h:210
#15 menubar_execute (menubar=0x5555557c6970) at menu.c:345
#16 0x00005555555cca2d in menubar_handle_key (key=<optimized out>, menubar=0x5555557c6970) at menu.c:543
#17 menubar_callback (w=0x5555557c6970, sender=<optimized out>, msg=<optimized out>, parm=<optimized out>, data=<optimized out>) at menu.c:627
#18 0x000055555558272b in send_message (data=0x0, parm=10, msg=MSG_HOTKEY, sender=0x0, w=0x5555557c6970) at ../../lib/widget/widget-common.h:210
#19 dlg_try_hotkey (h=0x5555557d4840, h=0x5555557d4840, d_key=10) at dialog.c:419
#20 dlg_key_event (d_key=10, h=0x5555557d4840) at dialog.c:479
#21 dlg_process_event (h=0x5555557d4840, key=10, event=<optimized out>) at dialog.c:1168
#22 0x0000555555582911 in frontend_dlg_run (h=0x5555557d4840) at dialog.c:541
#23 dlg_run (h=0x5555557d4840) at dialog.c:1199
#24 0x000055555559b7ec in do_nc () at midnight.c:1791
#25 0x000055555557673b in main (argc=<optimized out>, argv=<optimized out>) at main.c:409

Full backtrace:

#0  __strstr_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strstr-sse2-unaligned.S:40
No locals.
#1  0x00005555556179d0 in sftpfs_recognize_auth_types (super=0x555555801ba0, super=0x555555801ba0) at connection.c:181
        userauthlist = 0x0
        super_data = 0x5555556f3fb0
        userauthlist = <optimized out>
        super_data = <optimized out>
#2  sftpfs_open_connection (super=super@entry=0x555555801ba0, mcerror=mcerror@entry=0x7fffffffd890) at connection.c:474
        rc = 0
        super_data = 0x5555556f3fb0
#3  0x000055555560d9af in sftpfs_cb_open_connection (super=0x555555801ba0, vpath=<optimized out>, vpath_element=0x5555557fcc70) at vfs_subclass.c:124
        mcerror = 0x0
        sftpfs_super_data = <optimized out>
        ret_value = 21845
#4  0x00005555555c6fd2 in vfs_s_get_path (vpath=vpath@entry=0x5555557f8660, archive=archive@entry=0x7fffffffd910, flags=flags@entry=0) at direntry.c:1157
        vpath_archive = 0x5555557fb460
        retval = 0x55555580b010 ""
        result = -1
        super = 0x555555801ba0
        path_element = 0x5555557fcc70
        subclass = 0x5555556b9560 <sftpfs_subclass>
#5  0x00005555555c744a in vfs_s_inode_from_path (vpath=vpath@entry=0x5555557f8660, flags=flags@entry=5) at direntry.c:378
        super = 0x555555801040
        ino = <optimized out>
        q = <optimized out>
        path_element = <optimized out>
#6  0x00005555555c7653 in vfs_s_opendir (vpath=0x5555557f8660) at direntry.c:408
        dir = <optimized out>
        info = <optimized out>
        path_element = 0x5555557fcc70
#7  0x00005555555c76b9 in vfs_s_chdir (vpath=<optimized out>) at direntry.c:475
        data = <optimized out>
#8  0x0000555555591157 in mc_chdir (vpath=vpath@entry=0x55555580ab50) at interface.c:703
        old_vfs = <optimized out>
        old_vfsid = <optimized out>
        result = <optimized out>
        path_element = 0x5555557fcc70
        cd_vpath = 0x5555557f8660
#9  0x000055555559e784 in _do_panel_cd (panel=0x5555557ebcb0, new_dir_vpath=0x55555580ab50, cd_type=<optimized out>) at panel.c:3289
        olddir_vpath = <optimized out>
        element = <optimized out>
#10 0x000055555559f4bd in do_panel_cd (panel=0x5555557ebcb0, new_dir_vpath=new_dir_vpath@entry=0x55555580ab50, cd_type=cd_type@entry=cd_parse_command) at panel.c:4614
        r = <optimized out>
#11 0x00005555555fa0b8 in nice_cd (text=<optimized out>, xtext=0x7ffff7fe1082 "Gépnév (részletek: F1 billentyű):", help=help@entry=0x555555641d38 "[SFTP (SSH File Transfer Protocol) filesystem]", 
    history_name=history_name@entry=0x555555641d18 ":sftplink_cmd: SFTP to machine ", prefix=prefix@entry=0x555555641b54 "sftp://", to_home=1, strip_password=1) at cmd.c:463
        cd_vpath = 0x55555580ab50
        machine = <optimized out>
        cd_path = 0x5555558088f0 "/sftp://root@192.168.1.21"
        history_name = 0x555555641d18 ":sftplink_cmd: SFTP to machine "
        machine = <optimized out>
        prefix = 0x555555641b54 "sftp://"
        help = 0x555555641d38 "[SFTP (SSH File Transfer Protocol) filesystem]"
        text = <optimized out>
        cd_path = <optimized out>
        tmp = <optimized out>
        to_home = <optimized out>
        xtext = 0x7ffff7fe1082 "Gépnév (részletek: F1 billentyű):"
        cd_vpath = <optimized out>
        machine = <optimized out>
        cd_path = <optimized out>
        tmp = <optimized out>
        cd_vpath = <optimized out>
#12 0x00005555555fbe7b in sftplink_cmd () at cmd.c:1335
No locals.
#13 0x000055555559a025 in midnight_execute_cmd (sender=0x5555557c6970, command=122) at midnight.c:1223
        res = MSG_HANDLED
#14 0x00005555555cbefd in send_message (data=0x0, parm=<optimized out>, msg=MSG_ACTION, sender=0x5555557c6970, w=<optimized out>) at ../../lib/widget/widget-common.h:210
        ret = MSG_NOT_HANDLED
        ret = <optimized out>
#15 menubar_execute (menubar=0x5555557c6970) at menu.c:345
        w = 0x5555557c6970
        menu = <optimized out>
        entry = 0x5555557ca810
#16 0x00005555555cca2d in menubar_handle_key (key=<optimized out>, menubar=0x5555557c6970) at menu.c:543
        menu = 0x5555557eb620
        i = <optimized out>
#17 menubar_callback (w=0x5555557c6970, sender=<optimized out>, msg=<optimized out>, parm=<optimized out>, data=<optimized out>) at menu.c:627
        menubar = 0x5555557c6970
#18 0x000055555558272b in send_message (data=0x0, parm=10, msg=MSG_HOTKEY, sender=0x0, w=0x5555557c6970) at ../../lib/widget/widget-common.h:210
        ret = MSG_NOT_HANDLED
        ret = <optimized out>
#19 dlg_try_hotkey (h=0x5555557d4840, h=0x5555557d4840, d_key=10) at dialog.c:419
        hot_cur = <optimized out>
        current = 0x5555557c6970
        handled = MSG_NOT_HANDLED
        c = <optimized out>
        hot_cur = <optimized out>
        current = <optimized out>
        handled = <optimized out>
        c = <optimized out>
#20 dlg_key_event (d_key=10, h=0x5555557d4840) at dialog.c:479
        handled = <optimized out>
        handled = <optimized out>
#21 dlg_process_event (h=0x5555557d4840, key=10, event=<optimized out>) at dialog.c:1168
No locals.
#22 0x0000555555582911 in frontend_dlg_run (h=0x5555557d4840) at dialog.c:541
        d_key = <optimized out>
        wh = 0x5555557d4840
        event = {buttons = 0 '\000', modifiers = 0 '\000', vc = 0, dx = 0, dy = 0, x = -1, y = 21847, type = (GPM_MOVE | GPM_DOWN | GPM_SINGLE | GPM_TRIPLE | GPM_HARD | GPM_LEAVE | unknown: 20480), clicks = 1434279888, 
          margin = (GPM_TOP | GPM_LFT | unknown: 21840), wdx = 3712, wdy = 21864}
        wh = <optimized out>
        event = <optimized out>
        d_key = <optimized out>
#23 dlg_run (h=0x5555557d4840) at dialog.c:1199
No locals.
#24 0x000055555559b7ec in do_nc () at midnight.c:1791
        ret = <optimized out>
#25 0x000055555557673b in main (argc=<optimized out>, argv=<optimized out>) at main.c:409
        mcerror = 0x0
        config_migrated = <optimized out>
        config_migrate_msg = 0x0
        exit_code = 1

Change History

comment:1 Changed 6 years ago by andrew_b

Looks like libssh2_userauth_list returns NULL in this case.
Would you please put here the output of

ssh -v -l root 192.168.1.21

comment:2 Changed 6 years ago by szotsaki

Yes, of course:

In ~/.ssh/config:

Host 192.168.1.21
        StrictHostKeyChecking no
OpenSSH_7.7p1, OpenSSL 1.1.0h-fips  27 Mar 2018
debug1: Reading configuration data /home/aki/.ssh/config
debug1: /home/aki/.ssh/config line 3: Applying options for 192.168.1.21
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 25: Applying options for *
debug1: Connecting to 192.168.1.21 [192.168.1.21] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/aki/.ssh/id_ed25519 type 3
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/aki/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.21:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:VbYdpepW6ni/pK49c6C8H/S0cBbpByGX7q7Xz0vYljg
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:VbYdpepW6ni/pK49c6C8H/S0cBbpByGX7q7Xz0vYljg.
Please contact your system administrator.
Add correct host key in /home/aki/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/aki/.ssh/known_hosts:2
You can use following command to remove the offending key:
ssh-keygen -R 192.168.1.21 -f /home/aki/.ssh/known_hosts
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentication succeeded (none).
Authenticated to 192.168.1.21 ([192.168.1.21]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LC_ALL = hu_HU.UTF-8
debug1: Sending env LANG = en_GB.UTF-8

comment:3 Changed 6 years ago by andrew_b

  • Status changed from new to accepted
  • Owner set to andrew_b
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.22

Branch: 3937_sftp_auth_crash
changeset:6536ed92e3e139faa7aeb31294699a893d76dde4

Please test.

comment:4 follow-up: ↓ 5 Changed 6 years ago by szotsaki

I cloned the repository from GitHub? which is claimed to be the official one in "Home" menu but unfortunately, the last commit there is 22 days old and doesn't contain the above mentioned one.

Could you please set-up the sync between GitHub? and this other repo you linked?

Thank you!

comment:5 in reply to: ↑ 4 Changed 6 years ago by andrew_b

Replying to szotsaki:

Could you please set-up the sync between GitHub? and this other repo you linked?

The fix is in the separate branch not in master:
git checkout 3937_sftp_auth_crash

comment:6 Changed 6 years ago by andrew_b

So?

comment:7 Changed 6 years ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:8 Changed 6 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:9 Changed 6 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.