summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang zhengguang <zhengguang.zhang@intel.com>2014-10-11 07:09:09 (GMT)
committerChengyi Zhao <chengyi1.zhao@archermind.com>2014-11-08 06:15:34 (GMT)
commit37cbead2d2cbea4b9bd9f7180caf26a4b653662d (patch)
treecf910ed145688461aa751c0f3ada5d989fb09a71
parent44a0a44c579df0192ec33c291b2efdfabfe5c7eb (diff)
downloadconnman-37cbead2d2cbea4b9bd9f7180caf26a4b653662d.zip
connman-37cbead2d2cbea4b9bd9f7180caf26a4b653662d.tar.gz
connman-37cbead2d2cbea4b9bd9f7180caf26a4b653662d.tar.bz2
multi-user: Add multi-user support in technologyrefs/changes/13/29713/3
Use case: Given 2 users: UserA and UserB If UserA is connected to a wifi service, then UserB is not allowed to set wifi technology properties. Change-Id: Ia783b22bc28e9e487ddfa3a4c249c9d1ea76bde8
-rw-r--r--src/technology.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/technology.c b/src/technology.c
index 679c779..70732f6 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -862,6 +862,21 @@ static DBusMessage *set_property(DBusConnection *conn,
DBG("property %s", name);
+ if (technology->type == CONNMAN_SERVICE_TYPE_WIFI && technology->connected) {
+ uid_t uid;
+ if (connman_dbus_get_connection_unix_user_sync(conn,
+ dbus_message_get_sender(msg),
+ &uid) < 0) {
+ DBG("Can not get unix user id!");
+ return __connman_error_permission_denied(msg);
+ }
+
+ if (!__connman_service_is_user_allowed(CONNMAN_SERVICE_TYPE_WIFI, uid)) {
+ DBG("Not allow this user to operate wifi technology now!");
+ return __connman_error_permission_denied(msg);
+ }
+ }
+
if (g_str_equal(name, "Tethering")) {
dbus_bool_t tethering;
int err;