linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: John Linville <linville@tuxdriver.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	Andy Green <andy@warmcat.com>,
	linux-wireless@vger.kernel.org
Subject: [PATCH] cfg80211: Don't allow users to create/remove interfaces
Date: Wed, 11 Jul 2007 01:17:25 +0200	[thread overview]
Message-ID: <200707110117.26067.mb@bu3sch.de> (raw)

This adds a capability check to only allow creation
and removal of interfaces by a network admin.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Andy Green <andy@warmcat.com>

Index: mac80211/net/wireless/sysfs.c
===================================================================
--- mac80211.orig/net/wireless/sysfs.c	2007-06-01 11:20:32.000000000 +0200
+++ mac80211/net/wireless/sysfs.c	2007-07-11 01:04:53.000000000 +0200
@@ -46,9 +46,10 @@ static ssize_t _store_add_iface(struct d
 	struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
 	int res;
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
 	if (len > IFNAMSIZ)
 		return -EINVAL;
-
 	if (!rdev->ops->add_virtual_intf)
 		return -ENOSYS;
 
@@ -68,9 +69,10 @@ static ssize_t _store_remove_iface(struc
 	int res, ifidx;
 	struct net_device *netdev;
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
 	if (len > IFNAMSIZ)
 		return -EINVAL;
-
 	if (!rdev->ops->del_virtual_intf)
 		return -ENOSYS;
 

-- 
Greetings Michael.

             reply	other threads:[~2007-07-10 23:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10 23:17 Michael Buesch [this message]
2007-07-11  9:36 ` [PATCH] cfg80211: Don't allow users to create/remove interfaces Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707110117.26067.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=andy@warmcat.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).