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

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 2985 by kumaneko, Thu Sep 3 08:27:32 2009 UTC revision 2991 by kumaneko, Fri Sep 4 03:58:47 2009 UTC
# Line 3  Line 3 
3   *   *
4   * Copyright (C) 2005-2009  NTT DATA CORPORATION   * Copyright (C) 2005-2009  NTT DATA CORPORATION
5   *   *
6   * Version: 1.7.0   2009/09/03   * Version: 1.7.0   2009/09/04
7   *   *
8   * This file is applicable to both 2.4.30 and 2.6.11 and later.   * This file is applicable to both 2.4.30 and 2.6.11 and later.
9   * See README.ccs for ChangeLog.   * See README.ccs for ChangeLog.
# Line 283  static struct ccs_profile *ccs_find_or_a Line 283  static struct ccs_profile *ccs_find_or_a
283  }  }
284    
285  /**  /**
286     * ccs_check_profile - Check all profiles currently assigned to domains are defined.
287     */
288    void ccs_check_profile(void)
289    {
290            struct ccs_domain_info *domain;
291            ccs_policy_loaded = true;
292            list_for_each_entry_rcu(domain, &ccs_domain_list, list) {
293                    const u8 profile = domain->profile;
294                    if (ccs_profile_ptr[profile])
295                            continue;
296                    panic("Profile %u (used by '%s') not defined.\n",
297                          profile, domain->domainname->name);
298            }
299    }
300    
301    /**
302   * ccs_profile - Find a profile.   * ccs_profile - Find a profile.
303   *   *
304   * @profile: Profile number to find.   * @profile: Profile number to find.
305   *   *
306   * Returns pointer to "struct ccs_profile" on success, NULL otherwise.   * Returns pointer to "struct ccs_profile".
307   */   */
308  struct ccs_profile *ccs_profile(const u8 profile)  struct ccs_profile *ccs_profile(const u8 profile)
309  {  {
# Line 917  static int ccs_write_domain_policy(struc Line 933  static int ccs_write_domain_policy(struc
933    
934          if (sscanf(data, CCS_KEYWORD_USE_PROFILE "%u", &profile) == 1          if (sscanf(data, CCS_KEYWORD_USE_PROFILE "%u", &profile) == 1
935              && profile < CCS_MAX_PROFILES) {              && profile < CCS_MAX_PROFILES) {
936                  if (ccs_profile(profile))                  if (!ccs_policy_loaded || ccs_profile_ptr[(u8) profile])
937                          domain->profile = (u8) profile;                          domain->profile = (u8) profile;
938                  return 0;                  return 0;
939          }          }
# Line 1785  static int ccs_write_domain_profile(stru Line 1801  static int ccs_write_domain_profile(stru
1801          if (profile >= CCS_MAX_PROFILES)          if (profile >= CCS_MAX_PROFILES)
1802                  return -EINVAL;                  return -EINVAL;
1803          domain = ccs_find_domain(cp + 1);          domain = ccs_find_domain(cp + 1);
1804          if (domain && ccs_profile(profile))          if (domain && (!ccs_policy_loaded || ccs_profile_ptr[(u8) profile]))
1805                  domain->profile = (u8) profile;                  domain->profile = (u8) profile;
1806          return 0;          return 0;
1807  }  }

Legend:
Removed from v.2985  
changed lines
  Added in v.2991

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