20 |
"disabled", "enabled" |
"disabled", "enabled" |
21 |
}; |
}; |
22 |
|
|
23 |
|
/* String table for functionality that takes 4 modes. */ |
24 |
static const char *ccs_mode_4[4] = { |
static const char *ccs_mode_4[4] = { |
25 |
"disabled", "learning", "permissive", "enforcing" |
"disabled", "learning", "permissive", "enforcing" |
26 |
}; |
}; |
27 |
|
|
28 |
|
/* String table for /proc/ccs/profile */ |
29 |
static const char *ccs_mac_keywords[CCS_MAX_MAC_INDEX + |
static const char *ccs_mac_keywords[CCS_MAX_MAC_INDEX + |
30 |
CCS_MAX_CAPABILITY_INDEX + |
CCS_MAX_CAPABILITY_INDEX + |
31 |
CCS_MAX_MAC_CATEGORY_INDEX] = { |
CCS_MAX_MAC_CATEGORY_INDEX] = { |
172 |
}; |
}; |
173 |
|
|
174 |
/* Table for profile. */ |
/* Table for profile. */ |
175 |
static struct { |
static const struct { |
176 |
const char *keyword; |
const char *keyword; |
177 |
unsigned int current_value; |
unsigned int current_value; |
178 |
const unsigned int max_value; |
const unsigned int max_value; |
194 |
/* Permit policy management by non-root user? */ |
/* Permit policy management by non-root user? */ |
195 |
static bool ccs_manage_by_non_root; |
static bool ccs_manage_by_non_root; |
196 |
|
|
197 |
|
/* Disable VERBOSE mode by default? */ |
198 |
|
static bool ccs_no_verbose; |
199 |
|
|
200 |
/** |
/** |
201 |
* ccs_cap2keyword - Convert capability operation to capability name. |
* ccs_cap2keyword - Convert capability operation to capability name. |
202 |
* |
* |
219 |
*/ |
*/ |
220 |
static int __init ccs_quiet_setup(char *str) |
static int __init ccs_quiet_setup(char *str) |
221 |
{ |
{ |
222 |
ccs_control_array[CCS_VERBOSE].current_value = 0; |
ccs_no_verbose = true; |
223 |
return 0; |
return 0; |
224 |
} |
} |
225 |
|
|
277 |
ptr = entry; |
ptr = entry; |
278 |
for (i = 0; i < CCS_MAX_CONTROL_INDEX; i++) |
for (i = 0; i < CCS_MAX_CONTROL_INDEX; i++) |
279 |
ptr->value[i] = ccs_control_array[i].current_value; |
ptr->value[i] = ccs_control_array[i].current_value; |
280 |
|
ptr->value[CCS_VERBOSE] = !ccs_no_verbose; |
281 |
ptr->default_config = CCS_MAC_MODE_DISABLED; |
ptr->default_config = CCS_MAC_MODE_DISABLED; |
282 |
memset(ptr->config, CCS_MAC_MODE_USE_DEFAULT, |
memset(ptr->config, CCS_MAC_MODE_USE_DEFAULT, |
283 |
sizeof(ptr->config)); |
sizeof(ptr->config)); |
785 |
return error; |
return error; |
786 |
} |
} |
787 |
|
|
788 |
|
/** |
789 |
|
* ccs_print_name_union - Print a ccs_name_union. |
790 |
|
* |
791 |
|
* @head: Pointer to "struct ccs_io_buffer". |
792 |
|
* @ptr: Pointer to "struct ccs_name_union". |
793 |
|
* |
794 |
|
* Returns true on success, false otherwise. |
795 |
|
*/ |
796 |
static bool ccs_print_name_union(struct ccs_io_buffer *head, |
static bool ccs_print_name_union(struct ccs_io_buffer *head, |
797 |
const struct ccs_name_union *ptr) |
const struct ccs_name_union *ptr) |
798 |
{ |
{ |
805 |
return ccs_io_printf(head, " %s", ptr->filename->name); |
return ccs_io_printf(head, " %s", ptr->filename->name); |
806 |
} |
} |
807 |
|
|
808 |
|
/** |
809 |
|
* ccs_print_name_union_quoted - Print a ccs_name_union with double quotes. |
810 |
|
* |
811 |
|
* @head: Pointer to "struct ccs_io_buffer". |
812 |
|
* @ptr: Pointer to "struct ccs_name_union". |
813 |
|
* |
814 |
|
* Returns true on success, false otherwise. |
815 |
|
*/ |
816 |
static bool ccs_print_name_union_quoted(struct ccs_io_buffer *head, |
static bool ccs_print_name_union_quoted(struct ccs_io_buffer *head, |
817 |
const struct ccs_name_union *ptr) |
const struct ccs_name_union *ptr) |
818 |
{ |
{ |
822 |
return ccs_io_printf(head, "\"%s\"", ptr->filename->name); |
return ccs_io_printf(head, "\"%s\"", ptr->filename->name); |
823 |
} |
} |
824 |
|
|
825 |
|
/** |
826 |
|
* ccs_print_number_union_common - Print a ccs_number_union. |
827 |
|
* |
828 |
|
* @head: Pointer to "struct ccs_io_buffer". |
829 |
|
* @ptr: Pointer to "struct ccs_number_union". |
830 |
|
* @need_space: True if a space character is needed. |
831 |
|
* |
832 |
|
* Returns true on success, false otherwise. |
833 |
|
*/ |
834 |
static bool ccs_print_number_union_common(struct ccs_io_buffer *head, |
static bool ccs_print_number_union_common(struct ccs_io_buffer *head, |
835 |
const struct ccs_number_union *ptr, |
const struct ccs_number_union *ptr, |
836 |
const bool need_space) |
const bool need_space) |
874 |
} |
} |
875 |
} |
} |
876 |
|
|
877 |
|
/** |
878 |
|
* ccs_print_number_union - Print a ccs_number_union. |
879 |
|
* |
880 |
|
* @head: Pointer to "struct ccs_io_buffer". |
881 |
|
* @ptr: Pointer to "struct ccs_number_union". |
882 |
|
* |
883 |
|
* Returns true on success, false otherwise. |
884 |
|
*/ |
885 |
bool ccs_print_number_union(struct ccs_io_buffer *head, |
bool ccs_print_number_union(struct ccs_io_buffer *head, |
886 |
const struct ccs_number_union *ptr) |
const struct ccs_number_union *ptr) |
887 |
{ |
{ |
888 |
return ccs_print_number_union_common(head, ptr, true); |
return ccs_print_number_union_common(head, ptr, true); |
889 |
} |
} |
890 |
|
|
891 |
|
/** |
892 |
|
* ccs_print_number_union_nospace - Print a ccs_number_union without a space character. |
893 |
|
* |
894 |
|
* @head: Pointer to "struct ccs_io_buffer". |
895 |
|
* @ptr: Pointer to "struct ccs_number_union". |
896 |
|
* |
897 |
|
* Returns true on success, false otherwise. |
898 |
|
*/ |
899 |
static bool ccs_print_number_union_nospace(struct ccs_io_buffer *head, |
static bool ccs_print_number_union_nospace(struct ccs_io_buffer *head, |
900 |
const struct ccs_number_union *ptr) |
const struct ccs_number_union *ptr) |
901 |
{ |
{ |
1089 |
} |
} |
1090 |
|
|
1091 |
/** |
/** |
1092 |
* ccs_print_path2_acl - Print a double path ACL entry. |
* ccs_print_path2_acl - Print a path2 ACL entry. |
1093 |
* |
* |
1094 |
* @head: Pointer to "struct ccs_io_buffer". |
* @head: Pointer to "struct ccs_io_buffer". |
1095 |
* @ptr: Pointer to "struct ccs_path2_acl". |
* @ptr: Pointer to "struct ccs_path2_acl". |
1123 |
} |
} |
1124 |
|
|
1125 |
/** |
/** |
1126 |
* ccs_print_path_number_acl - Print an ioctl/chmod/chown/chgrp ACL entry. |
* ccs_print_path_number_acl - Print a path_number ACL entry. |
1127 |
* |
* |
1128 |
* @head: Pointer to "struct ccs_io_buffer". |
* @head: Pointer to "struct ccs_io_buffer". |
1129 |
* @ptr: Pointer to "struct ccs_path_number_acl". |
* @ptr: Pointer to "struct ccs_path_number_acl". |
1613 |
* This is equivalent to doing |
* This is equivalent to doing |
1614 |
* |
* |
1615 |
* ( echo "select " $domainname; echo "use_profile " $profile ) | |
* ( echo "select " $domainname; echo "use_profile " $profile ) | |
1616 |
* /usr/lib/ccs/loadpolicy -d |
* /usr/sbin/ccs-loadpolicy -d |
1617 |
* |
* |
1618 |
* Caller holds ccs_read_lock(). |
* Caller holds ccs_read_lock(). |
1619 |
*/ |
*/ |
1906 |
return false; |
return false; |
1907 |
} |
} |
1908 |
|
|
1909 |
|
/** |
1910 |
|
* ccs_get_execute_condition - Get condition part for execute requests. |
1911 |
|
* |
1912 |
|
* @ee: Pointer to "struct ccs_execve_entry". |
1913 |
|
* |
1914 |
|
* Returns pointer to "struct ccs_condition" on success, NULL otherwise. |
1915 |
|
*/ |
1916 |
static struct ccs_condition *ccs_get_execute_condition(struct ccs_execve_entry |
static struct ccs_condition *ccs_get_execute_condition(struct ccs_execve_entry |
1917 |
*ee) |
*ee) |
1918 |
{ |
{ |
1932 |
if (realpath) |
if (realpath) |
1933 |
len += strlen(realpath) + 17; |
len += strlen(realpath) + 17; |
1934 |
} |
} |
1935 |
if (ccs_flags(NULL, CCS_AUTOLEARN_EXEC_REALPATH)) { |
if (ccs_flags(NULL, CCS_AUTOLEARN_EXEC_ARGV0)) { |
1936 |
if (ccs_get_argv0(ee)) { |
if (ccs_get_argv0(ee)) { |
1937 |
argv0 = ee->tmp; |
argv0 = ee->tmp; |
1938 |
len += strlen(argv0) + 16; |
len += strlen(argv0) + 16; |
2424 |
* @wait: Pointer to "poll_table". |
* @wait: Pointer to "poll_table". |
2425 |
* |
* |
2426 |
* Waits for read readiness. |
* Waits for read readiness. |
2427 |
* /proc/ccs/query is handled by /usr/lib/ccs/ccs-queryd and |
* /proc/ccs/query is handled by /usr/sbin/ccs-queryd and |
2428 |
* /proc/ccs/grant_log and /proc/ccs/reject_log are handled by |
* /proc/ccs/grant_log and /proc/ccs/reject_log are handled by |
2429 |
* /usr/lib/ccs/ccs-auditd. |
* /usr/sbin/ccs-auditd. |
2430 |
*/ |
*/ |
2431 |
int ccs_poll_control(struct file *file, poll_table *wait) |
int ccs_poll_control(struct file *file, poll_table *wait) |
2432 |
{ |
{ |