3 |
* |
* |
4 |
* Copyright (C) 2005-2009 NTT DATA CORPORATION |
* Copyright (C) 2005-2009 NTT DATA CORPORATION |
5 |
* |
* |
6 |
* Version: 1.7.1-pre 2009/10/16 |
* Version: 1.7.1 2009/11/11 |
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. |
658 |
} |
} |
659 |
domain = ccs_find_or_assign_new_domain(ee->tmp, r->profile); |
domain = ccs_find_or_assign_new_domain(ee->tmp, r->profile); |
660 |
if (domain) |
if (domain) |
661 |
ccs_audit_domain_creation_log(r->domain); |
ccs_audit_domain_creation_log(domain); |
662 |
done: |
done: |
663 |
if (!domain) { |
if (!domain) { |
664 |
printk(KERN_WARNING "ERROR: Domain '%s' not defined.\n", |
printk(KERN_WARNING "ERROR: Domain '%s' not defined.\n", |
691 |
{ |
{ |
692 |
struct ccs_request_info *r = &ee->r; |
struct ccs_request_info *r = &ee->r; |
693 |
struct linux_binprm *bprm = ee->bprm; |
struct linux_binprm *bprm = ee->bprm; |
694 |
char *arg_ptr = ee->tmp; |
/* env_page->data is allocated by ccs_dump_page(). */ |
695 |
|
struct ccs_page_dump env_page = { }; |
696 |
|
char *arg_ptr; /* Size is CCS_EXEC_TMPSIZE bytes */ |
697 |
int arg_len = 0; |
int arg_len = 0; |
698 |
unsigned long pos = bprm->p; |
unsigned long pos = bprm->p; |
699 |
int offset = pos % PAGE_SIZE; |
int offset = pos % PAGE_SIZE; |
703 |
int error = -ENOMEM; |
int error = -ENOMEM; |
704 |
if (!r->mode || !envp_count) |
if (!r->mode || !envp_count) |
705 |
return 0; |
return 0; |
706 |
|
arg_ptr = kzalloc(CCS_EXEC_TMPSIZE, GFP_KERNEL); |
707 |
|
if (!arg_ptr) |
708 |
|
goto out; |
709 |
while (error == -ENOMEM) { |
while (error == -ENOMEM) { |
710 |
if (!ccs_dump_page(bprm, pos, &ee->dump)) |
if (!ccs_dump_page(bprm, pos, &env_page)) |
711 |
goto out; |
goto out; |
712 |
pos += PAGE_SIZE - offset; |
pos += PAGE_SIZE - offset; |
713 |
/* Read. */ |
/* Read. */ |
714 |
while (argv_count && offset < PAGE_SIZE) { |
while (argv_count && offset < PAGE_SIZE) { |
715 |
const char *kaddr = ee->dump.data; |
if (!env_page.data[offset++]) |
|
if (!kaddr[offset++]) |
|
716 |
argv_count--; |
argv_count--; |
717 |
} |
} |
718 |
if (argv_count) { |
if (argv_count) { |
720 |
continue; |
continue; |
721 |
} |
} |
722 |
while (offset < PAGE_SIZE) { |
while (offset < PAGE_SIZE) { |
723 |
const char *kaddr = ee->dump.data; |
const unsigned char c = env_page.data[offset++]; |
|
const unsigned char c = kaddr[offset++]; |
|
724 |
if (c && arg_len < CCS_EXEC_TMPSIZE - 10) { |
if (c && arg_len < CCS_EXEC_TMPSIZE - 10) { |
725 |
if (c == '=') { |
if (c == '=') { |
726 |
arg_ptr[arg_len++] = '\0'; |
arg_ptr[arg_len++] = '\0'; |
756 |
out: |
out: |
757 |
if (r->mode != 3) |
if (r->mode != 3) |
758 |
error = 0; |
error = 0; |
759 |
|
kfree(env_page.data); |
760 |
return error; |
return error; |
761 |
} |
} |
762 |
|
|