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; |
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; |
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 |
|
|
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); |