提交 edc26f7a 编写于 作者: J Jan Engelhardt 提交者: David S. Miller

[NETFILTER]: xt_owner: allow matching UID/GID ranges

Add support for ranges to the new revision. This doesn't affect
compatibility since the new revision was not released yet.
Signed-off-by: NJan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 37c08387
...@@ -8,8 +8,8 @@ enum { ...@@ -8,8 +8,8 @@ enum {
}; };
struct xt_owner_match_info { struct xt_owner_match_info {
u_int32_t uid; u_int32_t uid_min, uid_max;
u_int32_t gid; u_int32_t gid_min, gid_max;
u_int8_t match, invert; u_int8_t match, invert;
}; };
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* *
* (C) 2000 Marc Boucher <marc@mbsi.ca> * (C) 2000 Marc Boucher <marc@mbsi.ca>
* *
* Copyright © CC Computer Consultants GmbH, 2007 * Copyright © CC Computer Consultants GmbH, 2007 - 2008
* Contact: <jengelh@computergmbh.de> * <jengelh@computergmbh.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -102,13 +102,15 @@ owner_mt(const struct sk_buff *skb, const struct net_device *in, ...@@ -102,13 +102,15 @@ owner_mt(const struct sk_buff *skb, const struct net_device *in,
(XT_OWNER_UID | XT_OWNER_GID)) == 0; (XT_OWNER_UID | XT_OWNER_GID)) == 0;
if (info->match & XT_OWNER_UID) if (info->match & XT_OWNER_UID)
if ((filp->f_uid != info->uid) ^ if ((filp->f_uid >= info->uid_min &&
!!(info->invert & XT_OWNER_UID)) filp->f_uid <= info->uid_max) ^
!(info->invert & XT_OWNER_UID))
return false; return false;
if (info->match & XT_OWNER_GID) if (info->match & XT_OWNER_GID)
if ((filp->f_gid != info->gid) ^ if ((filp->f_gid >= info->gid_min &&
!!(info->invert & XT_OWNER_GID)) filp->f_gid <= info->gid_max) ^
!(info->invert & XT_OWNER_GID))
return false; return false;
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册