Commit Graph

6176 Commits

Author SHA1 Message Date
Andreas Mohr
2087ede32d (file_mask_dialog): NULLify variables before use in next iteration.
Found by Coverity.
Coverity id #331828
Coverity id #331850

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:27 +03:00
Andrew Borodin
9f53bf5617 Include <stddef.h> where ptrdiff_t is used.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andrew Borodin
2c205c5928 Update copyright years.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:26 +03:00
Andreas Mohr
9489b5edc4 Remove unused macros.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
ca24b1d136 (ftpfs_check_proxy): read mc.no_proxy file once only.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
d07abec4c3 (swap_panels): swap panel sort modes too.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-13 13:17:23 +03:00
Andrew Borodin
d8b9589224 Ticket #4326: iso9660: fix isoinfo check.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-01-09 18:17:24 +03:00
Andrew Borodin
529c7d70dd src/editor/editwidget.c: grammar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
19591c4475 mceditor: use MB_LEN_MAX constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
a147082c73 (string_file_name): use mc_g_string_copy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
4e8b00f003 Use g_get_monotonic_time() instead of g_get_real_time().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
31008bcc8e (learn_key): return NULL if buffer is empty.
(learn_button): simplify tests: seq is never empty here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
a4adc09509 (file_mask_dialog): indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
eefc7c1275 (copy_file_file_display_progress): rename argument to make it clearer.
(copy_file_file): rename variable to make it clearer.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
e8e3204e61 (copy_file_file): don't call g_get_real_time() twice...
in case of successful copying of file content.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
bb1ab8488b (copy_file_file_display_progress): don't calculate BPS twice.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
78df2f5b56 (progress_update_one): don't call g_get_real_time() twice at first time.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
437211791f file operations: use g_get_real_time() instead of gettimeofday().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
d04abc5a76 sftpfs: refactoring.
Merge init.c, vfs_class.c, and vfs_subclass.c to sftpfs.c.
Rename files:
    init.h -> sftpfs.h.
Rename variables:
    sftpfs_class -> vfs_sftpfs_class.
Rename functions:
    sftpfs_cb_is_equal_connection -> sftpfs_archive_same
    sftpfs_cb_init_connection -> sftpfs_new_archive
    sftpfs_cb_open_connection -> sftpfs_open_archive
    sftpfs_cb_close_connection ->  sftpfs_free_archive
to be consistent with other VFSes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
4fce4fa7c3 sftpfs: trivial optimization.
* (sftpfs_opendir): call sftpfs_fix_filename() before loop.
  * (sftpfs_mkdir): likewise.
  * (sftpfs_rmdir): likewise.
  * (sftpfs_open_file): likewise.
  * (sftpfs_stat_init): likewise.
  * (sftpfs_readlink): likewise.
  * (sftpfs_utime): likewise.
  * (sftpfs_chmod): likewise.
  * (sftpfs_unlink): likewise.
  * (sftpfs_rename): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
6623a9014f (panel_operate): update panel content before screen refresh.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:33 +03:00
Andrew Borodin
022c3d2f94 Refactoring of file operations.
(copy_cmd, copy_cmd_local, rename_cmd, rename_cmd_local, delete_cmd,
delete_cmd_local): move same code to panel_operate(), make inline.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
d410af27c0 (start_search): ret rid of extra screen redraw.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
cac689a81a Get rid of extra update of mini info.
(stop_search): don't update mini info if quick search is incative.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
d19b247c6d Ticket #4384: fix accelerator conflict in Left/Right menu.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:57:43 +03:00
Andrew Borodin
a3d323c6b3 Ticket #3887: (handle_console_linux): fix endianness bug.
handle_console_linux() passes the address of action to write() and intends
to send one byte of data (the LSB). On LE this works, but one BE machines
this sends the MSB which is always zero. Fix this by assigning the value
first to a char type, and use that instead.

Thanks Sven Schnelle <svens@stackframe.org> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 14:49:46 +03:00
Andrew Borodin
f1e2f0e93d Ticket #4150: support file/dir macros for standalone mcviewer.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-10-31 09:49:45 +03:00
Andrew Borodin
8b79bfe32d (free_erase_list): test queue before free.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-10-02 11:41:07 +03:00
Andrew Borodin
89d8fa4ac1 Ticket #1: remove SMB suport.
The mc's built-in samba library which is used to access data across
smb links is taken from an old samba version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-26 10:03:49 +03:00
Andrew Borodin
c3ba19b422 (sftpfs_chmod): set permissions only, don't touch other attributes.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 20:34:21 +03:00
Andrew Borodin
8e5f8255e1 Ticket #4285: sftp: timestamps are not preserved for uploaded symlink.
* (sftpfs_symlink): don't call sftpfs_fix_filename() for target file
    bacause it breaks symlink: relative symlinks became an absolute one.
  * (sftpfs_utime): set timestamps only, don't touch other attributes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 20:24:30 +03:00
