Make sudoedit work with SELinux RBAC.

Adapted from RedHat patches (Daniel Kopecek) but made to behave a
bit more like the non-SELinux bits.
This commit is contained in:
Todd C. Miller
2014-08-21 15:28:36 -06:00
parent a147330f3f
commit db35c7c0e4
5 changed files with 392 additions and 31 deletions

View File

@@ -1045,6 +1045,14 @@ run_command(struct command_details *details)
break;
case CMD_WSTATUS:
/* Command ran, exited or was killed. */
if (WIFEXITED(cstat.val))
exitcode = WEXITSTATUS(cstat.val);
else if (WIFSIGNALED(cstat.val))
exitcode = WTERMSIG(cstat.val) | 128;
#ifdef HAVE_SELINUX
if (ISSET(details->flags, CD_SUDOEDIT_COPY))
break;
#endif
sudo_debug_printf(SUDO_DEBUG_DEBUG,
"calling policy close with wait status %d", cstat.val);
policy_close(&policy_plugin, cstat.val, 0);
@@ -1053,10 +1061,6 @@ run_command(struct command_details *details)
"calling I/O close with wait status %d", cstat.val);
iolog_close(plugin, cstat.val, 0);
}
if (WIFEXITED(cstat.val))
exitcode = WEXITSTATUS(cstat.val);
else if (WIFSIGNALED(cstat.val))
exitcode = WTERMSIG(cstat.val) | 128;
break;
default:
sudo_warnx(U_("unexpected child termination condition: %d"), cstat.type);