1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Merge dtksh patches from one of the CDE developers (#85)

This merges some fixes to support building dtksh with -DBUILD_DTKSH.
These patches were sent through private email from the CDE developer
Chase. The reason these patches were submitted is because Chase wishes
to include ksh in CDE as an up-to-date git submodule. Quote from Chase:
"... my priority is to get your new version into our code as a git
 submodule, and do it quickly before our code bases differ too widely."

Link to CDE project for anyone interested:
https://sourceforge.net/projects/cdesktopenv/

Although the patches were privately discussed, there are some public
emails on the CDE mailing list (links shortened due to long URLs):
ksh-chaos thread:   https://bit.ly/3hjJ83b
dtksh alias thread: https://bit.ly/3hkzKfJ

The main fix is for suid_exec, which is now told that /usr/dt is a
valid directory to run from via preprocessor flags. A patch for
Shift-JIS was also submitted, but it isn't in this commit because it
isn't an effective fix for the existing Shift-JIS bugs. I will be
giving that patch some more testing.

From: Chase <nicetrynsa@protonmail.ch>
Co-authored by: Johnothan King <johnothanking@protonmail.com>
This commit is contained in:
Johnothan King 2020-07-21 22:44:24 -07:00 committed by GitHub
parent 88e8fa67c6
commit e2d1b593ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View file

@ -62,7 +62,11 @@
#define FDVERIFY 12 /* used to validate /tmp process */
#undef BLKSIZE
#define BLKSIZE sizeof(char*)*1024
#if BUILD_DTKSH
#define THISPROG SUIDEXECPATH
#else
#define THISPROG "/etc/suid_exec"
#endif
#define DEFSHELL "/bin/sh"
static void error_exit(const char*);
@ -235,6 +239,9 @@ exec:
/* only use SHELL if file is in trusted directory and ends in sh */
shell = getenv("SHELL");
if(shell == 0 || !endsh(shell) || (
#ifdef BUILD_DTKSH
!in_dir(CDE_INSTALLATION_TOP"/bin",shell) &&
#endif
!in_dir("/bin",shell) &&
!in_dir("/usr/bin",shell) &&
!in_dir("/usr/lbin",shell) &&