Andrew Borodin
399f25fe9f Ticket #4281: fish upload: symbolic link along with its target.
fish/utime: use `touch -h` to change the times of the link itself
rather than the file that the link points to. -h implies -c
and thus will not create any new files.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-11 09:37:55 +03:00
Andrew Borodin
1b39025049 Ticket #4287: file move across filesystems is slow.
src/filemanager/file.c: reimplement erase_list using GQueue instead of
GSlist to get rid of walk each time through the whole linked list.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-05 11:39:42 +03:00
Andrew Borodin
e7bbf72544 Ticket #4200: fix FTBFS with ncurses build with --disable-widec.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-28 11:46:53 +03:00
Sergey Larin
2234fd8357 Ticket #4269: (edit_close_cmd): fix use-after-free.
The old 'w' pointer became invalid after widget_destroy() call, so we need
to get the new widget directly after find_editor.

Found using PVS-Studio 7.14 with intermodular analysis mode.

Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-09 21:29:23 +03:00
Andrew Borodin
9235d3c232 SFTPFS: verify server fingerprint (fix CVE-2021-36370).
Use ~/.ssh/known_hosts file to verify server fingerprint
using ssh way:

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:FzqKTNTroFuNUj1wUzSeV2x/1lpcESnT0ZRCmq5H6o8.
Are you sure you want to continue connecting (yes/no)? no
ssh: Host key verification failed.

$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ED25519 key fingerprint is SHA256:FzqKTNTroFuNUj1wUzSeV2x/1lpcESnT0ZRCmq5H6o8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ED25519) to the list of known hosts.
andrew@localhost's password:

Thanks the Curl project for the used code.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Yury V. Zaytsev <yury.zaytsev@moneymeets.com>
2021-07-26 20:34:17 +03:00
Andrew Borodin
fdd6706245 (sftpfs_open_connection): handle EAGAIN for libssh2_session_handshake().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-26 20:34:17 +03:00
Andrew Borodin
b0450a1e18 Ticket #4259: SFTPFS VFS: verify server fingerprint (CVE-2021-36370).
This vulnerability was discovered by AUT-milCERT during an audit of open
source software.

Initial changeset: set minimal version of libssh2 to 1.2.8.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-26 20:33:48 +03:00
m_ok
36e48b04bd Ticket #4260: ftpfs: the month of file is always January.
(parse_ls_line): fix test of vfs_parse_month() value.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-13 21:32:35 +03:00
Eric Roberts
e89713a3d6 Ticket #4198: MC hangs on start randomly with zsh as subshell.
The bug happens because MC tells the shell to perform a "cd" command,
and waits indefinitely for the command to complete. If the shell, for
some reason, cannot complete the "cd" command, MC just freezes
indefinitely.

This patch removes all instances of MC waiting indefinitely for "cd"
commands. Now, if the shell freezes while doing a "cd", MC will timeout
after 1 second, and just set the subshell state to ACTIVE. If the user
tries to run a command, they will get the error "The shell is already
running a command".

Some other stuff where MC waits on the shell if an error occurred is
also simplified.

In feed_subshell(), the timeout time is changed from 10 seconds to
1 second. Ten seconds seemed like far too long to wait.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-04 19:06:28 +03:00
Andrew Borodin
0e6721c32b Ticket #4213: workaround to avoid crash on FreeBSD.
Previous fix 443a8106f1
makes the command line inaccessible if mc runs with
disabled subshell (mc -u).

This commit fixes the command line.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-07-03 18:59:38 +03:00
Andrew Borodin
7ef1925a98 (render_edit_text): fix endless loop.
Thanks Sebastian Gniazdowski <sgniazdowski@gmail.com> for the issue.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-27 15:02:49 +03:00
Andrew Borodin
eb58d94341 src/filemanager/mountlist.c: recognize fuse.portal as dummy file system.
Sync with gnulib 9a38d499ca16f2f4304992eb1ab0894cd0b478e1.

Add "fuse.portal" as a dummy file system (used in flatpak
implementations).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:46 +03:00
Andrew Borodin
25e419ba08 (check_dir_is_empty): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
437994eb80 (do_move_dir_dir): remove unused variable.
Variable calc_total is set but isn't read.

Found by Andreas Mohr <and@gmx.li>.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
106d95229f (sftpfs_open_file): don't destroy file handler here.
Fix Coverity id #331814.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
10c27b28a7 (load_group): fix use after free.
Found by Coverity.
Coverity id #331812.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
c15b752fbf (exec_extension): fix memory leak.
Found by Coverity.
Coverity id #331829.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andreas Mohr
4db80f3010 (dir_list_reload): fix resource leak.
Found by Coverity.
Coverity id #331809.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00
Andrew Borodin
5b7b48e1db mcedit: move macros-related stuff to editmacros.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-06-20 16:16:45 +03:00