• R/O
  • SSH
  • HTTPS

tomoyo: Commit


Commit MetaInfo

Revision6691 (tree)
Zeit2019-02-05 19:00:17
Autorkumaneko

Log Message

(empty log message)

Ändern Zusammenfassung

Diff

--- trunk/2.6.x/tomoyo-tools/usr_lib_tomoyo/init_policy.c (revision 6690)
+++ trunk/2.6.x/tomoyo-tools/usr_lib_tomoyo/init_policy.c (revision 6691)
@@ -951,7 +951,7 @@
951951 /* Which profile number does <kernel> domain use? */
952952 static unsigned char default_profile = 0;
953953 /* Which ACL group does <kernel> domain use? */
954-static unsigned char default_group = 0;
954+static _Bool use_group[256] = { };
955955
956956 /**
957957 * make_domain_policy - Make /etc/tomoyo/policy/current/domain_policy.conf .
@@ -961,6 +961,7 @@
961961 static void make_domain_policy(void)
962962 {
963963 FILE *fp;
964+ int i;
964965 if (!chdir_policy())
965966 return;
966967 if (!access("domain_policy.conf", R_OK))
@@ -971,8 +972,10 @@
971972 return;
972973 }
973974 fprintf(stderr, "Creating domain policy... ");
974- fprintf(fp, "<kernel>\nuse_profile %u\nuse_group %u\n",
975- default_profile, default_group);
975+ fprintf(fp, "<kernel>\nuse_profile %u\n", default_profile);
976+ for (i = 0; i < 256; i++)
977+ if (use_group[i])
978+ fprintf(fp, "use_group %u\n", i);
976979 close_file(fp, 1, "domain_policy.tmp", "domain_policy.conf");
977980 }
978981
@@ -1644,7 +1647,7 @@
16441647 } else if (!strncmp(arg, "use_profile=", 12)) {
16451648 default_profile = atoi(arg + 12);
16461649 } else if (!strncmp(arg, "use_group=", 10)) {
1647- default_group = atoi(arg + 10);
1650+ use_group[(unsigned char) atoi(arg + 10)] = 1;
16481651 } else if (!strncmp(arg, "grant_log=", 10)) {
16491652 grant_log = arg + 10;
16501653 } else if (!strncmp(arg, "reject_log=", 11)) {
@@ -1658,6 +1661,11 @@
16581661 }
16591662 if (!dir)
16601663 dir = "/etc/tomoyo";
1664+ for (i = 0; i < 256; i++)
1665+ if (use_group[i])
1666+ break;
1667+ if (i == 256)
1668+ use_group[0] = 1;
16611669 policy_dir = strdup(dir);
16621670 memset(path, 0, sizeof(path));
16631671 make_policy_dir();
--- trunk/2.6.x/tomoyo-tools/usr_sbin/editpolicy_offline.c (revision 6690)
+++ trunk/2.6.x/tomoyo-tools/usr_sbin/editpolicy_offline.c (revision 6691)
@@ -712,7 +712,8 @@
712712 struct list_head acl_info_list;
713713 /* Name of this domain. Never NULL. */
714714 const struct ccs_path_info *domainname;
715- u8 group; /* Group number to use. */
715+ /* Group numbers to use. */
716+ bool group[CCS_MAX_ACL_GROUPS];
716717 u8 profile; /* Profile number to use. */
717718 bool is_deleted; /* Delete flag. */
718719 bool flags[CCS_MAX_DOMAIN_INFO_FLAGS];
@@ -3637,8 +3638,7 @@
36373638 }
36383639 if (sscanf(data, "use_group %u\n", &idx) == 1 &&
36393640 idx < CCS_MAX_ACL_GROUPS) {
3640- if (!is_delete)
3641- domain->group = (u8) idx;
3641+ domain->group[idx] = !is_delete;
36423642 return 0;
36433643 }
36443644 for (idx = 0; idx < CCS_MAX_DOMAIN_INFO_FLAGS; idx++) {
@@ -4024,7 +4024,7 @@
40244024 if (domain->flags[i])
40254025 cprintf("%s", ccs_dif[i]);
40264026 for (i = 0; i < CCS_MAX_ACL_GROUPS; i++)
4027- if (domain->group == i)
4027+ if (domain->group[i])
40284028 cprintf("use_group %u\n", i);
40294029 cprintf("\n");
40304030 ccs_read_domain2(&domain->acl_info_list);
Show on old repository browser