40 |
static struct ccs_profile *ccs_profile_ptr[CCS_MAX_PROFILES]; |
static struct ccs_profile *ccs_profile_ptr[CCS_MAX_PROFILES]; |
41 |
|
|
42 |
/* String table for functionality that takes 4 modes. */ |
/* String table for functionality that takes 4 modes. */ |
43 |
static const char *ccs_mode_4[4] = { |
static const char *ccs_mode[CCS_CONFIG_MAX_MODE] = { |
44 |
"disabled", "learning", "permissive", "enforcing" |
[CCS_CONFIG_DISABLED] = "disabled", |
45 |
|
[CCS_CONFIG_LEARNING] = "learning", |
46 |
|
[CCS_CONFIG_PERMISSIVE] = "permissive", |
47 |
|
[CCS_CONFIG_ENFORCING] = "enforcing" |
48 |
}; |
}; |
49 |
|
|
50 |
/* String table for /proc/ccs/profile */ |
/* String table for /proc/ccs/profile */ |
455 |
config = CCS_CONFIG_USE_DEFAULT; |
config = CCS_CONFIG_USE_DEFAULT; |
456 |
} else { |
} else { |
457 |
u8 mode; |
u8 mode; |
458 |
for (mode = 0; mode <= 3; mode--) |
for (mode = 0; mode < CCS_CONFIG_MAX_MODE; mode--) |
459 |
if (strstr(cp, ccs_mode_4[mode])) |
if (strstr(cp, ccs_mode[mode])) |
460 |
/* |
/* |
461 |
* Update lower 3 bits in order to distinguish |
* Update lower 3 bits in order to distinguish |
462 |
* 'config' from 'CCS_CONFIG_USE_DEAFULT'. |
* 'config' from 'CCS_CONFIG_USE_DEAFULT'. |
638 |
#ifdef CONFIG_CCSECURITY_AUDIT |
#ifdef CONFIG_CCSECURITY_AUDIT |
639 |
if (!ccs_io_printf(head, "%u-%s%s={ mode=%s " |
if (!ccs_io_printf(head, "%u-%s%s={ mode=%s " |
640 |
"grant_log=%s reject_log=%s }\n", index, |
"grant_log=%s reject_log=%s }\n", index, |
641 |
"CONFIG", "", ccs_mode_4[config & 3], |
"CONFIG", "", ccs_mode[config & 3], |
642 |
ccs_yesno(config & |
ccs_yesno(config & |
643 |
CCS_CONFIG_WANT_GRANT_LOG), |
CCS_CONFIG_WANT_GRANT_LOG), |
644 |
ccs_yesno(config & |
ccs_yesno(config & |
646 |
goto out; |
goto out; |
647 |
#else |
#else |
648 |
if (!ccs_io_printf(head, "%u-%s%s={ mode=%s }\n", index, |
if (!ccs_io_printf(head, "%u-%s%s={ mode=%s }\n", index, |
649 |
"CONFIG", "", ccs_mode_4[config & 3])) |
"CONFIG", "", ccs_mode[config & 3])) |
650 |
goto out; |
goto out; |
651 |
#endif |
#endif |
652 |
for (i = 0; i < CCS_MAX_MAC_INDEX + CCS_MAX_CAPABILITY_INDEX |
for (i = 0; i < CCS_MAX_MAC_INDEX + CCS_MAX_CAPABILITY_INDEX |
665 |
"grant_log=%s reject_log=%s }\n", |
"grant_log=%s reject_log=%s }\n", |
666 |
index, "CONFIG::", |
index, "CONFIG::", |
667 |
ccs_mac_keywords[i], |
ccs_mac_keywords[i], |
668 |
ccs_mode_4[config & 3], g, r)) |
ccs_mode[config & 3], g, r)) |
669 |
goto out; |
goto out; |
670 |
#else |
#else |
671 |
if (!ccs_io_printf(head, "%u-%s%s={ mode=%s }\n", |
if (!ccs_io_printf(head, "%u-%s%s={ mode=%s }\n", |
672 |
index, "CONFIG::", |
index, "CONFIG::", |
673 |
ccs_mac_keywords[i], |
ccs_mac_keywords[i], |
674 |
ccs_mode_4[config & 3])) |
ccs_mode[config & 3])) |
675 |
goto out; |
goto out; |
676 |
#endif |
#endif |
677 |
} |
} |