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

Subversion リポジトリの参照

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

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

revision 3695 by kumaneko, Mon May 24 04:35:02 2010 UTC revision 3696 by kumaneko, Mon May 24 07:52:11 2010 UTC
# Line 795  static bool ccs_manager(void) Line 795  static bool ccs_manager(void)
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    
# Line 1205  static bool ccs_print_condition(struct c Line 1196  static bool ccs_print_condition(struct c
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;
# Line 1931  static bool ccs_read_policy(struct ccs_i Line 1927  static bool ccs_read_policy(struct ccs_i
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)
# Line 1980  static bool ccs_read_policy(struct ccs_i Line 1977  static bool ccs_read_policy(struct ccs_i
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:
# Line 2004  static bool ccs_read_policy(struct ccs_i Line 2002  static bool ccs_read_policy(struct ccs_i
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:
# Line 2020  static bool ccs_read_policy(struct ccs_i Line 2019  static bool ccs_read_policy(struct ccs_i
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  }  }

Legend:
Removed from v.3695  
changed lines
  Added in v.3696

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