mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 00:31:16 +00:00
run_shell: code shrink for selinux
This commit is contained in:
parent
a2f61012b6
commit
976690afe0
@ -39,15 +39,13 @@ static security_context_t current_sid;
|
|||||||
void
|
void
|
||||||
renew_current_security_context(void)
|
renew_current_security_context(void)
|
||||||
{
|
{
|
||||||
if (current_sid)
|
freecon(current_sid); /* Release old context */
|
||||||
freecon(current_sid); /* Release old context */
|
|
||||||
getcon(¤t_sid); /* update */
|
getcon(¤t_sid); /* update */
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
set_current_security_context(security_context_t sid)
|
set_current_security_context(security_context_t sid)
|
||||||
{
|
{
|
||||||
if (current_sid)
|
freecon(current_sid); /* Release old context */
|
||||||
freecon(current_sid); /* Release old context */
|
|
||||||
current_sid = sid;
|
current_sid = sid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,10 +82,10 @@ void run_shell(const char *shell, int loginshell, const char *command, const cha
|
|||||||
}
|
}
|
||||||
args[argno] = NULL;
|
args[argno] = NULL;
|
||||||
#if ENABLE_SELINUX
|
#if ENABLE_SELINUX
|
||||||
if (current_sid && !setexeccon(current_sid)) {
|
if (current_sid)
|
||||||
|
setexeccon(current_sid);
|
||||||
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
freecon(current_sid);
|
freecon(current_sid);
|
||||||
execve(shell, (char **) args, environ);
|
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
execv(shell, (char **) args);
|
execv(shell, (char **) args);
|
||||||
bb_perror_msg_and_die("cannot run %s", shell);
|
bb_perror_msg_and_die("cannot run %s", shell);
|
||||||
|
Loading…
Reference in New Issue
Block a user