shellinabox: fix sigsys crash, use login service by default, fix port for ssh service

This commit is contained in:
Leonid Pliushch 2020-08-11 22:09:13 +03:00
parent 73725c318c
commit 7aa8988f71
4 changed files with 45 additions and 7 deletions

View File

@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://github.com/shellinabox/shellinabox
TERMUX_PKG_DESCRIPTION="Implementation of a web server that can export arbitrary command line tools to a web based terminal emulator"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=2.20
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/shellinabox/shellinabox/archive/v$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=27a5ec6c3439f87aee238c47cc56e7357a6249e5ca9ed0f044f0057ef389d81e
TERMUX_PKG_DEPENDS="openssl, openssl-tool, termux-auth (>= 1.2), zlib"

View File

@ -1,6 +1,6 @@
diff -uNr shellinabox-2.20/shellinabox/launcher.c shellinabox-2.20.mod/shellinabox/launcher.c
--- shellinabox-2.20/shellinabox/launcher.c 2016-11-09 21:40:33.000000000 +0200
+++ shellinabox-2.20.mod/shellinabox/launcher.c 2020-01-03 01:31:45.220824399 +0200
+++ shellinabox-2.20.mod/shellinabox/launcher.c 2020-08-11 21:49:21.332502608 +0300
@@ -676,10 +676,13 @@
// Temporarily regain privileges to update the utmp database
uid_t r_uid, e_uid, s_uid;
@ -38,7 +38,17 @@ diff -uNr shellinabox-2.20/shellinabox/launcher.c shellinabox-2.20.mod/shellinab
}
if (restricted &&
@@ -1231,7 +1235,7 @@
@@ -1217,7 +1221,9 @@
break;
}
}
+#ifndef __ANDROID__
setgroups(ngroups, groups);
+#endif
free(groups);
}
@@ -1231,7 +1237,7 @@
(*environment)[numEnvVars++] = stringPrintf(NULL, "SHELL=%s", pw->pw_shell);
check(
(*environment)[numEnvVars++] = strdup(
@ -47,7 +57,7 @@ diff -uNr shellinabox-2.20/shellinabox/launcher.c shellinabox-2.20.mod/shellinab
(*environment)[numEnvVars++] = stringPrintf(NULL, "LOGNAME=%s",
service->user);
(*environment)[numEnvVars++] = stringPrintf(NULL, "USER=%s", service->user);
@@ -1566,10 +1570,13 @@
@@ -1566,10 +1572,13 @@
cfsetospeed(&tt, B38400);
tcsetattr(0, TCSAFLUSH, &tt);
@ -61,7 +71,7 @@ diff -uNr shellinabox-2.20/shellinabox/launcher.c shellinabox-2.20.mod/shellinab
#ifdef HAVE_UTMPX_H
if (enableUtmpLogging) {
setutxent();
@@ -1641,9 +1648,11 @@
@@ -1641,9 +1650,11 @@
#endif
}
@ -73,7 +83,7 @@ diff -uNr shellinabox-2.20/shellinabox/launcher.c shellinabox-2.20.mod/shellinab
// Change working directory
if (service->useHomeDir) {
@@ -1682,10 +1691,7 @@
@@ -1682,10 +1693,7 @@
snprintf(remoteHost, 256,
(*realIP) ? "%s, %s" : "%s%s", peerName,
(*realIP) ? realIP : "");

View File

@ -1,6 +1,6 @@
diff -uNr shellinabox-2.20/shellinabox/service.c shellinabox-2.20.mod/shellinabox/service.c
--- shellinabox-2.20/shellinabox/service.c 2016-11-09 21:40:33.000000000 +0200
+++ shellinabox-2.20.mod/shellinabox/service.c 2020-01-03 01:47:07.845623596 +0200
+++ shellinabox-2.20.mod/shellinabox/service.c 2020-08-11 22:05:54.096833987 +0300
@@ -94,9 +94,11 @@
// The next part of the argument is either the word 'LOGIN' or the
// application definition.
@ -23,6 +23,15 @@ diff -uNr shellinabox-2.20/shellinabox/service.c shellinabox-2.20.mod/shellinabo
} else
#endif
if (!strcmp(arg, "SSH") || !strncmp(arg, "SSH:", 4)) {
@@ -123,7 +124,7 @@
char *host;
char *sshPort;
check(host = strdup("localhost"));
- check(sshPort = strdup("22"));
+ check(sshPort = strdup("8022"));
if ((ptr = strchr(arg, ':')) != NULL) {
ptr = ptr + 1;
@@ -175,8 +176,7 @@
"-oHostbasedAuthentication=no -oIdentitiesOnly=yes "
"-oKbdInteractiveAuthentication=yes -oPasswordAuthentication=yes "

View File

@ -0,0 +1,19 @@
diff -uNr shellinabox-2.20/shellinabox/shellinaboxd.c shellinabox-2.20.mod/shellinabox/shellinaboxd.c
--- shellinabox-2.20/shellinabox/shellinaboxd.c 2016-11-09 21:40:33.000000000 +0200
+++ shellinabox-2.20.mod/shellinabox/shellinaboxd.c 2020-08-11 22:04:23.596451144 +0300
@@ -1271,14 +1271,7 @@
// If the user did not register any services, provide the default service
if (!getHashmapSize(serviceTable)) {
- addToHashMap(serviceTable, "/",
- (char *)newService(
-#ifdef HAVE_BIN_LOGIN
- geteuid() ? ":SSH" : ":LOGIN"
-#else
- ":SSH"
-#endif
- ));
+ addToHashMap(serviceTable, "/", (char *)newService(":LOGIN"));
}
enumerateServices(serviceTable);
deleteHashMap(serviceTable);