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

Subversion リポジトリの参照

Diff of /branches/ccs-patch/security/ccsecurity/policy_io.c

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

revision 2958 by kumaneko, Wed Aug 26 09:43:56 2009 UTC revision 2959 by kumaneko, Thu Aug 27 00:31:31 2009 UTC
# Line 244  static struct ccs_profile *ccs_find_or_a Line 244  static struct ccs_profile *ccs_find_or_a
244          ptr = ccs_profile_ptr[profile];          ptr = ccs_profile_ptr[profile];
245          if (!ptr && ccs_memory_ok(entry, sizeof(*entry))) {          if (!ptr && ccs_memory_ok(entry, sizeof(*entry))) {
246                  ptr = entry;                  ptr = entry;
247    #ifdef CONFIG_CCSECURITY_AUDIT
248                  ptr->audit_max_grant_log = CONFIG_CCSECURITY_MAX_GRANT_LOG;                  ptr->audit_max_grant_log = CONFIG_CCSECURITY_MAX_GRANT_LOG;
249                  ptr->audit_max_reject_log = CONFIG_CCSECURITY_MAX_REJECT_LOG;                  ptr->audit_max_reject_log = CONFIG_CCSECURITY_MAX_REJECT_LOG;
250    #endif
251                  ptr->enforcing_penalty = 0;                  ptr->enforcing_penalty = 0;
252                  ptr->learning_max_entry = CONFIG_CCSECURITY_MAX_ACCEPT_ENTRY;                  ptr->learning_max_entry = CONFIG_CCSECURITY_MAX_ACCEPT_ENTRY;
253                  ptr->enforcing_verbose = true;                  ptr->enforcing_verbose = true;
# Line 322  static int ccs_write_profile(struct ccs_ Line 324  static int ccs_write_profile(struct ccs_
324                  ccs_put_name(old_comment);                  ccs_put_name(old_comment);
325                  return 0;                  return 0;
326          }          }
327    #ifdef CONFIG_CCSECURITY_AUDIT
328          if (!strcmp(data, "PREFERENCE::audit")) {          if (!strcmp(data, "PREFERENCE::audit")) {
329                  char *cp2 = strstr(cp, "max_grant_log=");                  char *cp2 = strstr(cp, "max_grant_log=");
330                  if (cp2)                  if (cp2)
# Line 331  static int ccs_write_profile(struct ccs_ Line 334  static int ccs_write_profile(struct ccs_
334                          sscanf(cp2 + 15, "%u", &profile->audit_max_reject_log);                          sscanf(cp2 + 15, "%u", &profile->audit_max_reject_log);
335                  return 0;                  return 0;
336          }          }
337    #endif
338          if (strstr(cp, "verbose=yes"))          if (strstr(cp, "verbose=yes"))
339                  value = 1;                  value = 1;
340          else if (strstr(cp, "verbose=no"))          else if (strstr(cp, "verbose=no"))
# Line 397  static int ccs_write_profile(struct ccs_ Line 401  static int ccs_write_profile(struct ccs_
401                                   * 'config' from 'CCS_CONFIG_USE_DEAFULT'.                                   * 'config' from 'CCS_CONFIG_USE_DEAFULT'.
402                                   */                                   */
403                                  config = (config & ~7) | mode;                                  config = (config & ~7) | mode;
404    #ifdef CONFIG_CCSECURITY_AUDIT
405                  if (config != CCS_CONFIG_USE_DEFAULT) {                  if (config != CCS_CONFIG_USE_DEFAULT) {
406                          if (strstr(cp, "grant_log=yes"))                          if (strstr(cp, "grant_log=yes"))
407                                  config |= CCS_CONFIG_WANT_GRANT_LOG;                                  config |= CCS_CONFIG_WANT_GRANT_LOG;
# Line 407  static int ccs_write_profile(struct ccs_ Line 412  static int ccs_write_profile(struct ccs_
412                          else if (strstr(cp, "reject_log=no"))                          else if (strstr(cp, "reject_log=no"))
413                                  config &= ~CCS_CONFIG_WANT_REJECT_LOG;                                  config &= ~CCS_CONFIG_WANT_REJECT_LOG;
414                  }                  }
415    #endif
416          }          }
417          if (i < CCS_MAX_MAC_INDEX + CCS_MAX_CAPABILITY_INDEX          if (i < CCS_MAX_MAC_INDEX + CCS_MAX_CAPABILITY_INDEX
418              + CCS_MAX_MAC_CATEGORY_INDEX)              + CCS_MAX_MAC_CATEGORY_INDEX)
# Line 443  static void ccs_read_profile(struct ccs_ Line 449  static void ccs_read_profile(struct ccs_
449                  if (!done)                  if (!done)
450                          goto out;                          goto out;
451                  config = profile->default_config;                  config = profile->default_config;
452    #ifdef CONFIG_CCSECURITY_AUDIT
453                  if (!ccs_io_printf(head, "%u-CONFIG={ mode=%s grant_log=%s "                  if (!ccs_io_printf(head, "%u-CONFIG={ mode=%s grant_log=%s "
454                                     "reject_log=%s }\n", index,                                     "reject_log=%s }\n", index,
455                                     ccs_mode_4[config & 3],                                     ccs_mode_4[config & 3],
# Line 451  static void ccs_read_profile(struct ccs_ Line 458  static void ccs_read_profile(struct ccs_
458                                     ccs_yesno(config &                                     ccs_yesno(config &
459                                               CCS_CONFIG_WANT_REJECT_LOG)))                                               CCS_CONFIG_WANT_REJECT_LOG)))
460                          goto out;                          goto out;
461    #else
462                    if (!ccs_io_printf(head, "%u-CONFIG={ mode=%s }\n", index,
463                                       ccs_mode_4[config & 3]))
464                            goto out;
465    #endif
466                  for (i = 0; i < CCS_MAX_MAC_INDEX + CCS_MAX_CAPABILITY_INDEX                  for (i = 0; i < CCS_MAX_MAC_INDEX + CCS_MAX_CAPABILITY_INDEX
467                               + CCS_MAX_MAC_CATEGORY_INDEX; i++) {                               + CCS_MAX_MAC_CATEGORY_INDEX; i++) {
468    #ifdef CONFIG_CCSECURITY_AUDIT
469                          const char *g;                          const char *g;
470                          const char *r;                          const char *r;
471    #endif
472                          config = profile->config[i];                          config = profile->config[i];
473                          if (config == CCS_CONFIG_USE_DEFAULT)                          if (config == CCS_CONFIG_USE_DEFAULT)
474                                  continue;                                  continue;
475    #ifdef CONFIG_CCSECURITY_AUDIT
476                          g = ccs_yesno(config & CCS_CONFIG_WANT_GRANT_LOG);                          g = ccs_yesno(config & CCS_CONFIG_WANT_GRANT_LOG);
477                          r = ccs_yesno(config & CCS_CONFIG_WANT_REJECT_LOG);                          r = ccs_yesno(config & CCS_CONFIG_WANT_REJECT_LOG);
478                          if (!ccs_io_printf(head, "%u-CONFIG::%s={ mode=%s "                          if (!ccs_io_printf(head, "%u-CONFIG::%s={ mode=%s "
# Line 465  static void ccs_read_profile(struct ccs_ Line 480  static void ccs_read_profile(struct ccs_
480                                             index, ccs_mac_keywords[i],                                             index, ccs_mac_keywords[i],
481                                             ccs_mode_4[config & 3], g, r))                                             ccs_mode_4[config & 3], g, r))
482                                  goto out;                                  goto out;
483    #else
484                            if (!ccs_io_printf(head, "%u-CONFIG::%s={ mode=%s }\n",
485                                               index, ccs_mac_keywords[i],
486                                               ccs_mode_4[config & 3]))
487                                    goto out;
488    #endif
489                            
490                  }                  }
491    #ifdef CONFIG_CCSECURITY_AUDIT
492                  if (!ccs_io_printf(head, "%u-PREFERENCE::audit={ "                  if (!ccs_io_printf(head, "%u-PREFERENCE::audit={ "
493                                     "max_grant_log=%u max_reject_log=%u }\n",                                     "max_grant_log=%u max_reject_log=%u }\n",
494                                     index, profile->audit_max_grant_log,                                     index, profile->audit_max_grant_log,
495                                     profile->audit_max_reject_log) ||                                     profile->audit_max_reject_log))
496                      !ccs_io_printf(head, "%u-PREFERENCE::learning={ "                          goto out;
497    #endif
498                    if (!ccs_io_printf(head, "%u-PREFERENCE::learning={ "
499                                     "verbose=%s max_entry=%u exec.realpath=%s "                                     "verbose=%s max_entry=%u exec.realpath=%s "
500                                     "exec.argv0=%s }\n", index,                                     "exec.argv0=%s }\n", index,
501                                     ccs_yesno(profile->learning_verbose),                                     ccs_yesno(profile->learning_verbose),

Legend:
Removed from v.2958  
changed lines
  Added in v.2959

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