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:
		
							parent
							
								
									88e8fa67c6
								
							
						
					
					
						commit
						e2d1b593ac
					
				
					 3 changed files with 23 additions and 0 deletions
				
			
		|  | @ -178,8 +178,13 @@ const char e_traceprompt[]	= "+ "; | |||
| const char e_supprompt[]	= "# "; | ||||
| const char e_stdprompt[]	= "$ "; | ||||
| const char e_profile[]		= "$HOME/.profile"; | ||||
| #ifdef BUILD_DTKSH | ||||
| const char e_sysprofile[] = PROFILEPATH; | ||||
| const char e_suidprofile[] = SUIDPROFILEPATH; | ||||
| #else | ||||
| const char e_sysprofile[]	= "/etc/profile"; | ||||
| const char e_suidprofile[]	= "/etc/suid_profile"; | ||||
| #endif | ||||
| #if SHOPT_SYSRC | ||||
| const char e_sysrc[]		= "/etc/ksh.kshrc"; | ||||
| #endif | ||||
|  | @ -194,9 +199,13 @@ const char e_bash_profile[]	= "$HOME/.bash_profile"; | |||
| #endif | ||||
| const char e_crondir[]		= "/usr/spool/cron/atjobs"; | ||||
| const char e_prohibited[]	= "login setuid/setgid shells prohibited"; | ||||
| #ifdef BUILD_DTKSH | ||||
|    const char e_suidexec[]      = SUIDEXECPATH; | ||||
| #else | ||||
| #if SHOPT_SUID_EXEC | ||||
|    const char e_suidexec[]	= "/etc/suid_exec"; | ||||
| #endif /* SHOPT_SUID_EXEC */ | ||||
| #endif | ||||
| const char hist_fname[]		= "/.sh_history"; | ||||
| const char e_dot[]		= "."; | ||||
| const char e_envmarker[]	= "A__z"; | ||||
|  |  | |||
|  | @ -33,6 +33,10 @@ | |||
| #include	<cdt.h> | ||||
| #include	<option.h> | ||||
| 
 | ||||
| #ifdef BUILD_DTKSH | ||||
| #include       <hash.h> | ||||
| #endif | ||||
| 
 | ||||
| /* for compatibility with old hash library */ | ||||
| #define Hashtab_t	Dt_t | ||||
| #define HASH_BUCKET	1 | ||||
|  | @ -111,6 +115,9 @@ struct Namdecl | |||
| /* This defines the attributes for an attributed name-value pair node */ | ||||
| struct Namval | ||||
| { | ||||
| #if BUILD_DTKSH | ||||
| 	HASH_HEADER;                    /* space for hash library */ | ||||
| #endif | ||||
| 	Dtlink_t	nvlink;		/* space for cdt links */ | ||||
| 	char		*nvname;	/* pointer to name of the node */ | ||||
| #if _ast_sizeof_pointer == 8 | ||||
|  |  | |||
|  | @ -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) && | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue