オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Diff of /trunk/1.7.x/ccs-patch/security/ccsecurity/policy_io.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2915 by kumaneko, Mon Aug 17 10:56:21 2009 UTC revision 2916 by kumaneko, Mon Aug 17 12:23:47 2009 UTC
# Line 902  static bool ccs_print_path_acl(struct cc Line 902  static bool ccs_print_path_acl(struct cc
902          u8 bit;          u8 bit;
903          const u16 perm = ptr->perm;          const u16 perm = ptr->perm;
904          for (bit = head->read_bit; bit < CCS_MAX_PATH_OPERATION; bit++) {          for (bit = head->read_bit; bit < CCS_MAX_PATH_OPERATION; bit++) {
                 const char *msg;  
905                  if (!(perm & (1 << bit)))                  if (!(perm & (1 << bit)))
906                          continue;                          continue;
907                  if (head->read_execute_only && bit != CCS_TYPE_EXECUTE)                  if (head->read_execute_only && bit != CCS_TYPE_EXECUTE)
# Line 911  static bool ccs_print_path_acl(struct cc Line 910  static bool ccs_print_path_acl(struct cc
910                  if ((bit == CCS_TYPE_READ || bit == CCS_TYPE_WRITE)                  if ((bit == CCS_TYPE_READ || bit == CCS_TYPE_WRITE)
911                      && (perm & (1 << CCS_TYPE_READ_WRITE)))                      && (perm & (1 << CCS_TYPE_READ_WRITE)))
912                          continue;                          continue;
                 msg = ccs_path2keyword(bit);  
913                  pos = head->read_avail;                  pos = head->read_avail;
914                  if (!ccs_io_printf(head, "allow_%s", msg) ||                  if (!ccs_io_printf(head, "allow_%s", ccs_path2keyword(bit)) ||
915                      !ccs_print_name_union(head, &ptr->name) ||                      !ccs_print_name_union(head, &ptr->name) ||
916                      !ccs_print_condition(head, cond)) {                      !ccs_print_condition(head, cond)) {
917                          head->read_bit = bit;                          head->read_bit = bit;
# Line 941  static bool ccs_print_path_number_number Line 939  static bool ccs_print_path_number_number
939          int pos;          int pos;
940          u8 bit;          u8 bit;
941          const u16 perm = ptr->perm;          const u16 perm = ptr->perm;
942          for (bit = head->read_bit; bit < CCS_MAX_PATH_NUMBER_NUMBER_OPERATION; bit++) {          for (bit = head->read_bit; bit < CCS_MAX_PATH_NUMBER_NUMBER_OPERATION;
943                  const char *msg;               bit++) {
944                  if (!(perm & (1 << bit)))                  if (!(perm & (1 << bit)))
945                          continue;                          continue;
                 msg = ccs_path_number_number2keyword(bit);  
946                  pos = head->read_avail;                  pos = head->read_avail;
947                  if (!ccs_io_printf(head, "allow_%s", msg) ||                  if (!ccs_io_printf(head, "allow_%s",
948                                       ccs_path_number_number2keyword(bit)) ||
949                      !ccs_print_name_union(head, &ptr->name) ||                      !ccs_print_name_union(head, &ptr->name) ||
950                      !ccs_print_number_union(head, &ptr->major) ||                      !ccs_print_number_union(head, &ptr->major) ||
951                      !ccs_print_number_union(head, &ptr->minor) ||                      !ccs_print_number_union(head, &ptr->minor) ||
# Line 978  static bool ccs_print_path_path_acl(stru Line 976  static bool ccs_print_path_path_acl(stru
976          u8 bit;          u8 bit;
977          const u8 perm = ptr->perm;          const u8 perm = ptr->perm;
978          for (bit = head->read_bit; bit < CCS_MAX_PATH_PATH_OPERATION; bit++) {          for (bit = head->read_bit; bit < CCS_MAX_PATH_PATH_OPERATION; bit++) {
                 const char *msg;  
979                  if (!(perm & (1 << bit)))                  if (!(perm & (1 << bit)))
980                          continue;                          continue;
                 msg = ccs_path_path2keyword(bit);  
981                  pos = head->read_avail;                  pos = head->read_avail;
982                  if (!ccs_io_printf(head, "allow_%s", msg) ||                  if (!ccs_io_printf(head, "allow_%s",
983                                       ccs_path_path2keyword(bit)) ||
984                      !ccs_print_name_union(head, &ptr->name1) ||                      !ccs_print_name_union(head, &ptr->name1) ||
985                      !ccs_print_name_union(head, &ptr->name2) ||                      !ccs_print_name_union(head, &ptr->name2) ||
986                      !ccs_print_condition(head, cond)) {                      !ccs_print_condition(head, cond)) {
# Line 1012  static bool ccs_print_path_number_acl(st Line 1009  static bool ccs_print_path_number_acl(st
1009          int pos;          int pos;
1010          u8 bit;          u8 bit;
1011          const u8 perm = ptr->perm;          const u8 perm = ptr->perm;
1012          for (bit = head->read_bit; bit < CCS_MAX_PATH_NUMBER_OPERATION; bit++) {          for (bit = head->read_bit; bit < CCS_MAX_PATH_NUMBER_OPERATION;
1013                  const char *msg;               bit++) {
1014                  if (!(perm & (1 << bit)))                  if (!(perm & (1 << bit)))
1015                          continue;                          continue;
                 msg = ccs_path_number2keyword(bit);  
1016                  pos = head->read_avail;                  pos = head->read_avail;
1017                  if (!ccs_io_printf(head, "allow_%s", msg) ||                  if (!ccs_io_printf(head, "allow_%s",
1018                                       ccs_path_number2keyword(bit)) ||
1019                      !ccs_print_name_union(head, &ptr->name) ||                      !ccs_print_name_union(head, &ptr->name) ||
1020                      !ccs_print_number_union(head, &ptr->number) ||                      !ccs_print_number_union(head, &ptr->number) ||
1021                      !ccs_print_condition(head, cond)) {                      !ccs_print_condition(head, cond)) {
# Line 1135  static bool ccs_print_network_acl(struct Line 1132  static bool ccs_print_network_acl(struct
1132                                    struct ccs_ip_network_acl *ptr,                                    struct ccs_ip_network_acl *ptr,
1133                                    const struct ccs_condition *cond)                                    const struct ccs_condition *cond)
1134  {  {
1135          const int pos = head->read_avail;          int pos;
1136          if (!ccs_io_printf(head, CCS_KEYWORD_ALLOW_NETWORK "%s ",          u8 bit;
1137                             ccs_net2keyword(ptr->operation_type)))          const u16 perm = ptr->perm;
1138                  goto out;          for (bit = head->read_bit; bit < CCS_MAX_NETWORK_OPERATION; bit++) {
1139          switch (ptr->record_type) {                  if (!(perm & (1 << bit)))
1140          case CCS_IP_RECORD_TYPE_ADDRESS_GROUP:                          continue;
1141                  if (!ccs_io_printf(head, "@%s",                  pos = head->read_avail;
1142                                     ptr->address.group->group_name->name))                  if (!ccs_io_printf(head, CCS_KEYWORD_ALLOW_NETWORK "%s ",
1143                          goto out;                                     ccs_net2keyword(bit)))
                 break;  
         case CCS_IP_RECORD_TYPE_IPv4:  
                 if (!ccs_print_ipv4_entry(head, ptr))  
1144                          goto out;                          goto out;
1145                  break;                  switch (ptr->address_type) {
1146          case CCS_IP_RECORD_TYPE_IPv6:                  case CCS_IP_ADDRESS_TYPE_ADDRESS_GROUP:
1147                  if (!ccs_print_ipv6_entry(head, ptr))                          if (!ccs_io_printf(head, "@%s", ptr->address.group->
1148                                               group_name->name))
1149                                    goto out;
1150                            break;
1151                    case CCS_IP_ADDRESS_TYPE_IPv4:
1152                            if (!ccs_print_ipv4_entry(head, ptr))
1153                                    goto out;
1154                            break;
1155                    case CCS_IP_ADDRESS_TYPE_IPv6:
1156                            if (!ccs_print_ipv6_entry(head, ptr))
1157                                    goto out;
1158                            break;
1159                    }
1160                    if (!ccs_print_number_union(head, &ptr->port) ||
1161                        !ccs_print_condition(head, cond))
1162                          goto out;                          goto out;
                 break;  
1163          }          }
1164          if (!ccs_print_number_union(head, &ptr->port) ||          head->read_bit = 0;
             !ccs_print_condition(head, cond))  
                 goto out;  
1165          return true;          return true;
1166   out:   out:
1167            head->read_bit = bit;
1168          head->read_avail = pos;          head->read_avail = pos;
1169          return false;          return false;
1170  }  }

Legend:
Removed from v.2915  
changed lines
  Added in v.2916

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26