Only inherit SELinux role/type and Solaris privilege sets if

the command does not include any.  Previously, a command with
only a role would inherit a type from the previous command
which is not what was intended.
This commit is contained in:
Todd C. Miller
2017-02-14 15:56:34 -07:00
parent 24cdbb8de1
commit d7f7cf7a79
2 changed files with 8 additions and 8 deletions

View File

@@ -1436,17 +1436,17 @@ case 35:
HLTQ_CONCAT(yyvsp[-2].cmndspec, yyvsp[0].cmndspec, entries);
#ifdef HAVE_SELINUX
/* propagate role and type */
if (yyvsp[0].cmndspec->role == NULL)
if (yyvsp[0].cmndspec->role == NULL && yyvsp[0].cmndspec->type == NULL) {
yyvsp[0].cmndspec->role = prev->role;
if (yyvsp[0].cmndspec->type == NULL)
yyvsp[0].cmndspec->type = prev->type;
}
#endif /* HAVE_SELINUX */
#ifdef HAVE_PRIV_SET
/* propagate privs & limitprivs */
if (yyvsp[0].cmndspec->privs == NULL)
if (yyvsp[0].cmndspec->privs == NULL && yyvsp[0].cmndspec->limitprivs == NULL) {
yyvsp[0].cmndspec->privs = prev->privs;
if (yyvsp[0].cmndspec->limitprivs == NULL)
yyvsp[0].cmndspec->limitprivs = prev->limitprivs;
}
#endif /* HAVE_PRIV_SET */
/* propagate command timeout */
if (yyvsp[0].cmndspec->timeout == UNSPEC)