commit ccc114fa5fe3c48dbd8f1339919b6ab65621afee
parent ab5a1d5d7d7ac33c8f7135b220f3b2d01175cefb
Author: Denis Kenzior <denkenz@gmail.com>
Date: Mon, 28 Oct 2019 11:32:57 -0500
dbus: Use the new /net/connman/iwd root path
Diffstat:
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/dbus.h b/src/dbus.h
@@ -36,7 +36,8 @@
#define IWD_ADHOC_INTERFACE "net.connman.iwd.AdHoc"
#define IWD_STATION_INTERFACE "net.connman.iwd.Station"
-#define IWD_AGENT_MANAGER_PATH "/"
+#define IWD_BASE_PATH "/net/connman/iwd"
+#define IWD_AGENT_MANAGER_PATH IWD_BASE_PATH
struct l_dbus;
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
@@ -77,7 +77,8 @@ static const char *known_network_get_path(const struct network_info *network)
static char path[256];
unsigned int pos = 0, i;
- path[pos++] = '/';
+ L_WARN_ON((pos = snprintf(path, sizeof(path), "%s/",
+ IWD_BASE_PATH)) >= (int) sizeof(path));
for (i = 0; network->ssid[i] && pos < sizeof(path); i++)
pos += snprintf(path + pos, sizeof(path) - pos, "%02x",
@@ -85,6 +86,7 @@ static const char *known_network_get_path(const struct network_info *network)
snprintf(path + pos, sizeof(path) - pos, "_%s",
security_to_str(network->type));
+ path[sizeof(path) - 1] = '\0';
return path;
}
diff --git a/src/netdev.c b/src/netdev.c
@@ -310,10 +310,13 @@ struct device *netdev_get_device(struct netdev *netdev)
const char *netdev_get_path(struct netdev *netdev)
{
- static char path[26];
+ static char path[256];
+
+ L_WARN_ON(snprintf(path, sizeof(path), "%s/%u",
+ wiphy_get_path(netdev->wiphy),
+ netdev->index) >= (int) sizeof(path));
+ path[sizeof(path) - 1] = '\0';
- snprintf(path, sizeof(path), "%s/%u", wiphy_get_path(netdev->wiphy),
- netdev->index);
return path;
}
diff --git a/src/wiphy.c b/src/wiphy.c
@@ -267,9 +267,12 @@ check_blacklist:
const char *wiphy_get_path(struct wiphy *wiphy)
{
- static char path[15];
+ static char path[256];
+
+ L_WARN_ON(snprintf(path, sizeof(path), "%s/%d", IWD_BASE_PATH,
+ wiphy->id) >= (int) sizeof(path));
+ path[sizeof(path) - 1] = '\0';
- snprintf(path, sizeof(path), "/%d", wiphy->id);
return path;
}