]> err.no Git - linux-2.6/commitdiff
[NETFILTER]: xt_owner: allow matching UID/GID ranges
authorJan Engelhardt <jengelh@computergmbh.de>
Thu, 31 Jan 2008 12:06:38 +0000 (04:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Feb 2008 03:27:43 +0000 (19:27 -0800)
Add support for ranges to the new revision. This doesn't affect
compatibility since the new revision was not released yet.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter/xt_owner.h
net/netfilter/xt_owner.c

index eacd34efebd51ec818eb94ccf55e4dd6b63c3e97..c84e52cfe415f55ee22563d464cf6b7311bb4df2 100644 (file)
@@ -8,8 +8,8 @@ enum {
 };
 
 struct xt_owner_match_info {
-       u_int32_t uid;
-       u_int32_t gid;
+       u_int32_t uid_min, uid_max;
+       u_int32_t gid_min, gid_max;
        u_int8_t match, invert;
 };
 
index d382f9cc38b0b5fbf90c4af50f4c5b5a2c7b2e65..9059c16144c3cb1d67fe3d6accc2f6951744e5a7 100644 (file)
@@ -4,8 +4,8 @@
  *
  * (C) 2000 Marc Boucher <marc@mbsi.ca>
  *
- * Copyright © CC Computer Consultants GmbH, 2007
- * Contact: <jengelh@computergmbh.de>
+ * Copyright © CC Computer Consultants GmbH, 2007 - 2008
+ * <jengelh@computergmbh.de>
  *
  * 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
@@ -102,13 +102,15 @@ owner_mt(const struct sk_buff *skb, const struct net_device *in,
                       (XT_OWNER_UID | XT_OWNER_GID)) == 0;
 
        if (info->match & XT_OWNER_UID)
-               if ((filp->f_uid != info->uid) ^
-                   !!(info->invert & XT_OWNER_UID))
+               if ((filp->f_uid >= info->uid_min &&
+                   filp->f_uid <= info->uid_max) ^
+                   !(info->invert & XT_OWNER_UID))
                        return false;
 
        if (info->match & XT_OWNER_GID)
-               if ((filp->f_gid != info->gid) ^
-                   !!(info->invert & XT_OWNER_GID))
+               if ((filp->f_gid >= info->gid_min &&
+                   filp->f_gid <= info->gid_max) ^
+                   !(info->invert & XT_OWNER_GID))
                        return false;
 
        return true;