Change-Id: I8a02791d62c217c64e1e52a34c5ea3b5f61cd450
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Name: net-config
Summary: TIZEN Network Configuration service
Name: net-config
Summary: TIZEN Network Configuration service
Release: 2
Group: System/Network
License: Apache-2.0
Release: 2
Group: System/Network
License: Apache-2.0
if (g_strcmp0(sub_key, "Address") == 0) {
value = g_variant_get_string(variant, NULL);
preferred_address6 = g_strdup(value);
if (g_strcmp0(sub_key, "Address") == 0) {
value = g_variant_get_string(variant, NULL);
preferred_address6 = g_strdup(value);
}
}
g_variant_iter_free(sub_iter);
}
}
g_variant_iter_free(sub_iter);
while (g_variant_iter_loop(next, "{sv}", &key1, &variant)) {
if (g_strcmp0(key1, "Interface") == 0) {
value = g_variant_get_string(variant, NULL);
while (g_variant_iter_loop(next, "{sv}", &key1, &variant)) {
if (g_strcmp0(key1, "Interface") == 0) {
value = g_variant_get_string(variant, NULL);
- ifname = g_strdup(value);
+ if (!ifname)
+ ifname = g_strdup(value);
g_free(key1);
g_variant_unref(variant);
break;
g_free(key1);
g_variant_unref(variant);
break;
static void _supplicant_wifi_wps_credentials(GVariant *param)
{
gchar *key;
static void _supplicant_wifi_wps_credentials(GVariant *param)
{
gchar *key;
- char ssid[32];
- char wps_key[100];
+ char ssid[32] = {0, };
+ char wps_key[100] = {0, };
GVariantIter *iter;
GVariant *variant;
int config_error = 0;
GVariantIter *iter;
GVariant *variant;
int config_error = 0;
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN_FROM_NAT,
iptables_cmd, iptables_nat_chain_name);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN_FROM_NAT,
iptables_cmd, iptables_nat_chain_name);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN_FROM_NAT,
iptables_cmd, iptables_nat_chain_name);
if (netconfig_execute_cmd(buf))
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN_FROM_NAT,
iptables_cmd, iptables_nat_chain_name);
if (netconfig_execute_cmd(buf))
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_DROP_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_DROP_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_RETURN_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_RETURN_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_INSERT_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
filter = iptables_filter_in;
snprintf(buf, sizeof(buf), IPTABLES_FMT_INSERT_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
filter = iptables_filter_in;
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_CREATE_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_CREATE_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_DROP_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_DROP_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_RETURN_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_RETURN_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_INSERT_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
}
snprintf(buf, sizeof(buf), IPTABLES_FMT_INSERT_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
}
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
filter = iptables_filter_in;
filter = iptables_filter_in;
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_ACCEPT_RULE,
iptables_cmd, c, iptables_filter_prefix,
iptables_filter_in, 's', addr, mask);
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_ACCEPT_RULE,
iptables_cmd, c, iptables_filter_prefix,
iptables_filter_in, 's', addr, mask);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_ACCEPT_RULE_WITH_INTF,
iptables_cmd, c, iptables_filter_prefix, iptables_filter_in,
'i', interface, 's', addr, mask);
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_ACCEPT_RULE_WITH_INTF,
iptables_cmd, c, iptables_filter_prefix, iptables_filter_in,
'i', interface, 's', addr, mask);
memset(&ifr, 0, sizeof(ifr));
if (*iface_name)
memset(&ifr, 0, sizeof(ifr));
if (*iface_name)
- strncpy(ifr.ifr_name, iface_name, IFNAMSIZ);
+ strncpy(ifr.ifr_name, iface_name, IFNAMSIZ - 1);
/* get an interface name by ifindex */
if (ioctl(sk, SIOCGIFINDEX, &ifr) < 0) {
/* get an interface name by ifindex */
if (ioctl(sk, SIOCGIFINDEX, &ifr) < 0) {
DBG("vpn_block_networks");
DBG("vpn_block_networks");
+ memset(nets_vpn, 0, sizeof(char *) * arg_nr_nets_vpn);
+ memset(prefix_vpn, 0, sizeof(int) * arg_nr_nets_vpn);
+ memset(nets_orig, 0, sizeof(char *) * arg_nr_nets_vpn);
+ memset(prefix_orig, 0, sizeof(int) * arg_nr_nets_vpn);
+
/* arg_nets_vpn check */
if (arg_nr_nets_vpn > 0) {
if (arg_nets_vpn != NULL) {
/* arg_nets_vpn check */
if (arg_nr_nets_vpn > 0) {
if (arg_nets_vpn != NULL) {
ret = __get_mac_address(&mac_address);
if ((ret != TRUE) || (strlen(mac_address) == 0)) {
ERR("Cannot get WIFI MAC address");
ret = __get_mac_address(&mac_address);
if ((ret != TRUE) || (strlen(mac_address) == 0)) {
ERR("Cannot get WIFI MAC address");
tmp_dst = (unsigned char *)g_try_malloc0(length + 1);
if (!tmp_dst) {
ERR("failed to allocate memory");
tmp_dst = (unsigned char *)g_try_malloc0(length + 1);
if (!tmp_dst) {
ERR("failed to allocate memory");
+ g_variant_iter_free(iter_copy);
{
gint32 value = enable ? 1 : 0;
gboolean result = FALSE;
{
gint32 value = enable ? 1 : 0;
gboolean result = FALSE;
- GVariant *input_args = NULL;
-
- input_args = g_variant_new_int32(value);
result = netconfig_supplicant_invoke_dbus_interface_property_set(
result = netconfig_supplicant_invoke_dbus_interface_property_set(
- SUPPLICANT_IFACE_INTERFACE, "Passpoint", input_args, NULL);
+ SUPPLICANT_IFACE_INTERFACE, "Passpoint",
+ g_variant_new_int32(value), NULL);
if (result == FALSE)
ERR("Fail to set passpoint enable[%d]", enable);
if (result == FALSE)
ERR("Fail to set passpoint enable[%d]", enable);
static int retry_count = NETCONFIG_TECH_WAITING_COUNT;
gboolean value_enable = TRUE;
gboolean reply = FALSE;
static int retry_count = NETCONFIG_TECH_WAITING_COUNT;
gboolean value_enable = TRUE;
gboolean reply = FALSE;
- GVariant *param0 = NULL;
GVariant *params = NULL;
char key[] = "Powered";
GVariant *params = NULL;
char key[] = "Powered";
- param0 = g_variant_new_boolean(value_enable);
- params = g_variant_new("(sv)", key, param0);
+ params = g_variant_new("(sv)", key, g_variant_new_boolean(value_enable));
reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX,
reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX,
static int _set_connman_technology_power(gboolean enable)
{
gboolean reply = FALSE;
static int _set_connman_technology_power(gboolean enable)
{
gboolean reply = FALSE;
- GVariant *param0 = NULL;
GVariant *params = NULL;
char key[] = "Powered";
gboolean value_enable = TRUE;
GVariant *params = NULL;
char key[] = "Powered";
gboolean value_enable = TRUE;
- if (enable == TRUE)
- param0 = g_variant_new_boolean(value_enable);
- else
- param0 = g_variant_new_boolean(value_disable);
-
- params = g_variant_new("(sv)", key, param0);
+ params = g_variant_new("(sv)", key, (enable == TRUE) ?
+ g_variant_new_boolean(value_enable) : g_variant_new_boolean(value_disable));
reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE,
reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE,
const char *interface = SUPPLICANT_IFACE_WPS;
const char *key = "ProcessCredentials";
gboolean credentials = TRUE;
const char *interface = SUPPLICANT_IFACE_WPS;
const char *key = "ProcessCredentials";
gboolean credentials = TRUE;
- var = g_variant_new_boolean(credentials);
- params = g_variant_new("(ssv)", interface, key, var);
+ params = g_variant_new("(ssv)", interface, key, g_variant_new_boolean(credentials));
INFO("[net-config]: TizenMW-->WPAS: .Set");
reply = netconfig_invoke_dbus_method_nonblock(SUPPLICANT_SERVICE,
INFO("[net-config]: TizenMW-->WPAS: .Set");
reply = netconfig_invoke_dbus_method_nonblock(SUPPLICANT_SERVICE,