mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
TOMOYO: Use shorter names.
Use shorter name to reduce newlines needed for 80 columns limit. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
committed by
James Morris
parent
084da356f6
commit
7ef612331f
@@ -841,25 +841,22 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_domain_info * const domain)
|
||||
return true;
|
||||
list_for_each_entry_rcu(ptr, &domain->acl_info_list, list) {
|
||||
switch (ptr->type) {
|
||||
struct tomoyo_single_path_acl_record *acl;
|
||||
struct tomoyo_path_acl *acl;
|
||||
u32 perm;
|
||||
u8 i;
|
||||
case TOMOYO_TYPE_SINGLE_PATH_ACL:
|
||||
acl = container_of(ptr,
|
||||
struct tomoyo_single_path_acl_record,
|
||||
head);
|
||||
case TOMOYO_TYPE_PATH_ACL:
|
||||
acl = container_of(ptr, struct tomoyo_path_acl, head);
|
||||
perm = acl->perm | (((u32) acl->perm_high) << 16);
|
||||
for (i = 0; i < TOMOYO_MAX_SINGLE_PATH_OPERATION; i++)
|
||||
for (i = 0; i < TOMOYO_MAX_PATH_OPERATION; i++)
|
||||
if (perm & (1 << i))
|
||||
count++;
|
||||
if (perm & (1 << TOMOYO_TYPE_READ_WRITE_ACL))
|
||||
if (perm & (1 << TOMOYO_TYPE_READ_WRITE))
|
||||
count -= 2;
|
||||
break;
|
||||
case TOMOYO_TYPE_DOUBLE_PATH_ACL:
|
||||
perm = container_of(ptr,
|
||||
struct tomoyo_double_path_acl_record,
|
||||
head)->perm;
|
||||
for (i = 0; i < TOMOYO_MAX_DOUBLE_PATH_OPERATION; i++)
|
||||
case TOMOYO_TYPE_PATH2_ACL:
|
||||
perm = container_of(ptr, struct tomoyo_path2_acl, head)
|
||||
->perm;
|
||||
for (i = 0; i < TOMOYO_MAX_PATH2_OPERATION; i++)
|
||||
if (perm & (1 << i))
|
||||
count++;
|
||||
break;
|
||||
@@ -1366,16 +1363,15 @@ static int tomoyo_write_domain_policy(struct tomoyo_io_buffer *head)
|
||||
}
|
||||
|
||||
/**
|
||||
* tomoyo_print_single_path_acl - Print a single path ACL entry.
|
||||
* tomoyo_print_path_acl - Print a single path ACL entry.
|
||||
*
|
||||
* @head: Pointer to "struct tomoyo_io_buffer".
|
||||
* @ptr: Pointer to "struct tomoyo_single_path_acl_record".
|
||||
* @ptr: Pointer to "struct tomoyo_path_acl".
|
||||
*
|
||||
* Returns true on success, false otherwise.
|
||||
*/
|
||||
static bool tomoyo_print_single_path_acl(struct tomoyo_io_buffer *head,
|
||||
struct tomoyo_single_path_acl_record *
|
||||
ptr)
|
||||
static bool tomoyo_print_path_acl(struct tomoyo_io_buffer *head,
|
||||
struct tomoyo_path_acl *ptr)
|
||||
{
|
||||
int pos;
|
||||
u8 bit;
|
||||
@@ -1384,17 +1380,15 @@ static bool tomoyo_print_single_path_acl(struct tomoyo_io_buffer *head,
|
||||
const u32 perm = ptr->perm | (((u32) ptr->perm_high) << 16);
|
||||
|
||||
filename = ptr->filename->name;
|
||||
for (bit = head->read_bit; bit < TOMOYO_MAX_SINGLE_PATH_OPERATION;
|
||||
bit++) {
|
||||
for (bit = head->read_bit; bit < TOMOYO_MAX_PATH_OPERATION; bit++) {
|
||||
const char *msg;
|
||||
if (!(perm & (1 << bit)))
|
||||
continue;
|
||||
/* Print "read/write" instead of "read" and "write". */
|
||||
if ((bit == TOMOYO_TYPE_READ_ACL ||
|
||||
bit == TOMOYO_TYPE_WRITE_ACL)
|
||||
&& (perm & (1 << TOMOYO_TYPE_READ_WRITE_ACL)))
|
||||
if ((bit == TOMOYO_TYPE_READ || bit == TOMOYO_TYPE_WRITE)
|
||||
&& (perm & (1 << TOMOYO_TYPE_READ_WRITE)))
|
||||
continue;
|
||||
msg = tomoyo_sp2keyword(bit);
|
||||
msg = tomoyo_path2keyword(bit);
|
||||
pos = head->read_avail;
|
||||
if (!tomoyo_io_printf(head, "allow_%s %s%s\n", msg,
|
||||
atmark, filename))
|
||||
@@ -1409,16 +1403,15 @@ static bool tomoyo_print_single_path_acl(struct tomoyo_io_buffer *head,
|
||||
}
|
||||
|
||||
/**
|
||||
* tomoyo_print_double_path_acl - Print a double path ACL entry.
|
||||
* tomoyo_print_path2_acl - Print a double path ACL entry.
|
||||
*
|
||||
* @head: Pointer to "struct tomoyo_io_buffer".
|
||||
* @ptr: Pointer to "struct tomoyo_double_path_acl_record".
|
||||
* @ptr: Pointer to "struct tomoyo_path2_acl".
|
||||
*
|
||||
* Returns true on success, false otherwise.
|
||||
*/
|
||||
static bool tomoyo_print_double_path_acl(struct tomoyo_io_buffer *head,
|
||||
struct tomoyo_double_path_acl_record *
|
||||
ptr)
|
||||
static bool tomoyo_print_path2_acl(struct tomoyo_io_buffer *head,
|
||||
struct tomoyo_path2_acl *ptr)
|
||||
{
|
||||
int pos;
|
||||
const char *atmark1 = "";
|
||||
@@ -1430,12 +1423,11 @@ static bool tomoyo_print_double_path_acl(struct tomoyo_io_buffer *head,
|
||||
|
||||
filename1 = ptr->filename1->name;
|
||||
filename2 = ptr->filename2->name;
|
||||
for (bit = head->read_bit; bit < TOMOYO_MAX_DOUBLE_PATH_OPERATION;
|
||||
bit++) {
|
||||
for (bit = head->read_bit; bit < TOMOYO_MAX_PATH2_OPERATION; bit++) {
|
||||
const char *msg;
|
||||
if (!(perm & (1 << bit)))
|
||||
continue;
|
||||
msg = tomoyo_dp2keyword(bit);
|
||||
msg = tomoyo_path22keyword(bit);
|
||||
pos = head->read_avail;
|
||||
if (!tomoyo_io_printf(head, "allow_%s %s%s %s%s\n", msg,
|
||||
atmark1, filename1, atmark2, filename2))
|
||||
@@ -1462,19 +1454,15 @@ static bool tomoyo_print_entry(struct tomoyo_io_buffer *head,
|
||||
{
|
||||
const u8 acl_type = ptr->type;
|
||||
|
||||
if (acl_type == TOMOYO_TYPE_SINGLE_PATH_ACL) {
|
||||
struct tomoyo_single_path_acl_record *acl
|
||||
= container_of(ptr,
|
||||
struct tomoyo_single_path_acl_record,
|
||||
head);
|
||||
return tomoyo_print_single_path_acl(head, acl);
|
||||
if (acl_type == TOMOYO_TYPE_PATH_ACL) {
|
||||
struct tomoyo_path_acl *acl
|
||||
= container_of(ptr, struct tomoyo_path_acl, head);
|
||||
return tomoyo_print_path_acl(head, acl);
|
||||
}
|
||||
if (acl_type == TOMOYO_TYPE_DOUBLE_PATH_ACL) {
|
||||
struct tomoyo_double_path_acl_record *acl
|
||||
= container_of(ptr,
|
||||
struct tomoyo_double_path_acl_record,
|
||||
head);
|
||||
return tomoyo_print_double_path_acl(head, acl);
|
||||
if (acl_type == TOMOYO_TYPE_PATH2_ACL) {
|
||||
struct tomoyo_path2_acl *acl
|
||||
= container_of(ptr, struct tomoyo_path2_acl, head);
|
||||
return tomoyo_print_path2_acl(head, acl);
|
||||
}
|
||||
BUG(); /* This must not happen. */
|
||||
return false;
|
||||
|
||||
@@ -71,8 +71,8 @@ enum tomoyo_mac_index {
|
||||
|
||||
/* Index numbers for Access Controls. */
|
||||
enum tomoyo_acl_entry_type_index {
|
||||
TOMOYO_TYPE_SINGLE_PATH_ACL,
|
||||
TOMOYO_TYPE_DOUBLE_PATH_ACL,
|
||||
TOMOYO_TYPE_PATH_ACL,
|
||||
TOMOYO_TYPE_PATH2_ACL,
|
||||
};
|
||||
|
||||
/* Index numbers for File Controls. */
|
||||
@@ -87,36 +87,36 @@ enum tomoyo_acl_entry_type_index {
|
||||
*/
|
||||
|
||||
enum tomoyo_path_acl_index {
|
||||
TOMOYO_TYPE_READ_WRITE_ACL,
|
||||
TOMOYO_TYPE_EXECUTE_ACL,
|
||||
TOMOYO_TYPE_READ_ACL,
|
||||
TOMOYO_TYPE_WRITE_ACL,
|
||||
TOMOYO_TYPE_CREATE_ACL,
|
||||
TOMOYO_TYPE_UNLINK_ACL,
|
||||
TOMOYO_TYPE_MKDIR_ACL,
|
||||
TOMOYO_TYPE_RMDIR_ACL,
|
||||
TOMOYO_TYPE_MKFIFO_ACL,
|
||||
TOMOYO_TYPE_MKSOCK_ACL,
|
||||
TOMOYO_TYPE_MKBLOCK_ACL,
|
||||
TOMOYO_TYPE_MKCHAR_ACL,
|
||||
TOMOYO_TYPE_TRUNCATE_ACL,
|
||||
TOMOYO_TYPE_SYMLINK_ACL,
|
||||
TOMOYO_TYPE_REWRITE_ACL,
|
||||
TOMOYO_TYPE_IOCTL_ACL,
|
||||
TOMOYO_TYPE_CHMOD_ACL,
|
||||
TOMOYO_TYPE_CHOWN_ACL,
|
||||
TOMOYO_TYPE_CHGRP_ACL,
|
||||
TOMOYO_TYPE_CHROOT_ACL,
|
||||
TOMOYO_TYPE_MOUNT_ACL,
|
||||
TOMOYO_TYPE_UMOUNT_ACL,
|
||||
TOMOYO_MAX_SINGLE_PATH_OPERATION
|
||||
TOMOYO_TYPE_READ_WRITE,
|
||||
TOMOYO_TYPE_EXECUTE,
|
||||
TOMOYO_TYPE_READ,
|
||||
TOMOYO_TYPE_WRITE,
|
||||
TOMOYO_TYPE_CREATE,
|
||||
TOMOYO_TYPE_UNLINK,
|
||||
TOMOYO_TYPE_MKDIR,
|
||||
TOMOYO_TYPE_RMDIR,
|
||||
TOMOYO_TYPE_MKFIFO,
|
||||
TOMOYO_TYPE_MKSOCK,
|
||||
TOMOYO_TYPE_MKBLOCK,
|
||||
TOMOYO_TYPE_MKCHAR,
|
||||
TOMOYO_TYPE_TRUNCATE,
|
||||
TOMOYO_TYPE_SYMLINK,
|
||||
TOMOYO_TYPE_REWRITE,
|
||||
TOMOYO_TYPE_IOCTL,
|
||||
TOMOYO_TYPE_CHMOD,
|
||||
TOMOYO_TYPE_CHOWN,
|
||||
TOMOYO_TYPE_CHGRP,
|
||||
TOMOYO_TYPE_CHROOT,
|
||||
TOMOYO_TYPE_MOUNT,
|
||||
TOMOYO_TYPE_UMOUNT,
|
||||
TOMOYO_MAX_PATH_OPERATION
|
||||
};
|
||||
|
||||
enum tomoyo_path2_acl_index {
|
||||
TOMOYO_TYPE_LINK_ACL,
|
||||
TOMOYO_TYPE_RENAME_ACL,
|
||||
TOMOYO_TYPE_PIVOT_ROOT_ACL,
|
||||
TOMOYO_MAX_DOUBLE_PATH_OPERATION
|
||||
TOMOYO_TYPE_LINK,
|
||||
TOMOYO_TYPE_RENAME,
|
||||
TOMOYO_TYPE_PIVOT_ROOT,
|
||||
TOMOYO_MAX_PATH2_OPERATION
|
||||
};
|
||||
|
||||
enum tomoyo_securityfs_interface_index {
|
||||
@@ -210,12 +210,11 @@ struct tomoyo_path_info_with_data {
|
||||
* (1) "list" which is linked to the ->acl_info_list of
|
||||
* "struct tomoyo_domain_info"
|
||||
* (2) "type" which tells type of the entry (either
|
||||
* "struct tomoyo_single_path_acl_record" or
|
||||
* "struct tomoyo_double_path_acl_record").
|
||||
* "struct tomoyo_path_acl" or "struct tomoyo_path2_acl").
|
||||
*
|
||||
* Packing "struct tomoyo_acl_info" allows
|
||||
* "struct tomoyo_single_path_acl_record" to embed "u8" + "u16" and
|
||||
* "struct tomoyo_double_path_acl_record" to embed "u8"
|
||||
* "struct tomoyo_path_acl" to embed "u8" + "u16" and
|
||||
* "struct tomoyo_path2_acl" to embed "u8"
|
||||
* without enlarging their structure size.
|
||||
*/
|
||||
struct tomoyo_acl_info {
|
||||
@@ -269,7 +268,7 @@ struct tomoyo_domain_info {
|
||||
};
|
||||
|
||||
/*
|
||||
* tomoyo_single_path_acl_record is a structure which is used for holding an
|
||||
* tomoyo_path_acl is a structure which is used for holding an
|
||||
* entry with one pathname operation (e.g. open(), mkdir()).
|
||||
* It has following fields.
|
||||
*
|
||||
@@ -284,8 +283,8 @@ struct tomoyo_domain_info {
|
||||
* "allow_chmod", "allow_chown", "allow_chgrp", "allow_chroot", "allow_mount"
|
||||
* and "allow_unmount".
|
||||
*/
|
||||
struct tomoyo_single_path_acl_record {
|
||||
struct tomoyo_acl_info head; /* type = TOMOYO_TYPE_SINGLE_PATH_ACL */
|
||||
struct tomoyo_path_acl {
|
||||
struct tomoyo_acl_info head; /* type = TOMOYO_TYPE_PATH_ACL */
|
||||
u8 perm_high;
|
||||
u16 perm;
|
||||
/* Pointer to single pathname. */
|
||||
@@ -293,7 +292,7 @@ struct tomoyo_single_path_acl_record {
|
||||
};
|
||||
|
||||
/*
|
||||
* tomoyo_double_path_acl_record is a structure which is used for holding an
|
||||
* tomoyo_path2_acl is a structure which is used for holding an
|
||||
* entry with two pathnames operation (i.e. link(), rename() and pivot_root()).
|
||||
* It has following fields.
|
||||
*
|
||||
@@ -305,8 +304,8 @@ struct tomoyo_single_path_acl_record {
|
||||
* Directives held by this structure are "allow_rename", "allow_link" and
|
||||
* "allow_pivot_root".
|
||||
*/
|
||||
struct tomoyo_double_path_acl_record {
|
||||
struct tomoyo_acl_info head; /* type = TOMOYO_TYPE_DOUBLE_PATH_ACL */
|
||||
struct tomoyo_path2_acl {
|
||||
struct tomoyo_acl_info head; /* type = TOMOYO_TYPE_PATH2_ACL */
|
||||
u8 perm;
|
||||
/* Pointer to single pathname. */
|
||||
const struct tomoyo_path_info *filename1;
|
||||
@@ -550,13 +549,13 @@ bool tomoyo_read_no_rewrite_policy(struct tomoyo_io_buffer *head);
|
||||
/* Write domain policy violation warning message to console? */
|
||||
bool tomoyo_verbose_mode(const struct tomoyo_domain_info *domain);
|
||||
/* Convert double path operation to operation name. */
|
||||
const char *tomoyo_dp2keyword(const u8 operation);
|
||||
const char *tomoyo_path22keyword(const u8 operation);
|
||||
/* Get the last component of the given domainname. */
|
||||
const char *tomoyo_get_last_name(const struct tomoyo_domain_info *domain);
|
||||
/* Get warning message. */
|
||||
const char *tomoyo_get_msg(const bool is_enforce);
|
||||
/* Convert single path operation to operation name. */
|
||||
const char *tomoyo_sp2keyword(const u8 operation);
|
||||
const char *tomoyo_path2keyword(const u8 operation);
|
||||
/* Create "alias" entry in exception policy. */
|
||||
int tomoyo_write_alias_policy(char *data, const bool is_delete);
|
||||
/*
|
||||
@@ -638,11 +637,10 @@ int tomoyo_check_exec_perm(struct tomoyo_domain_info *domain,
|
||||
const struct tomoyo_path_info *filename);
|
||||
int tomoyo_check_open_permission(struct tomoyo_domain_info *domain,
|
||||
struct path *path, const int flag);
|
||||
int tomoyo_check_1path_perm(struct tomoyo_domain_info *domain,
|
||||
const u8 operation, struct path *path);
|
||||
int tomoyo_check_2path_perm(struct tomoyo_domain_info *domain,
|
||||
const u8 operation, struct path *path1,
|
||||
struct path *path2);
|
||||
int tomoyo_path_perm(struct tomoyo_domain_info *domain, const u8 operation,
|
||||
struct path *path);
|
||||
int tomoyo_path2_perm(struct tomoyo_domain_info *domain, const u8 operation,
|
||||
struct path *path1, struct path *path2);
|
||||
int tomoyo_check_rewrite_permission(struct tomoyo_domain_info *domain,
|
||||
struct file *filp);
|
||||
int tomoyo_find_next_domain(struct linux_binprm *bprm);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -86,16 +86,16 @@ static void tomoyo_del_manager(struct tomoyo_policy_manager_entry *ptr)
|
||||
static void tomoyo_del_acl(struct tomoyo_acl_info *acl)
|
||||
{
|
||||
switch (acl->type) {
|
||||
case TOMOYO_TYPE_SINGLE_PATH_ACL:
|
||||
case TOMOYO_TYPE_PATH_ACL:
|
||||
{
|
||||
struct tomoyo_single_path_acl_record *entry
|
||||
struct tomoyo_path_acl *entry
|
||||
= container_of(acl, typeof(*entry), head);
|
||||
tomoyo_put_name(entry->filename);
|
||||
}
|
||||
break;
|
||||
case TOMOYO_TYPE_DOUBLE_PATH_ACL:
|
||||
case TOMOYO_TYPE_PATH2_ACL:
|
||||
{
|
||||
struct tomoyo_double_path_acl_record *entry
|
||||
struct tomoyo_path2_acl *entry
|
||||
= container_of(acl, typeof(*entry), head);
|
||||
tomoyo_put_name(entry->filename1);
|
||||
tomoyo_put_name(entry->filename2);
|
||||
@@ -238,18 +238,18 @@ static void tomoyo_collect_entry(void)
|
||||
list_for_each_entry_rcu(acl, &domain->acl_info_list,
|
||||
list) {
|
||||
switch (acl->type) {
|
||||
case TOMOYO_TYPE_SINGLE_PATH_ACL:
|
||||
case TOMOYO_TYPE_PATH_ACL:
|
||||
if (container_of(acl,
|
||||
struct tomoyo_single_path_acl_record,
|
||||
struct tomoyo_path_acl,
|
||||
head)->perm ||
|
||||
container_of(acl,
|
||||
struct tomoyo_single_path_acl_record,
|
||||
struct tomoyo_path_acl,
|
||||
head)->perm_high)
|
||||
continue;
|
||||
break;
|
||||
case TOMOYO_TYPE_DOUBLE_PATH_ACL:
|
||||
case TOMOYO_TYPE_PATH2_ACL:
|
||||
if (container_of(acl,
|
||||
struct tomoyo_double_path_acl_record,
|
||||
struct tomoyo_path2_acl,
|
||||
head)->perm)
|
||||
continue;
|
||||
break;
|
||||
|
||||
@@ -100,67 +100,56 @@ static int tomoyo_bprm_check_security(struct linux_binprm *bprm)
|
||||
static int tomoyo_path_truncate(struct path *path, loff_t length,
|
||||
unsigned int time_attrs)
|
||||
{
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_TRUNCATE_ACL,
|
||||
path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_TRUNCATE, path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_unlink(struct path *parent, struct dentry *dentry)
|
||||
{
|
||||
struct path path = { parent->mnt, dentry };
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_UNLINK_ACL,
|
||||
&path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_UNLINK, &path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_mkdir(struct path *parent, struct dentry *dentry,
|
||||
int mode)
|
||||
{
|
||||
struct path path = { parent->mnt, dentry };
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_MKDIR_ACL,
|
||||
&path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_MKDIR, &path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_rmdir(struct path *parent, struct dentry *dentry)
|
||||
{
|
||||
struct path path = { parent->mnt, dentry };
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_RMDIR_ACL,
|
||||
&path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_RMDIR, &path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_symlink(struct path *parent, struct dentry *dentry,
|
||||
const char *old_name)
|
||||
{
|
||||
struct path path = { parent->mnt, dentry };
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_SYMLINK_ACL,
|
||||
&path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_SYMLINK, &path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_mknod(struct path *parent, struct dentry *dentry,
|
||||
int mode, unsigned int dev)
|
||||
{
|
||||
struct path path = { parent->mnt, dentry };
|
||||
int type = TOMOYO_TYPE_CREATE_ACL;
|
||||
int type = TOMOYO_TYPE_CREATE;
|
||||
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFCHR:
|
||||
type = TOMOYO_TYPE_MKCHAR_ACL;
|
||||
type = TOMOYO_TYPE_MKCHAR;
|
||||
break;
|
||||
case S_IFBLK:
|
||||
type = TOMOYO_TYPE_MKBLOCK_ACL;
|
||||
type = TOMOYO_TYPE_MKBLOCK;
|
||||
break;
|
||||
case S_IFIFO:
|
||||
type = TOMOYO_TYPE_MKFIFO_ACL;
|
||||
type = TOMOYO_TYPE_MKFIFO;
|
||||
break;
|
||||
case S_IFSOCK:
|
||||
type = TOMOYO_TYPE_MKSOCK_ACL;
|
||||
type = TOMOYO_TYPE_MKSOCK;
|
||||
break;
|
||||
}
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
type, &path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), type, &path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_link(struct dentry *old_dentry, struct path *new_dir,
|
||||
@@ -168,9 +157,8 @@ static int tomoyo_path_link(struct dentry *old_dentry, struct path *new_dir,
|
||||
{
|
||||
struct path path1 = { new_dir->mnt, old_dentry };
|
||||
struct path path2 = { new_dir->mnt, new_dentry };
|
||||
return tomoyo_check_2path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_LINK_ACL,
|
||||
&path1, &path2);
|
||||
return tomoyo_path2_perm(tomoyo_domain(), TOMOYO_TYPE_LINK, &path1,
|
||||
&path2);
|
||||
}
|
||||
|
||||
static int tomoyo_path_rename(struct path *old_parent,
|
||||
@@ -180,9 +168,8 @@ static int tomoyo_path_rename(struct path *old_parent,
|
||||
{
|
||||
struct path path1 = { old_parent->mnt, old_dentry };
|
||||
struct path path2 = { new_parent->mnt, new_dentry };
|
||||
return tomoyo_check_2path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_RENAME_ACL,
|
||||
&path1, &path2);
|
||||
return tomoyo_path2_perm(tomoyo_domain(), TOMOYO_TYPE_RENAME, &path1,
|
||||
&path2);
|
||||
}
|
||||
|
||||
static int tomoyo_file_fcntl(struct file *file, unsigned int cmd,
|
||||
@@ -209,55 +196,50 @@ static int tomoyo_dentry_open(struct file *f, const struct cred *cred)
|
||||
static int tomoyo_file_ioctl(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(), TOMOYO_TYPE_IOCTL_ACL,
|
||||
&file->f_path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_IOCTL,
|
||||
&file->f_path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
|
||||
mode_t mode)
|
||||
{
|
||||
struct path path = { mnt, dentry };
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(), TOMOYO_TYPE_CHMOD_ACL,
|
||||
&path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHMOD, &path);
|
||||
}
|
||||
|
||||
static int tomoyo_path_chown(struct path *path, uid_t uid, gid_t gid)
|
||||
{
|
||||
int error = 0;
|
||||
if (uid != (uid_t) -1)
|
||||
error = tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_CHOWN_ACL, path);
|
||||
error = tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHOWN,
|
||||
path);
|
||||
if (!error && gid != (gid_t) -1)
|
||||
error = tomoyo_check_1path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_CHGRP_ACL, path);
|
||||
error = tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHGRP,
|
||||
path);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int tomoyo_path_chroot(struct path *path)
|
||||
{
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(), TOMOYO_TYPE_CHROOT_ACL,
|
||||
path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_CHROOT, path);
|
||||
}
|
||||
|
||||
static int tomoyo_sb_mount(char *dev_name, struct path *path,
|
||||
char *type, unsigned long flags, void *data)
|
||||
{
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(), TOMOYO_TYPE_MOUNT_ACL,
|
||||
path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_MOUNT, path);
|
||||
}
|
||||
|
||||
static int tomoyo_sb_umount(struct vfsmount *mnt, int flags)
|
||||
{
|
||||
struct path path = { mnt, mnt->mnt_root };
|
||||
return tomoyo_check_1path_perm(tomoyo_domain(), TOMOYO_TYPE_UMOUNT_ACL,
|
||||
&path);
|
||||
return tomoyo_path_perm(tomoyo_domain(), TOMOYO_TYPE_UMOUNT, &path);
|
||||
}
|
||||
|
||||
static int tomoyo_sb_pivotroot(struct path *old_path, struct path *new_path)
|
||||
{
|
||||
return tomoyo_check_2path_perm(tomoyo_domain(),
|
||||
TOMOYO_TYPE_PIVOT_ROOT_ACL,
|
||||
new_path, old_path);
|
||||
return tomoyo_path2_perm(tomoyo_domain(), TOMOYO_TYPE_PIVOT_ROOT,
|
||||
new_path, old_path);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user