795 |
* Returns pointer to the condition part if it was found in the statement, |
* Returns pointer to the condition part if it was found in the statement, |
796 |
* NULL otherwise. |
* NULL otherwise. |
797 |
*/ |
*/ |
798 |
static char *ccs_find_condition_part(char *data) |
char *ccs_find_condition_part(char *data) |
799 |
{ |
{ |
800 |
char *cp = strstr(data, " if "); |
char *cp = strstr(data, " if "); |
801 |
if (cp) { |
if (!cp) |
|
while (1) { |
|
|
char *cp2 = strstr(cp + 3, " if "); |
|
|
if (!cp2) |
|
|
break; |
|
|
cp = cp2; |
|
|
} |
|
|
*cp++ = '\0'; |
|
|
} else { |
|
802 |
cp = strstr(data, " ; set "); |
cp = strstr(data, " ; set "); |
803 |
if (cp) |
if (cp) |
804 |
*cp++ = '\0'; |
*cp++ = '\0'; |
|
} |
|
805 |
return cp; |
return cp; |
806 |
} |
} |
807 |
|
|
1196 |
cond->post_state[j])) |
cond->post_state[j])) |
1197 |
goto out; |
goto out; |
1198 |
} |
} |
1199 |
|
if (i & (1 << 4)) { |
1200 |
|
if (!ccs_io_printf(head, " audit=%s", |
1201 |
|
ccs_yesno(cond->post_state[4]))) |
1202 |
|
goto out; |
1203 |
|
} |
1204 |
no_condition: |
no_condition: |
1205 |
if (ccs_io_printf(head, "\n")) |
if (ccs_io_printf(head, "\n")) |
1206 |
return true; |
return true; |
1927 |
list_for_each_cookie(pos, head->read_var2, &ccs_policy_list[idx]) { |
list_for_each_cookie(pos, head->read_var2, &ccs_policy_list[idx]) { |
1928 |
const char *w[4] = { "", "", "", "" }; |
const char *w[4] = { "", "", "", "" }; |
1929 |
char buffer[16]; |
char buffer[16]; |
1930 |
|
struct ccs_condition *cond = NULL; |
1931 |
struct ccs_acl_head *acl = container_of(pos, typeof(*acl), |
struct ccs_acl_head *acl = container_of(pos, typeof(*acl), |
1932 |
list); |
list); |
1933 |
if (acl->is_deleted) |
if (acl->is_deleted) |
1977 |
container_of(acl, typeof(*ptr), head); |
container_of(acl, typeof(*ptr), head); |
1978 |
w[0] = CCS_KEYWORD_ALLOW_READ; |
w[0] = CCS_KEYWORD_ALLOW_READ; |
1979 |
w[1] = ptr->filename->name; |
w[1] = ptr->filename->name; |
1980 |
|
cond = ptr->cond; |
1981 |
} |
} |
1982 |
break; |
break; |
1983 |
case CCS_ID_PATTERN: |
case CCS_ID_PATTERN: |
2002 |
container_of(acl, typeof(*ptr), head); |
container_of(acl, typeof(*ptr), head); |
2003 |
w[0] = CCS_KEYWORD_ALLOW_ENV; |
w[0] = CCS_KEYWORD_ALLOW_ENV; |
2004 |
w[1] = ptr->env->name; |
w[1] = ptr->env->name; |
2005 |
|
cond = ptr->cond; |
2006 |
} |
} |
2007 |
break; |
break; |
2008 |
case CCS_ID_RESERVEDPORT: |
case CCS_ID_RESERVEDPORT: |
2019 |
w[1] = buffer; |
w[1] = buffer; |
2020 |
} |
} |
2021 |
break; |
break; |
2022 |
|
default: |
2023 |
|
continue; |
2024 |
|
} |
2025 |
|
{ |
2026 |
|
const int pos = head->read_avail; |
2027 |
|
if (!ccs_io_printf(head, "%s%s%s%s", w[0], w[1], |
2028 |
|
w[2], w[3]) |
2029 |
|
|| !ccs_print_condition(head, cond)) { |
2030 |
|
head->read_avail = pos; |
2031 |
|
return false; |
2032 |
|
} |
2033 |
} |
} |
|
if (!ccs_io_printf(head, "%s%s%s%s\n", w[0], w[1], w[2], w[3])) |
|
|
return false; |
|
2034 |
} |
} |
2035 |
return true; |
return true; |
2036 |
} |
} |