39 |
|
|
40 |
/************************* SIGNAL ACL HANDLER *************************/ |
/************************* SIGNAL ACL HANDLER *************************/ |
41 |
|
|
42 |
static int AddSignalEntry(const int sig, const char *dest_pattern, struct domain_info *domain, const u8 is_add, const struct condition_list *condition) |
static int AddSignalEntry(const int sig, const char *dest_pattern, struct domain_info *domain, const struct condition_list *condition, const u8 is_delete) |
43 |
{ |
{ |
44 |
struct acl_info *ptr; |
struct acl_info *ptr; |
45 |
const struct path_info *saved_dest_pattern; |
const struct path_info *saved_dest_pattern; |
49 |
if (!dest_pattern || !IsCorrectDomain(dest_pattern, __FUNCTION__)) return -EINVAL; |
if (!dest_pattern || !IsCorrectDomain(dest_pattern, __FUNCTION__)) return -EINVAL; |
50 |
if ((saved_dest_pattern = SaveName(dest_pattern)) == NULL) return -ENOMEM; |
if ((saved_dest_pattern = SaveName(dest_pattern)) == NULL) return -ENOMEM; |
51 |
down(&domain_acl_lock); |
down(&domain_acl_lock); |
52 |
if (is_add) { |
if (!is_delete) { |
53 |
if ((ptr = domain->first_acl_ptr) == NULL) goto first_entry; |
if ((ptr = domain->first_acl_ptr) == NULL) goto first_entry; |
54 |
while (1) { |
while (1) { |
55 |
struct signal_acl_record *new_ptr = (struct signal_acl_record *) ptr; |
struct signal_acl_record *new_ptr = (struct signal_acl_record *) ptr; |
135 |
} |
} |
136 |
AuditSignalLog(sig, dest->domainname, 0); |
AuditSignalLog(sig, dest->domainname, 0); |
137 |
if (is_enforce) return CheckSupervisor("%s\n" KEYWORD_ALLOW_SIGNAL "%d %s\n", domain->domainname->name, sig, dest_pattern); |
if (is_enforce) return CheckSupervisor("%s\n" KEYWORD_ALLOW_SIGNAL "%d %s\n", domain->domainname->name, sig, dest_pattern); |
138 |
if (CheckCCSAccept(CCS_TOMOYO_MAC_FOR_SIGNAL, domain)) AddSignalEntry(sig, dest_pattern, domain, 1, NULL); |
if (CheckCCSAccept(CCS_TOMOYO_MAC_FOR_SIGNAL, domain)) AddSignalEntry(sig, dest_pattern, domain, NULL, 0); |
139 |
return 0; |
return 0; |
140 |
} |
} |
141 |
EXPORT_SYMBOL(CheckSignalACL); |
EXPORT_SYMBOL(CheckSignalACL); |
148 |
const struct condition_list *condition = NULL; |
const struct condition_list *condition = NULL; |
149 |
const char *cp = FindConditionPart(domainname + 1); |
const char *cp = FindConditionPart(domainname + 1); |
150 |
if (cp && (condition = FindOrAssignNewCondition(cp)) == NULL) return -EINVAL; |
if (cp && (condition = FindOrAssignNewCondition(cp)) == NULL) return -EINVAL; |
151 |
return AddSignalEntry(sig, domainname + 1, domain, is_delete ? 0 : -1, condition); |
return AddSignalEntry(sig, domainname + 1, domain, condition, is_delete); |
152 |
} |
} |
153 |
return -EINVAL; |
return -EINVAL; |
154 |
} |
} |