// SPDX-License-Identifier: GPL-2.0 /* * security/tomoyo/group.c * * Copyright (C) 2005-2011 NTT DATA CORPORATION */ #include <linux/slab.h> #include <linux/rculist.h> #include "common.h" /** * tomoyo_same_path_group - Check for duplicated "struct tomoyo_path_group" entry. * * @a: Pointer to "struct tomoyo_acl_head". * @b: Pointer to "struct tomoyo_acl_head". * * Returns true if @a == @b, false otherwise. */ static bool tomoyo_same_path_group(const struct tomoyo_acl_head *a, const struct tomoyo_acl_head *b) { … } /** * tomoyo_same_number_group - Check for duplicated "struct tomoyo_number_group" entry. * * @a: Pointer to "struct tomoyo_acl_head". * @b: Pointer to "struct tomoyo_acl_head". * * Returns true if @a == @b, false otherwise. */ static bool tomoyo_same_number_group(const struct tomoyo_acl_head *a, const struct tomoyo_acl_head *b) { … } /** * tomoyo_same_address_group - Check for duplicated "struct tomoyo_address_group" entry. * * @a: Pointer to "struct tomoyo_acl_head". * @b: Pointer to "struct tomoyo_acl_head". * * Returns true if @a == @b, false otherwise. */ static bool tomoyo_same_address_group(const struct tomoyo_acl_head *a, const struct tomoyo_acl_head *b) { … } /** * tomoyo_write_group - Write "struct tomoyo_path_group"/"struct tomoyo_number_group"/"struct tomoyo_address_group" list. * * @param: Pointer to "struct tomoyo_acl_param". * @type: Type of this group. * * Returns 0 on success, negative value otherwise. */ int tomoyo_write_group(struct tomoyo_acl_param *param, const u8 type) { … } /** * tomoyo_path_matches_group - Check whether the given pathname matches members of the given pathname group. * * @pathname: The name of pathname. * @group: Pointer to "struct tomoyo_path_group". * * Returns matched member's pathname if @pathname matches pathnames in @group, * NULL otherwise. * * Caller holds tomoyo_read_lock(). */ const struct tomoyo_path_info * tomoyo_path_matches_group(const struct tomoyo_path_info *pathname, const struct tomoyo_group *group) { … } /** * tomoyo_number_matches_group - Check whether the given number matches members of the given number group. * * @min: Min number. * @max: Max number. * @group: Pointer to "struct tomoyo_number_group". * * Returns true if @min and @max partially overlaps @group, false otherwise. * * Caller holds tomoyo_read_lock(). */ bool tomoyo_number_matches_group(const unsigned long min, const unsigned long max, const struct tomoyo_group *group) { … } /** * tomoyo_address_matches_group - Check whether the given address matches members of the given address group. * * @is_ipv6: True if @address is an IPv6 address. * @address: An IPv4 or IPv6 address. * @group: Pointer to "struct tomoyo_address_group". * * Returns true if @address matches addresses in @group group, false otherwise. * * Caller holds tomoyo_read_lock(). */ bool tomoyo_address_matches_group(const bool is_ipv6, const __be32 *address, const struct tomoyo_group *group) { … }