On 02/20/2017 11:23 AM, blanquicet(a)gmail.com wrote:
From: Jose Blanquicet
Currently, when a scan is requested, it is only check if device is powered. It
prevents to start scanning or finding if WiFi technology is disabled. However,
when WiFi technolgy is enabled but P2P technology is not, the P2P finding
can be started anyway. This patch prevents it by adding an additional control
on the technology status only in case the technology where scan was requested is
P2P, doing so the return values for WiFi technology will not change.
I re-read this paragraph many times but I don't really understand what
the problem is you try to fix. From the code I can read that if the
technology type is p2p and is !enabled (== disabled) return a permission
denied... Ah, is this check added because we end up at the same D-Bus
object for both WiFi and P2P? And if WiFi is enabled but not P2P we
should just return ENOPERM? That would make sense indeed.
I wouldn't mind if you could reword your commit message a bit. It is
really hard to understand.
src/technology.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/technology.c b/src/technology.c
index 4574f1e..d2f0ae2 100644
@@ -1077,6 +1077,10 @@ static DBusMessage *scan(DBusConnection *conn, DBusMessage *msg,
DBG("technology %p request from %s", technology,
+ if (technology->type == CONNMAN_SERVICE_TYPE_P2P &&
+ return __connman_error_permission_denied(msg);