Browse Source
Reorganize patches & do following changes: * Enable use of sethostname(2) in utility `hostname`. * Enable setting time in utility `date` - busybox already provide own implementation of stime(2). - both features require root.emacs-27
Leonid Plyushch
5 years ago
29 changed files with 259 additions and 343 deletions
@ -0,0 +1,12 @@ |
|||||
|
diff -uNr busybox-1.31.1/Makefile busybox-1.31.1.mod/Makefile
|
||||
|
--- busybox-1.31.1/Makefile 2019-10-25 11:44:52.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/Makefile 2019-11-11 22:19:06.004778909 +0200
|
||||
|
@@ -289,7 +289,7 @@
|
||||
|
# Make variables (CC, etc...) |
||||
|
|
||||
|
AS = $(CROSS_COMPILE)as |
||||
|
-CC = $(CROSS_COMPILE)gcc
|
||||
|
+CC = $(CROSS_COMPILE)clang
|
||||
|
LD = $(CC) -nostdlib |
||||
|
CPP = $(CC) -E |
||||
|
AR = $(CROSS_COMPILE)ar |
@ -0,0 +1,85 @@ |
|||||
|
diff -uNr busybox-1.31.1/coreutils/mktemp.c busybox-1.31.1.mod/coreutils/mktemp.c
|
||||
|
--- busybox-1.31.1/coreutils/mktemp.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/coreutils/mktemp.c 2019-11-11 21:46:00.848464330 +0200
|
||||
|
@@ -50,7 +50,7 @@
|
||||
|
//usage: "\n -p DIR Use DIR as a base directory (implies -t)" |
||||
|
//usage: "\n -u Do not create anything; print a name" |
||||
|
//usage: "\n" |
||||
|
-//usage: "\nBase directory is: -p DIR, else $TMPDIR, else /tmp"
|
||||
|
+//usage: "\nBase directory is: -p DIR, else $TMPDIR, else @TERMUX_PREFIX@/tmp"
|
||||
|
//usage: |
||||
|
//usage:#define mktemp_example_usage |
||||
|
//usage: "$ mktemp /tmp/temp.XXXXXX\n" |
||||
|
@@ -76,7 +76,7 @@
|
||||
|
|
||||
|
path = getenv("TMPDIR"); |
||||
|
if (!path || path[0] == '\0') |
||||
|
- path = "/tmp";
|
||||
|
+ path = "@TERMUX_PREFIX@/tmp";
|
||||
|
|
||||
|
opts = getopt32(argv, "^" "dqtp:u" "\0" "?1"/*1 arg max*/, &path); |
||||
|
|
||||
|
diff -uNr busybox-1.31.1/editors/diff.c busybox-1.31.1.mod/editors/diff.c
|
||||
|
--- busybox-1.31.1/editors/diff.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/editors/diff.c 2019-11-11 21:46:33.625316185 +0200
|
||||
|
@@ -730,7 +730,7 @@
|
||||
|
* When we meet non-seekable file, we must make a temp copy. |
||||
|
*/ |
||||
|
if (lseek(fd, 0, SEEK_SET) == -1 && errno == ESPIPE) { |
||||
|
- char name[] = "/tmp/difXXXXXX";
|
||||
|
+ char name[] = "@TERMUX_PREFIX@/tmp/difXXXXXX";
|
||||
|
int fd_tmp = xmkstemp(name); |
||||
|
|
||||
|
unlink(name); |
||||
|
diff -uNr busybox-1.31.1/include/libbb.h busybox-1.31.1.mod/include/libbb.h
|
||||
|
--- busybox-1.31.1/include/libbb.h 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/include/libbb.h 2019-11-11 21:55:22.141411848 +0200
|
||||
|
@@ -2126,12 +2126,12 @@
|
||||
|
* use bb_default_login_shell and following defines. |
||||
|
* If you change LIBBB_DEFAULT_LOGIN_SHELL, |
||||
|
* don't forget to change increment constant. */ |
||||
|
-#define LIBBB_DEFAULT_LOGIN_SHELL "-/bin/sh"
|
||||
|
+#define LIBBB_DEFAULT_LOGIN_SHELL "-@TERMUX_PREFIX@/bin/sh"
|
||||
|
extern const char bb_default_login_shell[] ALIGN1; |
||||
|
-/* "/bin/sh" */
|
||||
|
+/* "@TERMUX_PREFIX@/bin/sh" */
|
||||
|
#define DEFAULT_SHELL (bb_default_login_shell+1) |
||||
|
/* "sh" */ |
||||
|
-#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6)
|
||||
|
+#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+1+sizeof("@TERMUX_PREFIX@/bin"))
|
||||
|
|
||||
|
/* The following devices are the same on all systems. */ |
||||
|
#define CURRENT_TTY "/dev/tty" |
||||
|
diff -uNr busybox-1.31.1/networking/telnetd.c busybox-1.31.1.mod/networking/telnetd.c
|
||||
|
--- busybox-1.31.1/networking/telnetd.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/networking/telnetd.c 2019-11-11 22:00:22.799539737 +0200
|
||||
|
@@ -99,7 +99,7 @@
|
||||
|
//usage: "Handle incoming telnet connections" |
||||
|
//usage: IF_NOT_FEATURE_TELNETD_STANDALONE(" via inetd") "\n" |
||||
|
//usage: "\n -l LOGIN Exec LOGIN on connect" |
||||
|
-//usage: "\n -f ISSUE_FILE Display ISSUE_FILE instead of /etc/issue"
|
||||
|
+//usage: "\n -f ISSUE_FILE Display ISSUE_FILE instead of @TERMUX_PREFIX@/etc/issue.net"
|
||||
|
//usage: "\n -K Close connection as soon as login exits" |
||||
|
//usage: "\n (normally wait until all programs close slave pty)" |
||||
|
//usage: IF_FEATURE_TELNETD_STANDALONE( |
||||
|
@@ -160,7 +160,7 @@
|
||||
|
#define INIT_G() do { \ |
||||
|
setup_common_bufsiz(); \ |
||||
|
G.loginpath = "/bin/login"; \ |
||||
|
- G.issuefile = "/etc/issue.net"; \
|
||||
|
+ G.issuefile = "@TERMUX_PREFIX@/etc/issue.net"; \
|
||||
|
} while (0) |
||||
|
|
||||
|
|
||||
|
diff -uNr busybox-1.31.1/util-linux/setarch.c busybox-1.31.1.mod/util-linux/setarch.c
|
||||
|
--- busybox-1.31.1/util-linux/setarch.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/util-linux/setarch.c 2019-11-11 21:56:31.521753610 +0200
|
||||
|
@@ -98,7 +98,7 @@
|
||||
|
|
||||
|
argv += optind; |
||||
|
if (!argv[0]) |
||||
|
- (--argv)[0] = (char*)"/bin/sh";
|
||||
|
+ (--argv)[0] = (char*)"@TERMUX_PREFIX@/bin/sh";
|
||||
|
|
||||
|
/* Try to execute the program */ |
||||
|
BB_EXECVP_or_die(argv); |
@ -0,0 +1,14 @@ |
|||||
|
diff -uNr busybox-1.31.1/include/platform.h busybox-1.31.1.mod/include/platform.h
|
||||
|
--- busybox-1.31.1/include/platform.h 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/include/platform.h 2019-11-12 02:43:11.833640516 +0200
|
||||
|
@@ -526,7 +526,9 @@
|
||||
|
# undef HAVE_STPCPY |
||||
|
# endif |
||||
|
# undef HAVE_MEMPCPY |
||||
|
-# undef HAVE_STRCHRNUL
|
||||
|
+# if __ANDROID_API__ < 24
|
||||
|
+# undef HAVE_STRCHRNUL
|
||||
|
+# endif
|
||||
|
# undef HAVE_STRVERSCMP |
||||
|
# undef HAVE_UNLOCKED_LINE_OPS |
||||
|
# undef HAVE_NET_ETHERNET_H |
@ -0,0 +1,38 @@ |
|||||
|
diff -uNr busybox-1.31.1/libbb/missing_syscalls.c busybox-1.31.1.mod/libbb/missing_syscalls.c
|
||||
|
--- busybox-1.31.1/libbb/missing_syscalls.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/libbb/missing_syscalls.c 2019-11-11 22:56:16.433805825 +0200
|
||||
|
@@ -10,10 +10,13 @@
|
||||
|
#if defined(ANDROID) || defined(__ANDROID__) |
||||
|
/*# include <linux/timex.h> - for struct timex, but may collide with <time.h> */ |
||||
|
# include <sys/syscall.h> |
||||
|
+
|
||||
|
+#if __ANDROID_API__ < 17
|
||||
|
pid_t getsid(pid_t pid) |
||||
|
{ |
||||
|
return syscall(__NR_getsid, pid); |
||||
|
} |
||||
|
+#endif
|
||||
|
|
||||
|
int stime(const time_t *t) |
||||
|
{ |
||||
|
@@ -23,16 +26,20 @@
|
||||
|
return settimeofday(&tv, NULL); |
||||
|
} |
||||
|
|
||||
|
+#if __ANDROID_API__ < 23
|
||||
|
int sethostname(const char *name, size_t len) |
||||
|
{ |
||||
|
return syscall(__NR_sethostname, name, len); |
||||
|
} |
||||
|
+#endif
|
||||
|
|
||||
|
+#if __ANDROID_API__ < 24
|
||||
|
struct timex; |
||||
|
int adjtimex(struct timex *buf) |
||||
|
{ |
||||
|
return syscall(__NR_adjtimex, buf); |
||||
|
} |
||||
|
+#endif
|
||||
|
|
||||
|
int pivot_root(const char *new_root, const char *put_old) |
||||
|
{ |
@ -0,0 +1,13 @@ |
|||||
|
diff -uNr busybox-1.31.1/libbb/change_identity.c busybox-1.31.1.mod/libbb/change_identity.c
|
||||
|
--- busybox-1.31.1/libbb/change_identity.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/libbb/change_identity.c 2019-11-11 22:12:18.976233196 +0200
|
||||
|
@@ -32,6 +32,9 @@
|
||||
|
/* Become the user and group(s) specified by PW. */ |
||||
|
void FAST_FUNC change_identity(const struct passwd *pw) |
||||
|
{ |
||||
|
+#ifdef __ANDROID__
|
||||
|
+ return;
|
||||
|
+#endif
|
||||
|
int res; |
||||
|
|
||||
|
res = initgroups(pw->pw_name, pw->pw_gid); |
@ -0,0 +1,15 @@ |
|||||
|
diff -uNr busybox-1.31.1/libbb/pw_encrypt.c busybox-1.31.1.mod/libbb/pw_encrypt.c
|
||||
|
--- busybox-1.31.1/libbb/pw_encrypt.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/libbb/pw_encrypt.c 2019-11-11 22:16:44.990795793 +0200
|
||||
|
@@ -6,7 +6,10 @@
|
||||
|
* |
||||
|
* Licensed under GPLv2 or later, see file LICENSE in this source tree. |
||||
|
*/ |
||||
|
-#include <crypt.h>
|
||||
|
+#if !ENABLE_USE_BB_CRYPT
|
||||
|
+# include <crypt.h>
|
||||
|
+#endif
|
||||
|
+
|
||||
|
#include "libbb.h" |
||||
|
|
||||
|
/* static const uint8_t ascii64[] ALIGN1 = |
@ -0,0 +1,15 @@ |
|||||
|
diff -uNr busybox-1.31.1/networking/ftpd.c busybox-1.31.1.mod/networking/ftpd.c
|
||||
|
--- busybox-1.31.1/networking/ftpd.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/networking/ftpd.c 2019-11-11 22:26:50.216912741 +0200
|
||||
|
@@ -1301,8 +1301,11 @@
|
||||
|
G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY); |
||||
|
close_on_exec_on(G.root_fd); |
||||
|
#endif |
||||
|
+#ifndef __ANDROID__
|
||||
|
+ /* Do not try chroot() on Android because it may trigger seccomp. */
|
||||
|
if (chroot(basedir) == 0) |
||||
|
basedir = "/"; |
||||
|
+#endif
|
||||
|
#if !BB_MMU |
||||
|
else { |
||||
|
close(G.root_fd); |
@ -0,0 +1,12 @@ |
|||||
|
diff -uNr busybox-1.31.1/networking/telnetd.c busybox-1.31.1.mod/networking/telnetd.c
|
||||
|
--- busybox-1.31.1/networking/telnetd.c 2019-11-11 22:00:22.799539737 +0200
|
||||
|
+++ busybox-1.31.1.mod/networking/telnetd.c 2019-11-11 22:32:02.268344626 +0200
|
||||
|
@@ -707,7 +707,7 @@
|
||||
|
} else { |
||||
|
master_fd = 0; |
||||
|
if (!(opt & OPT_WAIT)) { |
||||
|
- unsigned portnbr = 23;
|
||||
|
+ unsigned portnbr = 8023;
|
||||
|
if (opt & OPT_PORT) |
||||
|
portnbr = xatou16(opt_portnbr); |
||||
|
master_fd = create_and_bind_stream_or_die(opt_bindaddr, portnbr); |
@ -0,0 +1,16 @@ |
|||||
|
diff -uNr busybox-1.31.1/networking/tftp.c busybox-1.31.1.mod/networking/tftp.c
|
||||
|
--- busybox-1.31.1/networking/tftp.c 2019-06-10 13:50:53.000000000 +0300
|
||||
|
+++ busybox-1.31.1.mod/networking/tftp.c 2019-11-11 22:36:27.592894669 +0200
|
||||
|
@@ -907,7 +907,12 @@
|
||||
|
G.pw = xgetpwnam(user_opt); |
||||
|
} |
||||
|
if (argv[0]) { |
||||
|
+#ifdef __ANDROID__
|
||||
|
+ // chroot may trigger seccomp and is allowed only for root anyway.
|
||||
|
+ xchdir(argv[0]);
|
||||
|
+#else
|
||||
|
xchroot(argv[0]); |
||||
|
+#endif
|
||||
|
} |
||||
|
|
||||
|
result = recv_from_to(STDIN_FILENO, |
@ -1,16 +0,0 @@ |
|||||
Building with clang causes 'busybox less' to |
|
||||
segfault in INIT_G() on arm, see |
|
||||
https://github.com/termux/termux-packages/issues/1245 |
|
||||
|
|
||||
diff -u -r ../busybox-1.26.2/Makefile ./Makefile
|
|
||||
--- ../busybox-1.26.2/Makefile 2017-01-10 17:01:16.000000000 +0100
|
|
||||
+++ ./Makefile 2017-06-27 23:34:15.465534834 +0200
|
|
||||
@@ -289,7 +289,7 @@
|
|
||||
# Make variables (CC, etc...) |
|
||||
|
|
||||
AS = $(CROSS_COMPILE)as |
|
||||
-CC = $(CROSS_COMPILE)gcc
|
|
||||
+CC ?= $(CROSS_COMPILE)gcc
|
|
||||
LD = $(CC) -nostdlib |
|
||||
CPP = $(CC) -E |
|
||||
AR = $(CROSS_COMPILE)ar |
|
@ -1,20 +0,0 @@ |
|||||
diff -u -r ../busybox-1.26.2/coreutils/date.c ./coreutils/date.c
|
|
||||
--- ../busybox-1.26.2/coreutils/date.c 2016-12-10 17:46:36.000000000 +0000
|
|
||||
+++ ./coreutils/date.c 2017-07-06 22:15:17.528119028 +0000
|
|
||||
@@ -293,9 +293,16 @@
|
|
||||
maybe_set_utc(opt); |
|
||||
|
|
||||
/* if setting time, set it */ |
|
||||
+#ifdef __ANDROID__
|
|
||||
+ if (opt & OPT_SET) {
|
|
||||
+ /* stime(2) is not available on Android and is not allowed anyway. */
|
|
||||
+ bb_error_msg("can't set date: Operation not permitted");
|
|
||||
+ }
|
|
||||
+#else
|
|
||||
if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { |
|
||||
bb_perror_msg("can't set date"); |
|
||||
} |
|
||||
+#endif
|
|
||||
} |
|
||||
|
|
||||
/* Display output */ |
|
@ -1,21 +0,0 @@ |
|||||
diff -u -r ../busybox-1.27.1/coreutils/mktemp.c ./coreutils/mktemp.c
|
|
||||
--- ../busybox-1.27.1/coreutils/mktemp.c 2017-07-06 15:14:57.000000000 +0000
|
|
||||
+++ ./coreutils/mktemp.c 2017-07-24 23:44:41.384345896 +0000
|
|
||||
@@ -52,7 +52,7 @@
|
|
||||
//usage: "\n -p DIR Use DIR as a base directory (implies -t)" |
|
||||
//usage: "\n -u Do not create anything; print a name" |
|
||||
//usage: "\n" |
|
||||
-//usage: "\nBase directory is: -p DIR, else $TMPDIR, else /tmp"
|
|
||||
+//usage: "\nBase directory is: -p DIR, else $TMPDIR, else @TERMUX_PREFIX@/tmp"
|
|
||||
//usage: |
|
||||
//usage:#define mktemp_example_usage |
|
||||
//usage: "$ mktemp /tmp/temp.XXXXXX\n" |
|
||||
@@ -78,7 +78,7 @@
|
|
||||
|
|
||||
path = getenv("TMPDIR"); |
|
||||
if (!path || path[0] == '\0') |
|
||||
- path = "/tmp";
|
|
||||
+ path = "@TERMUX_PREFIX@/tmp";
|
|
||||
|
|
||||
opt_complementary = "?1"; /* 1 argument max */ |
|
||||
opts = getopt32(argv, "dqtp:u", &path); |
|
@ -1,12 +0,0 @@ |
|||||
diff -u -r ../busybox-1.24.1/editors/diff.c ./editors/diff.c
|
|
||||
--- ../busybox-1.24.1/editors/diff.c 2015-10-11 09:31:50.000000000 -0400
|
|
||||
+++ ./editors/diff.c 2016-02-08 05:23:45.890302334 -0500
|
|
||||
@@ -734,7 +734,7 @@
|
|
||||
* When we meet non-seekable file, we must make a temp copy. |
|
||||
*/ |
|
||||
if (lseek(fd, 0, SEEK_SET) == -1 && errno == ESPIPE) { |
|
||||
- char name[] = "/tmp/difXXXXXX";
|
|
||||
+ char name[] = "@TERMUX_PREFIX@/tmp/difXXXXXX";
|
|
||||
int fd_tmp = xmkstemp(name); |
|
||||
|
|
||||
unlink(name); |
|
@ -1,14 +0,0 @@ |
|||||
diff -uNr busybox-1.29.3/include/platform.h busybox-1.29.3.mod/include/platform.h
|
|
||||
--- busybox-1.29.3/include/platform.h 2018-07-02 14:23:06.000000000 +0300
|
|
||||
+++ busybox-1.29.3.mod/include/platform.h 2019-02-08 16:01:14.437858554 +0200
|
|
||||
@@ -579,10 +579,6 @@
|
|
||||
extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC; |
|
||||
#endif |
|
||||
|
|
||||
-#ifndef HAVE_STRCHRNUL
|
|
||||
-extern char *strchrnul(const char *s, int c) FAST_FUNC;
|
|
||||
-#endif
|
|
||||
-
|
|
||||
#ifndef HAVE_STRSEP |
|
||||
extern char *strsep(char **stringp, const char *delim) FAST_FUNC; |
|
||||
#endif |
|
@ -1,17 +0,0 @@ |
|||||
diff -u -r ../busybox-1.24.1/libbb/change_identity.c ./libbb/change_identity.c
|
|
||||
--- ../busybox-1.24.1/libbb/change_identity.c 2015-07-12 22:18:47.000000000 -0400
|
|
||||
+++ ./libbb/change_identity.c 2015-10-26 19:29:18.972044695 -0400
|
|
||||
@@ -33,6 +33,7 @@
|
|
||||
/* Become the user and group(s) specified by PW. */ |
|
||||
void FAST_FUNC change_identity(const struct passwd *pw) |
|
||||
{ |
|
||||
+#ifndef __ANDROID__
|
|
||||
int res; |
|
||||
|
|
||||
res = initgroups(pw->pw_name, pw->pw_gid); |
|
||||
@@ -57,4 +58,5 @@
|
|
||||
|
|
||||
xsetgid(pw->pw_gid); |
|
||||
xsetuid(pw->pw_uid); |
|
||||
+#endif
|
|
||||
} |
|
@ -1,19 +0,0 @@ |
|||||
diff -uNr busybox-1.29.3/libbb/platform.c busybox-1.29.3.mod/libbb/platform.c
|
|
||||
--- busybox-1.29.3/libbb/platform.c 2018-07-02 14:23:06.000000000 +0300
|
|
||||
+++ busybox-1.29.3.mod/libbb/platform.c 2019-02-08 16:10:54.101961593 +0200
|
|
||||
@@ -8,15 +8,6 @@
|
|
||||
*/ |
|
||||
#include "libbb.h" |
|
||||
|
|
||||
-#ifndef HAVE_STRCHRNUL
|
|
||||
-char* FAST_FUNC strchrnul(const char *s, int c)
|
|
||||
-{
|
|
||||
- while (*s != '\0' && *s != c)
|
|
||||
- s++;
|
|
||||
- return (char*)s;
|
|
||||
-}
|
|
||||
-#endif
|
|
||||
-
|
|
||||
#ifndef HAVE_USLEEP |
|
||||
int FAST_FUNC usleep(unsigned usec) |
|
||||
{ |
|
@ -1,14 +0,0 @@ |
|||||
diff -u -r ../busybox-1.29.1/libbb/pw_encrypt.c ./libbb/pw_encrypt.c
|
|
||||
--- ../busybox-1.29.1/libbb/pw_encrypt.c 2018-07-02 11:23:06.000000000 +0000
|
|
||||
+++ ./libbb/pw_encrypt.c 2018-07-22 23:43:48.620188017 +0000
|
|
||||
@@ -6,7 +6,9 @@
|
|
||||
* |
|
||||
* Licensed under GPLv2 or later, see file LICENSE in this source tree. |
|
||||
*/ |
|
||||
-#include <crypt.h>
|
|
||||
+#if !ENABLE_USE_BB_CRYPT
|
|
||||
+# include <crypt.h>
|
|
||||
+#endif
|
|
||||
#include "libbb.h" |
|
||||
|
|
||||
/* static const uint8_t ascii64[] ALIGN1 = |
|
@ -1,18 +0,0 @@ |
|||||
diff -u -r ../busybox-1.22.1/include/libbb.h ./include/libbb.h
|
|
||||
--- ../busybox-1.22.1/include/libbb.h 2014-01-09 19:15:44.000000000 +0100
|
|
||||
+++ ./include/libbb.h 2014-07-01 10:27:23.000000000 +0200
|
|
||||
@@ -1785,12 +1785,12 @@
|
|
||||
* use bb_default_login_shell and following defines. |
|
||||
* If you change LIBBB_DEFAULT_LOGIN_SHELL, |
|
||||
* don't forget to change increment constant. */ |
|
||||
-#define LIBBB_DEFAULT_LOGIN_SHELL "-/bin/sh"
|
|
||||
+#define LIBBB_DEFAULT_LOGIN_SHELL "-/system/bin/sh"
|
|
||||
extern const char bb_default_login_shell[] ALIGN1; |
|
||||
/* "/bin/sh" */ |
|
||||
#define DEFAULT_SHELL (bb_default_login_shell+1) |
|
||||
/* "sh" */ |
|
||||
-#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6)
|
|
||||
+#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+13)
|
|
||||
|
|
||||
/* The following devices are the same on all systems. */ |
|
||||
#define CURRENT_TTY "/dev/tty" |
|
@ -1,16 +0,0 @@ |
|||||
We have patched the ndk header to include getsid(). |
|
||||
|
|
||||
diff -u -r ../busybox-1.29.1/libbb/missing_syscalls.c ./libbb/missing_syscalls.c
|
|
||||
--- ../busybox-1.29.1/libbb/missing_syscalls.c 2018-07-02 11:23:06.000000000 +0000
|
|
||||
+++ ./libbb/missing_syscalls.c 2018-07-22 23:12:25.751499056 +0000
|
|
||||
@@ -10,10 +10,6 @@
|
|
||||
#if defined(ANDROID) || defined(__ANDROID__) |
|
||||
/*# include <linux/timex.h> - for struct timex, but may collide with <time.h> */ |
|
||||
# include <sys/syscall.h> |
|
||||
-pid_t getsid(pid_t pid)
|
|
||||
-{
|
|
||||
- return syscall(__NR_getsid, pid);
|
|
||||
-}
|
|
||||
|
|
||||
int stime(const time_t *t) |
|
||||
{ |
|
@ -1,34 +0,0 @@ |
|||||
diff -u -r ../busybox-1.29.2/networking/ftpd.c ./networking/ftpd.c
|
|
||||
--- ../busybox-1.29.2/networking/ftpd.c 2018-07-02 11:23:06.000000000 +0000
|
|
||||
+++ ./networking/ftpd.c 2018-08-30 09:14:29.299721780 +0000
|
|
||||
@@ -177,13 +177,9 @@
|
|
||||
char msg_ok [(sizeof("NNN " MSG_OK ) + 3) & 0xfffc]; |
|
||||
char msg_err[(sizeof("NNN " MSG_ERR) + 3) & 0xfffc]; |
|
||||
} FIX_ALIASING; |
|
||||
-#define G (*ptr_to_globals)
|
|
||||
-/* ^^^ about 75 bytes smaller code than this: */
|
|
||||
-//#define G (*(struct globals*)bb_common_bufsiz1)
|
|
||||
+#define G (*(struct globals*)bb_common_bufsiz1)
|
|
||||
#define INIT_G() do { \ |
|
||||
- SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
|
|
||||
- /*setup_common_bufsiz();*/ \
|
|
||||
- \
|
|
||||
+ setup_common_bufsiz(); \
|
|
||||
/* Moved to main */ \ |
|
||||
/*strcpy(G.msg_ok + 4, MSG_OK );*/ \ |
|
||||
/*strcpy(G.msg_err + 4, MSG_ERR);*/ \ |
|
||||
@@ -1301,7 +1297,14 @@
|
|
||||
G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY); |
|
||||
close_on_exec_on(G.root_fd); |
|
||||
#endif |
|
||||
+
|
|
||||
+#ifdef __ANDROID__
|
|
||||
+ /* Do not try chroot() as seccomp filtering in
|
|
||||
+ * android 9 kills the process. */
|
|
||||
+ if (false)
|
|
||||
+#else
|
|
||||
if (chroot(basedir) == 0) |
|
||||
+#endif
|
|
||||
basedir = "/"; |
|
||||
#if !BB_MMU |
|
||||
else { |
|
@ -1,22 +0,0 @@ |
|||||
diff -u -r ../busybox-1.26.2/networking/hostname.c ./networking/hostname.c
|
|
||||
--- ../busybox-1.26.2/networking/hostname.c 2016-12-10 18:46:36.000000000 +0100
|
|
||||
+++ ./networking/hostname.c 2017-07-07 00:19:07.993535998 +0200
|
|
||||
@@ -58,11 +58,18 @@
|
|
||||
} |
|
||||
if (ENABLE_FEATURE_CLEAN_UP) |
|
||||
config_close(parser); |
|
||||
+#ifdef __ANDROID__
|
|
||||
+ } else {
|
|
||||
+ /* sethostname() is not available on Android pre android-23 and not allowed anyway. */
|
|
||||
+ bb_error_msg_and_die("can't set hostname: Operation not permitted");
|
|
||||
+ }
|
|
||||
+#else
|
|
||||
} else if (sethostname(s, strlen(s))) { |
|
||||
// if (errno == EPERM) |
|
||||
// bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); |
|
||||
bb_perror_msg_and_die("sethostname"); |
|
||||
} |
|
||||
+#endif
|
|
||||
} |
|
||||
|
|
||||
/* Manpage circa 2009: |
|
@ -1,24 +0,0 @@ |
|||||
diff -u -r ../busybox-1.25.1/networking/telnetd.c ./networking/telnetd.c
|
|
||||
--- ../busybox-1.25.1/networking/telnetd.c 2016-10-07 10:47:47.000000000 -0400
|
|
||||
+++ ./networking/telnetd.c 2016-10-08 17:49:55.717890508 -0400
|
|
||||
@@ -86,8 +86,9 @@
|
|
||||
#define G (*(struct globals*)bb_common_bufsiz1) |
|
||||
#define INIT_G() do { \ |
|
||||
setup_common_bufsiz(); \ |
|
||||
- G.loginpath = "/bin/login"; \
|
|
||||
- G.issuefile = "/etc/issue.net"; \
|
|
||||
+ struct passwd* pwd = getpwuid(getuid()); \
|
|
||||
+ G.loginpath = pwd->pw_shell; \
|
|
||||
+ G.issuefile = "@TERMUX_PREFIX@/etc/issue.net"; \
|
|
||||
} while (0) |
|
||||
|
|
||||
|
|
||||
@@ -529,7 +530,7 @@
|
|
||||
} else { |
|
||||
master_fd = 0; |
|
||||
if (!(opt & OPT_WAIT)) { |
|
||||
- unsigned portnbr = 23;
|
|
||||
+ unsigned portnbr = 8023;
|
|
||||
if (opt & OPT_PORT) |
|
||||
portnbr = xatou16(opt_portnbr); |
|
||||
master_fd = create_and_bind_stream_or_die(opt_bindaddr, portnbr); |
|
@ -1,16 +0,0 @@ |
|||||
We disable security, because chroot() does not work with our environment. |
|
||||
|
|
||||
With chdir() this can be used for bootstrapping on a local network. |
|
||||
|
|
||||
diff -u -r ../busybox-1.22.1/networking/tftp.c ./networking/tftp.c
|
|
||||
--- ../busybox-1.22.1/networking/tftp.c 2014-01-09 19:15:44.000000000 +0100
|
|
||||
+++ ./networking/tftp.c 2014-07-01 08:42:48.000000000 +0200
|
|
||||
@@ -790,7 +790,7 @@
|
|
||||
G.pw = xgetpwnam(user_opt); |
|
||||
} |
|
||||
if (argv[0]) { |
|
||||
- xchroot(argv[0]);
|
|
||||
+ xchdir(argv[0]);
|
|
||||
} |
|
||||
|
|
||||
result = recv_from_to(STDIN_FILENO, G.block_buf, sizeof(G.block_buf), |
|
@ -1,23 +0,0 @@ |
|||||
diff -u -r ../busybox-1.25.1/util-linux/getopt.c ./util-linux/getopt.c
|
|
||||
--- ../busybox-1.25.1/util-linux/getopt.c 2016-10-07 10:47:47.000000000 -0400
|
|
||||
+++ ./util-linux/getopt.c 2016-11-30 17:46:48.000185295 -0500
|
|
||||
@@ -358,6 +358,10 @@
|
|
||||
; |
|
||||
#endif |
|
||||
|
|
||||
+#ifdef __ANDROID__
|
|
||||
+extern char* __progname;
|
|
||||
+#endif
|
|
||||
+
|
|
||||
int getopt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
|
||||
int getopt_main(int argc, char **argv) |
|
||||
{ |
|
||||
@@ -423,5 +427,8 @@
|
|
||||
} |
|
||||
|
|
||||
argv[n] = name ? name : argv[0]; |
|
||||
+#ifdef __ANDROID__
|
|
||||
+ __progname = argv[n];
|
|
||||
+#endif
|
|
||||
return generate_output(argv + n, argc - n, optstr, long_options); |
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
diff -uNr busybox-1.30.1/util-linux/setarch.c busybox-1.30.1.mod/util-linux/setarch.c
|
|
||||
--- busybox-1.30.1/util-linux/setarch.c 2018-12-30 17:14:20.000000000 +0200
|
|
||||
+++ busybox-1.30.1.mod/util-linux/setarch.c 2019-03-02 14:06:38.150442254 +0200
|
|
||||
@@ -98,7 +98,7 @@
|
|
||||
|
|
||||
argv += optind; |
|
||||
if (!argv[0]) |
|
||||
- (--argv)[0] = (char*)"/bin/sh";
|
|
||||
+ (--argv)[0] = (char*)"@TERMUX_PREFIX@/bin/sh";
|
|
||||
|
|
||||
/* Try to execute the program */ |
|
||||
BB_EXECVP_or_die(argv); |
|
Loading…
Reference in new issue