mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix compiling with SHOPT_REGRESS and SHOPT_P_SUID
src/cmd/ksh93/Mamfile: - regress.c: add missing SH_DICT define for getopt self-doc string, needed after USAGE_LICENSE macros were removed. (re:ede47996
) src/cmd/ksh93/init.c: sh_init(): - Do not set error_info.exit early in init. This is the function that is called when an error exits the shell. It defaults to exit(3). Setting it to sh_exit() early on can cause a crash if an error is thrown before shell initialisation is fully finished. So set it at the end of sh_init() instead. - __regress__: Remove error_info.exit workaround. (re:506bd2b2
) - Fix SHOPT_P_SUID directive. This is not actually a 0/1 value, so we should use #ifdef and not #if. If SHOPT_REGRESS is on, it it set to a function call. (re:2182ecfa
) src/cmd/ksh93/SHOPT.sh: - Document that SHOPT_P_SUID cannot be set to 0 to be turned off.
This commit is contained in:
parent
5d82004426
commit
6146848693
3 changed files with 4 additions and 6 deletions
|
@ -818,7 +818,7 @@ make install
|
|||
meta regress.o %.c>%.o bltins/regress.c regress
|
||||
prev bltins/regress.c
|
||||
prev SHOPT.sh
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -D_BLD_shell -DKSHELL -DERROR_CONTEXT_T=Error_context_t -c bltins/regress.c
|
||||
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${KSH_SHOPTFLAGS} ${CCFLAGS} -DSH_DICT=${SH_DICT} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} -D_API_ast=20100309 -D_PACKAGE_ast -D_BLD_shell -DKSHELL -DERROR_CONTEXT_T=Error_context_t -c bltins/regress.c
|
||||
done regress.o generated
|
||||
make fault.o
|
||||
make sh/fault.c
|
||||
|
|
|
@ -26,7 +26,7 @@ SHOPT NAMESPACE=1 # allow namespaces
|
|||
SHOPT OLDTERMIO= # support both TCGETA and TCGETS
|
||||
SHOPT OPTIMIZE=1 # optimize loop invariants
|
||||
SHOPT PFSH=0 # solaris exec_attr(4) profile execution (obsolete)
|
||||
SHOPT P_SUID= # real uid's that require -p for set[ug]id
|
||||
SHOPT P_SUID= # real uid's that require -p for set[ug]id (do not set to 0 to turn off)
|
||||
SHOPT RAWONLY=1 # make viraw the only vi mode
|
||||
SHOPT REGRESS= # enable __regress__ builtin and instrumented intercepts for testing
|
||||
SHOPT REMOTE= # enable --rc if running as a remote shell
|
||||
|
|
|
@ -1257,7 +1257,6 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
|||
if(shgd->lim.clk_tck <=0)
|
||||
shgd->lim.clk_tck = CLK_TCK;
|
||||
shgd->ed_context = (void*)ed_open(shp);
|
||||
error_info.exit = sh_exit;
|
||||
error_info.id = path_basename(argv[0]);
|
||||
}
|
||||
else
|
||||
|
@ -1301,9 +1300,7 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
|||
break;
|
||||
nopt = optctx(0, 0);
|
||||
oopt = optctx(nopt, 0);
|
||||
error_info.exit = exit; /* avoid crash on b___regress__ error as shell is not fully initialized */
|
||||
b___regress__(2, regress, &shp->bltindata);
|
||||
error_info.exit = sh_exit;
|
||||
optctx(oopt, nopt);
|
||||
}
|
||||
}
|
||||
|
@ -1462,7 +1459,7 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
|||
/* set[ug]id scripts require the -p flag */
|
||||
if(shp->gd->userid!=shp->gd->euserid || shp->gd->groupid!=shp->gd->egroupid)
|
||||
{
|
||||
#if SHOPT_P_SUID
|
||||
#ifdef SHOPT_P_SUID
|
||||
/* require sh -p to run setuid and/or setgid */
|
||||
if(!sh_isoption(SH_PRIVILEGED) && shp->gd->userid >= SHOPT_P_SUID)
|
||||
{
|
||||
|
@ -1527,6 +1524,7 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
|||
shp->exittrap = 0;
|
||||
shp->errtrap = 0;
|
||||
shp->end_fn = 0;
|
||||
error_info.exit = sh_exit;
|
||||
return(shp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue