void *data;
};
-/* Returns Supplicant interface
- * Do not free the returned interface */
-const char *netconfig_wifi_get_supplicant_interface(void);
+/* Returns Supplicant interface.
+ * Need to release interface using g_free */
+char *netconfig_wifi_get_supplicant_interface(void);
GList *setup_input_args(GList *list, struct dbus_input_arguments *items);
GVariant *netconfig_supplicant_invoke_dbus_method(const char *dest, const char *path,
#include "netdbus.h"
#include "netsupplicant.h"
-#define DBUS_OBJECT_PATH_MAX 150
-
-const char *netconfig_wifi_get_supplicant_interface(void)
+char *netconfig_wifi_get_supplicant_interface(void)
{
GVariant *message = NULL;
GVariant *params = NULL;
gchar *path = NULL;
- static char obj_path[DBUS_OBJECT_PATH_MAX] = { '\0', };
-
- if (obj_path[0] != '\0')
- return (const char *)obj_path;
params = g_variant_new("(s)", WIFI_IFNAME);
g_variant_get(message, "(o)", &path);
- g_strlcpy(obj_path, path, DBUS_OBJECT_PATH_MAX);
-
- if (path)
- g_free(path);
g_variant_unref(message);
- return (const char *)obj_path;
+ return (char *)path;
}
GVariant *netconfig_supplicant_invoke_dbus_method(const char *dest, const char *path,
{
GVariant *params = NULL;
GVariant *reply = NULL;
- const char *path;
+ char *path;
ERR("[GDBUS] property_get : %s", key);
"Get",
params);
+ g_free(path);
if (reply == NULL) {
ERR("netconfig_supplicant_invoke_dbus_method() failed.");
return NULL;
{
gboolean result = FALSE;
GVariant *message = NULL;
- const char *path;
+ char *path;
DBG("[DBUS] property_set : %s", key);
message,
notify_func);
+ g_free(path);
if (result == FALSE) {
ERR("dbus_connection_send_with_reply() failed");
static int _netconfig_wifi_bssid_get_bss(void)
{
gboolean reply = FALSE;
- const char *if_path = NULL;
+ char *if_path = NULL;
GVariant *params = NULL;
if_path = netconfig_wifi_get_supplicant_interface();
reply = netconfig_invoke_dbus_method_nonblock(SUPPLICANT_SERVICE,
if_path, DBUS_INTERFACE_PROPERTIES,
"Get", params, __netconfig_wifi_bssid_get_bss_result);
+
+ g_free(if_path);
if (reply != TRUE) {
ERR("Fail to method: Get");
__netconfig_set_bssid_scan_mode(FALSE);
}
-static int __netconfig_wifi_bssid_request_scan(const char *if_path)
+static int __netconfig_wifi_bssid_request_scan(char *if_path)
{
GDBusConnection *connection = NULL;
GVariant *message = NULL;
GVariantBuilder *builder = NULL;
const char *key1 = "Type";
const char *val1 = "passive";
+ gboolean is_free_required = FALSE;
- if (if_path == NULL)
+ if (if_path == NULL) {
if_path = netconfig_wifi_get_supplicant_interface();
+ is_free_required = TRUE;
+ }
if (if_path == NULL) {
DBG("Fail to get wpa_supplicant DBus path");
netconfig_is_device_scanning = TRUE;
+ if (is_free_required)
+ g_free(if_path);
g_variant_unref(message);
/* Clear bss_info_list for the next scan result */
if (bssid_info_list) {
GVariant *params = NULL;
GVariant *message = NULL;
GVariantBuilder *bytearray_builder = NULL;
- const char *if_path;
+ char *if_path;
int i = 0;
size_t vsie_len = 0;
message = netconfig_supplicant_invoke_dbus_method(SUPPLICANT_SERVICE,
if_path, SUPPLICANT_INTERFACE ".Interface", "VendorElemAdd", params);
+ g_free(if_path);
if (message == NULL) {
ERR("Failed to send command to wpa_supplicant");
g_free(bytearray);
{
GVariant *params = NULL;
GVariant *message = NULL;
- const char *if_path;
+ char *if_path;
if (frame_id >= NETCONFIG_VSIE_FRAME_MAX) {
DBG("Invalid parameter, frame-id: %d", frame_id);
message = netconfig_supplicant_invoke_dbus_method(SUPPLICANT_SERVICE,
if_path, SUPPLICANT_INTERFACE ".Interface", "VendorElemGet", params);
+ g_free(if_path);
if (message == NULL) {
ERR("Failed to send command to wpa_supplicant");
return FALSE;
GVariant *params = NULL;
GVariant *message = NULL;
GVariantBuilder *bytearray_builder = NULL;
- const char *if_path;
+ char *if_path;
int i = 0;
size_t vsie_len = 0;
message = netconfig_supplicant_invoke_dbus_method(SUPPLICANT_SERVICE,
if_path, SUPPLICANT_INTERFACE ".Interface", "VendorElemRem", params);
+ g_free(if_path);
if (message == NULL) {
ERR("Failed to send command to wpa_supplicant");
g_free(bytearray);
g_return_val_if_fail(wifi != NULL, FALSE);
GDBusConnection *connection = NULL;
- const char *if_path = NULL;
+ char *if_path = NULL;
if_path = netconfig_wifi_get_supplicant_interface();
if (if_path == NULL) {
if (connection == NULL) {
netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailFlushBss");
ERR("Failed to get netdbus connection");
+ g_free(if_path);
return FALSE;
}
NULL,
NULL);
+ g_free(if_path);
wifi_complete_flush_bss(wifi, context);
return TRUE;
}
static int __netconfig_wifi_update_and_get_rssi(void)
{
- const char *if_path = NULL;
+ char *if_path = NULL;
GVariant *message = NULL;
GVariant *value = NULL;
gchar *key;
message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE, if_path,
SUPPLICANT_INTERFACE ".Interface", "SignalPoll", NULL);
+
+ g_free(if_path);
if (message == NULL) {
ERR("Fail to get SignalPoll from wpa_supplicant");
return 0;
static void _set_power_save(gboolean power_save)
{
gboolean result;
- const char *if_path;
+ char *if_path;
GVariant *input_args = NULL;
static gboolean old_state = TRUE;
const gchar *args_disable = "POWERMODE 1";
else
old_state = power_save;
+ g_free(if_path);
+
return;
}
static GVariant * __netconfig_wifi_tdls_send_dbus_str(const char* method, const char *str)
{
GVariant *message = NULL;
- const char *if_path = NULL;
+ char *if_path = NULL;
GVariant *params = NULL;
if_path = netconfig_wifi_get_supplicant_interface();
message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE,
if_path, SUPPLICANT_INTERFACE ".Interface", method, params);
+ g_free(if_path);
INFO("TDLS Returned from Blocking method for Send DBUS Command");
return message;
}
GVariant *message = NULL;
GVariantBuilder *builder;
GVariant *params;
- const char *if_path = NULL;
+ char *if_path = NULL;
unsigned char oper_class = 0;
if (peer_mac_Addr == NULL) {
message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE,
if_path, SUPPLICANT_INTERFACE ".Interface", "TDLSChannelSwitch", params);
+ g_free(if_path);
if (message == NULL) {
ERR(" TDLS : Fail to Process TDLS Channel Switch Request !!!");
wifi_complete_tdls_channel_switch(wifi, context,
GVariant *message = NULL;
GVariantBuilder *builder = NULL;
const char *role = "enrollee", *type, *key;
- const char *if_path = NULL;
+ char *if_path = NULL;
gboolean reply = FALSE;
- if (if_path == NULL)
- if_path = netconfig_wifi_get_supplicant_interface();
-
+ if_path = netconfig_wifi_get_supplicant_interface();
if (if_path == NULL) {
DBG("Fail to get wpa_supplicant DBus path");
return;
message,
(GAsyncReadyCallback) interface_wps_start_result);
+ g_free(if_path);
if (reply != TRUE)
ERR("Fail to Scan");
return;
}
-static gboolean __netconfig_wifi_invoke_wps_process_credentials(const char *object_path)
+static gboolean __netconfig_wifi_invoke_wps_process_credentials(char *object_path)
{
gboolean reply = FALSE;
GVariant *params = NULL;
gboolean netconfig_wifi_wps_connect()
{
- const char *if_path = NULL;
+ char *if_path = NULL;
if_path = netconfig_wifi_get_supplicant_interface();
if (if_path == NULL) {
if (__netconfig_wifi_invoke_wps_process_credentials(if_path) == TRUE) {
ERR("Wi-Fi WPS Connect started");
-
+ g_free(if_path);
return TRUE;
}
+ g_free(if_path);
return FALSE;
}
static gboolean __netconfig_wifi_invoke_wps_cancel()
{
gboolean reply = FALSE;
- const char *if_path = NULL;
+ char *if_path = NULL;
if_path = netconfig_wifi_get_supplicant_interface();
if (if_path == NULL) {
if (reply != TRUE)
ERR("M/W--->WPAS: Interface.WPS.Cancel Method Failed");
+ g_free(if_path);
return reply;
}