Fredrik Fornwall
5 years ago
4 changed files with 10 additions and 740 deletions
@ -1,277 +0,0 @@ |
|||
From |
|||
|
|||
https://github.com/openembedded/openembedded-core/tree/master/meta/recipes-extended/screen/screen |
|||
|
|||
diff -u -r ../screen-4.4.0/configure.ac ./configure.ac
|
|||
--- ../screen-4.4.0/configure.ac 2016-06-19 15:41:03.000000000 -0400
|
|||
+++ ./configure.ac 2016-11-07 18:05:24.132420605 -0500
|
|||
@@ -48,31 +48,6 @@
|
|||
AC_ISC_POSIX |
|||
AC_USE_SYSTEM_EXTENSIONS |
|||
|
|||
-AC_TRY_RUN(main(){exit(0);},,[
|
|||
-if test $CC != cc ; then
|
|||
-AC_NOTE(Your $CC failed - restarting with CC=cc)
|
|||
-AC_NOTE()
|
|||
-CC=cc
|
|||
-export CC
|
|||
-exec $0 $configure_args
|
|||
-fi
|
|||
-])
|
|||
-
|
|||
-AC_TRY_RUN(main(){exit(0);},,
|
|||
-exec 5>&2
|
|||
-eval $ac_link
|
|||
-AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
|
|||
-AC_NOTE($ac_compile)
|
|||
-AC_MSG_ERROR(Can't run the compiler - sorry))
|
|||
-
|
|||
-AC_TRY_RUN([
|
|||
-main()
|
|||
-{
|
|||
- int __something_strange_();
|
|||
- __something_strange_(0);
|
|||
-}
|
|||
-],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
|
|||
-
|
|||
AC_PROG_AWK |
|||
|
|||
AC_PROG_INSTALL |
|||
@@ -110,7 +85,7 @@
|
|||
dnl |
|||
dnl **** special unix variants **** |
|||
dnl |
|||
-if test -n "$ISC"; then
|
|||
+if test "$cross_compiling" = no && test -n "$ISC" ; then
|
|||
AC_DEFINE(ISC) LIBS="$LIBS -linet" |
|||
fi |
|||
|
|||
@@ -121,10 +96,11 @@
|
|||
dnl fi |
|||
dnl fi |
|||
|
|||
-if test -f /sysV68 ; then
|
|||
+if test "$cross_compiling" = no && test -f /sysV68 ; then
|
|||
AC_DEFINE(sysV68) |
|||
fi |
|||
|
|||
+if test "$cross_compiling" = no ; then
|
|||
AC_CHECKING(for MIPS) |
|||
if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then |
|||
oldlibs="$LIBS" |
|||
@@ -148,6 +124,7 @@
|
|||
)) |
|||
fi |
|||
fi |
|||
+fi
|
|||
|
|||
|
|||
AC_CHECKING(for Ultrix) |
|||
@@ -157,7 +134,7 @@
|
|||
#endif |
|||
], ULTRIX=1) |
|||
|
|||
-if test -f /usr/lib/libpyr.a ; then
|
|||
+if test "$cross_compiling" = no && test -f /usr/lib/libpyr.a ; then
|
|||
oldlibs="$LIBS" |
|||
LIBS="$LIBS -lpyr" |
|||
AC_CHECKING(Pyramid OSX) |
|||
@@ -373,7 +350,8 @@
|
|||
exit(0); |
|||
} |
|||
], AC_NOTE(- your fifos are usable) fifo=1, |
|||
-AC_NOTE(- your fifos are not usable))
|
|||
+AC_NOTE(- your fifos are not usable),
|
|||
+AC_NOTE(- skipping check because we are cross compiling; assuming fifos are usable) fifo=1)
|
|||
rm -f /tmp/conftest* |
|||
|
|||
if test -n "$fifo"; then |
|||
@@ -421,7 +399,8 @@
|
|||
exit(0); |
|||
} |
|||
], AC_NOTE(- your implementation is ok), |
|||
-AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
|
|||
+AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1,
|
|||
+AC_NOTE(- skipping check because we are cross compiling; assuming fifo implementation is ok))
|
|||
rm -f /tmp/conftest* |
|||
fi |
|||
|
|||
@@ -483,7 +462,9 @@
|
|||
exit(0); |
|||
} |
|||
], AC_NOTE(- your sockets are usable) sock=1, |
|||
-AC_NOTE(- your sockets are not usable))
|
|||
+
|
|||
+AC_NOTE(- your sockets are not usable),
|
|||
+AC_NOTE(- skipping check because we are cross compiling; assuming sockets are usable) sock=1)
|
|||
rm -f /tmp/conftest* |
|||
|
|||
if test -n "$sock"; then |
|||
@@ -522,7 +503,8 @@
|
|||
} |
|||
],AC_NOTE(- you are normal), |
|||
AC_NOTE(- unix domain sockets are not kept in the filesystem) |
|||
-AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
|
|||
+AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1,
|
|||
+AC_NOTE(- skipping check because we are cross compiling; assuming sockets are normal))
|
|||
rm -f /tmp/conftest* |
|||
fi |
|||
|
|||
@@ -649,7 +631,8 @@
|
|||
exit(0); |
|||
} |
|||
],AC_NOTE(- select is ok), |
|||
-AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
|
|||
+AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN),
|
|||
+AC_NOTE(- skipping check because we are cross compiling; assuming select is ok))
|
|||
|
|||
dnl |
|||
dnl **** termcap or terminfo **** |
|||
@@ -691,24 +674,29 @@
|
|||
{ |
|||
exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); |
|||
}], AC_NOTE(- you use the termcap database), |
|||
-AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
|
|||
+AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO),
|
|||
+AC_NOTE(- skipping check because we are cross compiling; assuming terminfo database is used) AC_DEFINE(TERMINFO))
|
|||
AC_CHECKING(ospeed) |
|||
AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED)) |
|||
|
|||
dnl |
|||
dnl **** PTY specific things **** |
|||
dnl |
|||
+if test "$cross_compiling" = no ; then
|
|||
AC_CHECKING(for /dev/ptc) |
|||
if test -r /dev/ptc; then |
|||
AC_DEFINE(HAVE_DEV_PTC) |
|||
fi |
|||
+fi
|
|||
|
|||
+if test "$cross_compiling" = no ; then
|
|||
AC_CHECKING(for SVR4 ptys) |
|||
sysvr4ptys= |
|||
if test -c /dev/ptmx ; then |
|||
AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS) |
|||
sysvr4ptys=1]) |
|||
fi |
|||
+fi
|
|||
|
|||
AC_CHECK_FUNCS(getpt) |
|||
|
|||
@@ -718,6 +706,7 @@
|
|||
[AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])]) |
|||
fi |
|||
|
|||
+if test "$cross_compiling" = no ; then
|
|||
AC_CHECKING(for ptyranges) |
|||
if test -d /dev/ptym ; then |
|||
pdir='/dev/ptym' |
|||
@@ -741,6 +730,7 @@
|
|||
AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0") |
|||
AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1") |
|||
fi |
|||
+fi
|
|||
|
|||
dnl **** pty mode/group handling **** |
|||
dnl |
|||
@@ -826,7 +816,8 @@
|
|||
else |
|||
AC_NOTE(- can't determine - assume ptys are world accessable) |
|||
fi |
|||
- ]
|
|||
+ ],
|
|||
+ AC_NOTE(- skipping check because we are cross compiling; assuming ptys are world accessable)
|
|||
) |
|||
rm -f conftest_grp |
|||
fi |
|||
@@ -887,14 +878,16 @@
|
|||
dnl |
|||
dnl **** loadav **** |
|||
dnl |
|||
+if test "$cross_compiling" = no ; then
|
|||
AC_CHECKING(for libutil(s)) |
|||
test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils" |
|||
test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil" |
|||
+fi
|
|||
|
|||
AC_CHECKING(getloadavg) |
|||
AC_TRY_LINK(,[getloadavg((double *)0, 0);], |
|||
AC_DEFINE(LOADAV_GETLOADAVG) load=1, |
|||
-if test -f /usr/lib/libkvm.a ; then
|
|||
+if test "$cross_compiling" = no && test -f /usr/lib/libkvm.a ; then
|
|||
olibs="$LIBS" |
|||
LIBS="$LIBS -lkvm" |
|||
AC_CHECKING(getloadavg with -lkvm) |
|||
@@ -910,7 +903,7 @@
|
|||
#endif |
|||
], load=1) |
|||
fi |
|||
-if test -z "$load" ; then
|
|||
+if test -z "$load" && test "$cross_compiling" = no ; then
|
|||
AC_CHECKING(for kernelfile) |
|||
for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do |
|||
if test -f $core || test -c $core; then |
|||
@@ -1103,7 +1096,7 @@
|
|||
#endif |
|||
exit(0); |
|||
} |
|||
-],,AC_DEFINE(SYSVSIGS))
|
|||
+],,AC_DEFINE(SYSVSIGS),:)
|
|||
|
|||
fi |
|||
|
|||
@@ -1112,13 +1105,17 @@
|
|||
dnl |
|||
|
|||
AC_CHECKING(for crypt and sec libraries) |
|||
+if test "$cross_compiling" = no ; then
|
|||
test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d" |
|||
+fi
|
|||
oldlibs="$LIBS" |
|||
LIBS="$LIBS -lcrypt" |
|||
AC_CHECKING(crypt) |
|||
AC_TRY_LINK(,,,LIBS="$oldlibs") |
|||
+if test "$cross_compiling" = no ; then
|
|||
test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec" |
|||
test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow" |
|||
+fi
|
|||
oldlibs="$LIBS" |
|||
LIBS="$LIBS -lsun" |
|||
AC_CHECKING(IRIX sun library) |
|||
@@ -1183,7 +1180,7 @@
|
|||
if (strncmp(buf, "cdedef", 6)) |
|||
exit(1); |
|||
exit(0); /* libc version works properly. */ |
|||
-}], AC_DEFINE(USEBCOPY))
|
|||
+}], AC_DEFINE(USEBCOPY),,:)
|
|||
|
|||
AC_TRY_RUN([ |
|||
#define bcopy(s,d,l) memmove(d,s,l) |
|||
@@ -1198,7 +1195,8 @@
|
|||
if (strncmp(buf, "cdedef", 6)) |
|||
exit(1); |
|||
exit(0); /* libc version works properly. */ |
|||
-}], AC_DEFINE(USEMEMMOVE))
|
|||
+}], AC_DEFINE(USEMEMMOVE),,
|
|||
+ AC_NOTE(- skipping check because we are cross compiling; use memmove) AC_DEFINE(USEMEMMOVE))
|
|||
|
|||
|
|||
AC_TRY_RUN([ |
|||
@@ -1214,7 +1212,7 @@
|
|||
if (strncmp(buf, "cdedef", 6)) |
|||
exit(1); |
|||
exit(0); /* libc version works properly. */ |
|||
-}], AC_DEFINE(USEMEMCPY))
|
|||
+}], AC_DEFINE(USEMEMCPY),,:)
|
|||
|
|||
AC_SYS_LONG_FILE_NAMES |
|||
|
|||
@@ -1300,8 +1298,6 @@
|
|||
dnl Ptx bug workaround -- insert -lc after -ltermcap |
|||
test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" |
|||
|
|||
-AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
|
|||
-
|
|||
ETCSCREENRC= |
|||
AC_MSG_CHECKING(for the global screenrc file) |
|||
AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path to the global screenrc file], [ ETCSCREENRC="${withval}" ]) |
@ -1,456 +0,0 @@ |
|||
setuid(), setgid() and other similar calls trigger seccomp on |
|||
the Android 9 or higher. |
|||
|
|||
diff -uNr screen-4.6.2/attacher.c screen-4.6.2.mod/attacher.c
|
|||
--- screen-4.6.2/attacher.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/attacher.c 2018-12-28 13:36:35.969225142 +0200
|
|||
@@ -191,8 +191,6 @@
|
|||
if (ret == SIG_POWER_BYE) |
|||
{ |
|||
int ppid; |
|||
- if (setgid(real_gid) || setuid(real_uid))
|
|||
- Panic(errno, "setuid/gid");
|
|||
if ((ppid = getppid()) > 1) |
|||
Kill(ppid, SIGHUP); |
|||
exit(0); |
|||
@@ -215,13 +213,6 @@
|
|||
{ |
|||
real_uid = multi_uid; |
|||
eff_uid = own_uid; |
|||
-#ifdef HAVE_SETRESUID
|
|||
- if (setresuid(multi_uid, own_uid, multi_uid))
|
|||
- Panic(errno, "setresuid");
|
|||
-#else
|
|||
- xseteuid(multi_uid);
|
|||
- xseteuid(own_uid);
|
|||
-#endif
|
|||
if (chmod(attach_tty, 0666)) |
|||
Panic(errno, "chmod %s", attach_tty); |
|||
tty_oldmode = tty_mode; |
|||
@@ -288,27 +279,7 @@
|
|||
/* NOTREACHED */ |
|||
} |
|||
} |
|||
- /*
|
|||
- * Go in UserContext. Advantage is, you can kill your attacher
|
|||
- * when things go wrong. Any disadvantages? jw.
|
|||
- * Do this before the attach to prevent races!
|
|||
- */
|
|||
-#ifdef MULTIUSER
|
|||
- if (!multiattach)
|
|||
-#endif
|
|||
- {
|
|||
- if (setuid(real_uid))
|
|||
- Panic(errno, "setuid");
|
|||
- }
|
|||
-#if defined(MULTIUSER) && defined(USE_SETEUID)
|
|||
- else
|
|||
- {
|
|||
- /* This call to xsetuid should also set the saved uid */
|
|||
- xseteuid(real_uid); /* multi_uid, allow backend to send signals */
|
|||
- }
|
|||
-#endif
|
|||
- if (setgid(real_gid))
|
|||
- Panic(errno, "setgid");
|
|||
+
|
|||
eff_uid = real_uid; |
|||
eff_gid = real_gid; |
|||
|
|||
@@ -422,12 +393,10 @@
|
|||
# ifndef USE_SETEUID |
|||
close(multipipe[1]); |
|||
# else |
|||
- xseteuid(own_uid);
|
|||
if (tty_oldmode >= 0) |
|||
if (chmod(attach_tty, tty_oldmode)) |
|||
Panic(errno, "chmod %s", attach_tty); |
|||
tty_oldmode = -1; |
|||
- xseteuid(real_uid);
|
|||
# endif |
|||
} |
|||
#endif |
|||
@@ -506,8 +475,6 @@
|
|||
#ifdef MULTIUSER |
|||
if (tty_oldmode >= 0) |
|||
{ |
|||
- if (setuid(own_uid))
|
|||
- Panic(errno, "setuid");
|
|||
chmod(attach_tty, tty_oldmode); |
|||
} |
|||
#endif |
|||
@@ -525,15 +492,6 @@
|
|||
if (multiattach) |
|||
exit(SIG_POWER_BYE); |
|||
#endif |
|||
- if (setgid(real_gid))
|
|||
- Panic(errno, "setgid");
|
|||
-#ifdef MULTIUSER
|
|||
- if (setuid(own_uid))
|
|||
- Panic(errno, "setuid");
|
|||
-#else
|
|||
- if (setuid(real_uid))
|
|||
- Panic(errno, "setuid");
|
|||
-#endif
|
|||
/* we don't want to disturb init (even if we were root), eh? jw */ |
|||
if ((ppid = getppid()) > 1) |
|||
Kill(ppid, SIGHUP); /* carefully say good bye. jw. */ |
|||
@@ -703,15 +661,6 @@
|
|||
LockHup SIGDEFARG |
|||
{ |
|||
int ppid = getppid(); |
|||
- if (setgid(real_gid))
|
|||
- Panic(errno, "setgid");
|
|||
-#ifdef MULTIUSER
|
|||
- if (setuid(own_uid))
|
|||
- Panic(errno, "setuid");
|
|||
-#else
|
|||
- if (setuid(real_uid))
|
|||
- Panic(errno, "setuid");
|
|||
-#endif
|
|||
if (ppid > 1) |
|||
Kill(ppid, SIGHUP); |
|||
exit(0); |
|||
@@ -737,15 +686,6 @@
|
|||
if ((pid = fork()) == 0) |
|||
{ |
|||
/* Child */ |
|||
- if (setgid(real_gid))
|
|||
- Panic(errno, "setgid");
|
|||
-#ifdef MULTIUSER
|
|||
- if (setuid(own_uid))
|
|||
- Panic(errno, "setuid");
|
|||
-#else
|
|||
- if (setuid(real_uid)) /* this should be done already */
|
|||
- Panic(errno, "setuid");
|
|||
-#endif
|
|||
closeallfiles(0); /* important: /etc/shadow may be open */ |
|||
execl(prg, "SCREEN-LOCK", NULL); |
|||
exit(errno); |
|||
diff -uNr screen-4.6.2/display.c screen-4.6.2.mod/display.c
|
|||
--- screen-4.6.2/display.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/display.c 2018-12-28 13:33:47.501212536 +0200
|
|||
@@ -3769,8 +3769,6 @@
|
|||
dfp = 0; |
|||
} |
|||
#endif |
|||
- if (setgid(real_gid) || setuid(real_uid))
|
|||
- Panic(errno, "setuid/setgid");
|
|||
brktty(D_userfd); |
|||
freetty(); |
|||
close(0); |
|||
diff -uNr screen-4.6.2/fileio.c screen-4.6.2.mod/fileio.c
|
|||
--- screen-4.6.2/fileio.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/fileio.c 2018-12-28 13:37:48.346041974 +0200
|
|||
@@ -591,11 +591,7 @@
|
|||
|
|||
debug2("secfopen(%s, %s)\n", name, mode); |
|||
#ifdef USE_SETEUID |
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
fi = fopen(name, mode); |
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
return fi; |
|||
|
|||
#else |
|||
@@ -633,11 +629,7 @@
|
|||
|
|||
debug3("secopen(%s, 0x%x, 0%03o)\n", name, flags, mode); |
|||
#ifdef USE_SETEUID |
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
fd = open(name, flags, mode); |
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
return fd; |
|||
#else |
|||
if (eff_uid == real_uid) |
|||
@@ -715,8 +707,6 @@
|
|||
close(0); |
|||
dup(pi[0]); |
|||
closeallfiles(0); |
|||
- if (setgid(real_gid) || setuid(real_uid))
|
|||
- Panic(errno, "printpipe setuid");
|
|||
|
|||
#ifdef SIGPIPE |
|||
signal(SIGPIPE, SIG_DFL); |
|||
@@ -755,10 +745,6 @@
|
|||
} |
|||
closeallfiles(1); |
|||
|
|||
- if (setgid(real_gid) || setuid(real_uid)) {
|
|||
- close(1);
|
|||
- Panic(errno, "setuid/setgid");
|
|||
- }
|
|||
#ifdef SIGPIPE |
|||
signal(SIGPIPE, SIG_DFL); |
|||
#endif |
|||
diff -uNr screen-4.6.2/misc.c screen-4.6.2.mod/misc.c
|
|||
--- screen-4.6.2/misc.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/misc.c 2018-12-28 13:38:36.296292600 +0200
|
|||
@@ -422,15 +422,11 @@
|
|||
signal(SIGTTIN, SIG_DFL); |
|||
signal(SIGTTOU, SIG_DFL); |
|||
# endif |
|||
- setuid(real_uid);
|
|||
- setgid(real_gid);
|
|||
return 1; |
|||
default: |
|||
return 0; |
|||
} |
|||
#else |
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
return 1; |
|||
#endif |
|||
} |
|||
@@ -445,8 +441,6 @@
|
|||
else |
|||
_exit(val); |
|||
#else |
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
UserSTAT = val; |
|||
#endif |
|||
} |
|||
diff -uNr screen-4.6.2/screen.c screen-4.6.2.mod/screen.c
|
|||
--- screen-4.6.2/screen.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/screen.c 2018-12-28 13:55:33.318060361 +0200
|
|||
@@ -976,14 +976,6 @@
|
|||
} |
|||
#endif |
|||
|
|||
-#define SET_GUID() do \
|
|||
- { \
|
|||
- setgid(real_gid); \
|
|||
- setuid(real_uid); \
|
|||
- eff_uid = real_uid; \
|
|||
- eff_gid = real_gid; \
|
|||
- } while (0)
|
|||
-
|
|||
if (home == 0 || *home == '\0') |
|||
home = ppp->pw_dir; |
|||
if (strlen(LoginName) > MAXLOGINLEN) |
|||
@@ -1175,7 +1167,6 @@
|
|||
real_uid = multi_uid; |
|||
#endif |
|||
|
|||
- SET_GUID();
|
|||
i = FindSocket((int *)NULL, &fo, &oth, SockMatch, &sock); |
|||
if (quietflag) { |
|||
if (rflag) |
|||
@@ -1194,7 +1185,6 @@
|
|||
SetTtyname(false, &st); |
|||
if (!*av) |
|||
Panic(0, "Please specify a command."); |
|||
- SET_GUID();
|
|||
SendCmdMessage(sty, SockMatch, av, queryflag >= 0); |
|||
exit(0); |
|||
} |
|||
@@ -1221,7 +1211,6 @@
|
|||
if (!SockMatch && !mflag && sty) { |
|||
/* attach_tty is not mandatory */ |
|||
SetTtyname(false, &st); |
|||
- SET_GUID();
|
|||
nwin_options.args = av; |
|||
SendCreateMsg(sty, &nwin); |
|||
exit(0); |
|||
@@ -1255,7 +1244,6 @@
|
|||
socknamebuf[NAME_MAX] = 0; |
|||
#endif |
|||
sprintf(SockPath + strlen(SockPath), "/%s", socknamebuf); |
|||
- SET_GUID();
|
|||
Attacher(); |
|||
/* NOTREACHED */ |
|||
} |
|||
@@ -1647,8 +1635,6 @@
|
|||
#if defined(SYSVSIGS) && defined(SIGHASARG) |
|||
signal(sigsig, SIG_IGN); |
|||
#endif |
|||
- setgid(getgid());
|
|||
- setuid(getuid());
|
|||
unlink("core"); |
|||
|
|||
#ifdef SIGHASARG |
|||
@@ -1803,15 +1789,7 @@
|
|||
|
|||
if (ServerSocket != -1) { |
|||
debug1("we unlink(%s)\n", SockPath); |
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
-#endif
|
|||
(void) unlink(SockPath); |
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
-#endif
|
|||
} |
|||
|
|||
for (display = displays; display; display = display->d_next) { |
|||
@@ -1840,8 +1818,6 @@
|
|||
debug("eexit\n"); |
|||
if (ServerSocket != -1) { |
|||
debug1("we unlink(%s)\n", SockPath); |
|||
- setgid(real_gid);
|
|||
- setuid(real_uid);
|
|||
(void) unlink(SockPath); |
|||
} |
|||
exit(e); |
|||
@@ -2152,14 +2128,6 @@
|
|||
} |
|||
#ifdef MULTIUSER |
|||
if (tty_oldmode >= 0) { |
|||
-
|
|||
-# ifdef USE_SETEUID
|
|||
- if (setuid(own_uid))
|
|||
- xseteuid(own_uid); /* may be a loop. sigh. */
|
|||
-# else
|
|||
- setuid(own_uid);
|
|||
-# endif
|
|||
-
|
|||
debug1("Panic: changing back modes from %s\n", attach_tty); |
|||
chmod(attach_tty, tty_oldmode); |
|||
} |
|||
diff -uNr screen-4.6.2/socket.c screen-4.6.2.mod/socket.c
|
|||
--- screen-4.6.2/socket.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/socket.c 2018-12-28 13:41:48.932302337 +0200
|
|||
@@ -164,11 +164,6 @@
|
|||
*/ |
|||
sdirlen = strlen(SockPath); |
|||
|
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
-#endif
|
|||
-
|
|||
if ((dirp = opendir(SockPath)) == 0) |
|||
Panic(errno, "Cannot opendir %s", SockPath); |
|||
|
|||
@@ -262,11 +257,6 @@
|
|||
slisttail = &sent->next; |
|||
nfound++; |
|||
sockfd = MakeClientSocket(0, *is_sock); |
|||
-#ifdef USE_SETEUID
|
|||
- /* MakeClientSocket sets ids back to eff */
|
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
-#endif
|
|||
if (sockfd == -1) |
|||
{ |
|||
debug2(" MakeClientSocket failed, unreachable? %d %d\n", |
|||
@@ -412,10 +402,6 @@
|
|||
free(sent->name); |
|||
free((char *)sent); |
|||
} |
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
-#endif
|
|||
if (notherp) |
|||
*notherp = npriv; |
|||
if (nfoundp) |
|||
@@ -430,10 +416,6 @@
|
|||
register int s; |
|||
struct stat st; |
|||
|
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
-#endif
|
|||
s = open(SockPath, O_WRONLY | O_NONBLOCK); |
|||
if (s >= 0) |
|||
{ |
|||
@@ -472,9 +454,6 @@
|
|||
if (s < 0) |
|||
Panic(errno, "open fifo %s", SockPath); |
|||
|
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
-
|
|||
return s; |
|||
|
|||
# else /* !USE_SETEUID */ |
|||
@@ -533,10 +512,6 @@
|
|||
strncpy(a.sun_path, SockPath, sizeof(a.sun_path)); |
|||
a.sun_path[sizeof(a.sun_path) - 1] = 0; |
|||
|
|||
-# ifdef USE_SETEUID
|
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
-# endif
|
|||
if (connect(s, (struct sockaddr *) &a, strlen(SockPath) + 2) != -1) |
|||
{ |
|||
debug("oooooh! socket already is alive!\n"); |
|||
@@ -594,10 +569,6 @@
|
|||
fcntl(s, F_SETOWN, getpid()); |
|||
debug1("Serversocket owned by %d\n", fcntl(s, F_GETOWN, 0)); |
|||
#endif /* F_SETOWN */ |
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
-#endif
|
|||
return s; |
|||
} |
|||
|
|||
@@ -615,10 +586,6 @@
|
|||
a.sun_family = AF_UNIX; |
|||
strncpy(a.sun_path, SockPath, sizeof(a.sun_path)); |
|||
a.sun_path[sizeof(a.sun_path) - 1] = 0; |
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
-#else
|
|||
if (access(SockPath, W_OK)) |
|||
{ |
|||
if (err) |
|||
@@ -627,7 +594,6 @@
|
|||
close(s); |
|||
return -1; |
|||
} |
|||
-#endif
|
|||
if (connect(s, (struct sockaddr *)&a, strlen(SockPath) + 2) == -1) |
|||
{ |
|||
if (err) |
|||
@@ -636,10 +602,6 @@
|
|||
close(s); |
|||
s = -1; |
|||
} |
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
-#endif
|
|||
return s; |
|||
} |
|||
|
|||
diff -uNr screen-4.6.2/termcap.c screen-4.6.2.mod/termcap.c
|
|||
--- screen-4.6.2/termcap.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/termcap.c 2018-12-28 13:42:17.886548054 +0200
|
|||
@@ -1334,15 +1334,7 @@
|
|||
{ |
|||
int r; |
|||
|
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(real_uid);
|
|||
- xsetegid(real_gid);
|
|||
-#endif
|
|||
r = tgetent(bp, name); |
|||
-#ifdef USE_SETEUID
|
|||
- xseteuid(eff_uid);
|
|||
- xsetegid(eff_gid);
|
|||
-#endif
|
|||
return r; |
|||
} |
|||
|
|||
diff -uNr screen-4.6.2/window.c screen-4.6.2.mod/window.c
|
|||
--- screen-4.6.2/window.c 2017-10-23 14:32:41.000000000 +0300
|
|||
+++ screen-4.6.2.mod/window.c 2018-12-28 13:35:35.264541270 +0200
|
|||
@@ -1268,8 +1268,6 @@
|
|||
#endif |
|||
|
|||
displays = 0; /* beware of Panic() */ |
|||
- if (setgid(real_gid) || setuid(real_uid))
|
|||
- Panic(errno, "Setuid/gid");
|
|||
eff_uid = real_uid; |
|||
eff_gid = real_gid; |
|||
#ifdef PSEUDOS |
@ -1,11 +1,15 @@ |
|||
--- ../cache/screen-4.4.0/window.c 2016-06-19 19:41:03.000000000 +0000
|
|||
+++ ./window.c 2016-12-20 04:50:22.247981493 +0000
|
|||
@@ -112,7 +112,7 @@
|
|||
diff -u -r ../screen-4.7.0/window.c ./window.c
|
|||
--- ../screen-4.7.0/window.c 2019-10-01 22:08:00.000000000 +0000
|
|||
+++ ./window.c 2019-10-02 19:42:56.044224400 +0000
|
|||
@@ -112,9 +112,9 @@
|
|||
|
|||
int VerboseCreate = 0; /* XXX move this to user.h */ |
|||
|
|||
-char DefaultShell[] = "/bin/sh";
|
|||
+char DefaultShell[] = "@TERMUX_PREFIX@/bin/login";
|
|||
#ifndef HAVE_EXECVPE |
|||
static char DefaultPath[] = ":/usr/ucb:/bin:/usr/bin"; |
|||
-static char DefaultPath[] = ":/usr/ucb:/bin:/usr/bin";
|
|||
+static char DefaultPath[] = ":@TERMUX_PREFIX@/bin";
|
|||
#endif |
|||
|
|||
/* keep this in sync with the structure definition in window.h */ |
|||
|
Loading…
Reference in new issue