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!