OpenSSH uses a link to take a backup while replacing the known_hosts
file:
(1) link known_hosts to known_hosts.old
(2) move new file to known_hosts (overwriting the link there)
Since links are not allowed we replace link with rename:
(1) rename known_hosts to known_hosts.old
(2) move new file to known_hosts
This means that there is a window between (1) and (2) where the
known_hosts file is not available, but that is a really short window
and is hopefully acceptable here.
Fixes#2909.
many distributions use "AcceptEnv LANG LC_*" by default for sshd. this
fixes UTF-8 output from such servers that do not happen to set LANG or
LC_CTYPE to UTF-8 by default server-side (termux env already sets
LANG=en_US.UTF-8)
Since password auth is disabled by default, we depend on keys in our home dir but they're not created for us and the perms are wrong by default. This commit sets it up correctly for the user to simply add their key to the empty authorized_keys file
32-bit android uses 32-bit off_t by default. When building with
-D_FILE_OFFSET_BITS=64 with unified headers off_t are promoted
to 64-bit, but there are bugs in the toolchain and spotty support
for it in the platform (not all functions are available until
android-24, and the platform zlib is compiled with 32-bit off_t).
Also, unless every library&program is rebuilt with 64-bit off_t,
including user-built ones, we risk a mismatch between programs and
libraries which can cause serious (but sometimes subtle) runtime
failures.
As -D_FILE_OFFSET_BITS=64 is not that important for most users
(with mariadb requiring it as an exception), we drop the support
for now by patching it away in <sys/cdefs.h>.
- Put everything into shell functions.
- Start fixing shellcheck warnings.
- Run a hostbuild before setting up an android toolchain (fixes#657).
It was quite a hasty rewrite, so things could be broken. Let me know!
The previous patched session.c just took the existing environment
and kept it. The new copies over a few specific variables needed
but otherwise does the normal setup.
Fixes#341 (TERM being ignored).
Fixes#290 (SSH_CONNECTION/SSH_CLIENT/SSH_TTY not setup).
Fixes https://github.com/termux/termux-app/issues/108 (SSH agent
forwarding not working).
The ControlMaster feature for multiplexing used hard links, which
does not work on Android starting in Android 6.0. Replace this
with a non-atomic check-then-rename for now. Fixes#91.