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

Subversion リポジトリの参照

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

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

revision 2576 by kumaneko, Thu May 21 06:28:42 2009 UTC revision 2577 by kumaneko, Thu May 21 08:25:02 2009 UTC
# Line 305  void ccs_normalize_line(unsigned char *b Line 305  void ccs_normalize_line(unsigned char *b
305   *                1 = must / -1 = must not / 0 = don't care   *                1 = must / -1 = must not / 0 = don't care
306   * @end_type:     Should the pathname end with '/'?   * @end_type:     Should the pathname end with '/'?
307   *                1 = must / -1 = must not / 0 = don't care   *                1 = must / -1 = must not / 0 = don't care
  * @function:     The name of function calling me.  
308   *   *
309   * Check whether the given filename follows the naming rules.   * Check whether the given filename follows the naming rules.
310   * Returns true if @filename follows the naming rules, false otherwise.   * Returns true if @filename follows the naming rules, false otherwise.
311   */   */
312  bool ccs_is_correct_path(const char *filename, const s8 start_type,  bool ccs_is_correct_path(const char *filename, const s8 start_type,
313                           const s8 pattern_type, const s8 end_type,                           const s8 pattern_type, const s8 end_type)
                          const char *function)  
314  {  {
315          bool contains_pattern = false;          bool contains_pattern = false;
316          unsigned char c;          unsigned char c;
# Line 386  bool ccs_is_correct_path(const char *fil Line 384  bool ccs_is_correct_path(const char *fil
384          }          }
385          return true;          return true;
386   out:   out:
387          printk(KERN_DEBUG "%s: Invalid pathname '%s'\n", function,          printk(KERN_DEBUG "Invalid pathname '%s'\n", original_filename);
                original_filename);  
388          return false;          return false;
389  }  }
390    
391  /**  /**
392   * ccs_is_correct_domain - Check whether the given domainname follows the naming rules.   * ccs_is_correct_domain - Check whether the given domainname follows the naming rules.
393   * @domainname:   The domainname to check.   * @domainname:   The domainname to check.
  * @function:     The name of function calling me.  
394   *   *
395   * Returns true if @domainname follows the naming rules, false otherwise.   * Returns true if @domainname follows the naming rules, false otherwise.
396   */   */
397  bool ccs_is_correct_domain(const unsigned char *domainname,  bool ccs_is_correct_domain(const unsigned char *domainname)
                            const char *function)  
398  {  {
399          unsigned char c;          unsigned char c;
400          unsigned char d;          unsigned char d;
# Line 448  bool ccs_is_correct_domain(const unsigne Line 443  bool ccs_is_correct_domain(const unsigne
443          } while (*domainname);          } while (*domainname);
444          return true;          return true;
445   out:   out:
446          printk(KERN_DEBUG "%s: Invalid domainname '%s'\n", function,          printk(KERN_DEBUG "Invalid domainname '%s'\n", org_domainname);
                org_domainname);  
447          return false;          return false;
448  }  }
449    
# Line 1343  static int ccs_update_manager_entry(cons Line 1337  static int ccs_update_manager_entry(cons
1337          int error = is_delete ? -ENOENT : -ENOMEM;          int error = is_delete ? -ENOENT : -ENOMEM;
1338          bool is_domain = false;          bool is_domain = false;
1339          if (ccs_is_domain_def(manager)) {          if (ccs_is_domain_def(manager)) {
1340                  if (!ccs_is_correct_domain(manager, __func__))                  if (!ccs_is_correct_domain(manager))
1341                          return -EINVAL;                          return -EINVAL;
1342                  is_domain = true;                  is_domain = true;
1343          } else {          } else {
1344                  if (!ccs_is_correct_path(manager, 1, -1, -1, __func__))                  if (!ccs_is_correct_path(manager, 1, -1, -1))
1345                          return -EINVAL;                          return -EINVAL;
1346          }          }
1347          saved_manager = ccs_get_name(manager);          saved_manager = ccs_get_name(manager);

Legend:
Removed from v.2576  
changed lines
  Added in v.2577

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