projects
/
platform
/
upstream
/
connman.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "vpn: Make domain parameter optional" into tizen
[platform/upstream/connman.git]
/
plugins
/
pacrunner.c
diff --git
a/plugins/pacrunner.c
b/plugins/pacrunner.c
old mode 100644
(file)
new mode 100755
(executable)
index
84c22ab
..
9c652f3
--- a/
plugins/pacrunner.c
+++ b/
plugins/pacrunner.c
@@
-2,7
+2,7
@@
*
* Connection Manager
*
*
* Connection Manager
*
- * Copyright (C) 2007-201
0
Intel Corporation. All rights reserved.
+ * Copyright (C) 2007-201
3
Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@
-67,8
+67,8
@@
static void create_config_reply(DBusPendingCall *call, void *user_data)
goto done;
}
goto done;
}
- if (
dbus_message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, &path
,
-
DBUS_TYPE_INVALID) == FALSE
)
+ if (
!dbus_message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH
,
+
&path, DBUS_TYPE_INVALID)
)
goto done;
g_free(current_config);
goto done;
g_free(current_config);
@@
-78,17
+78,12
@@
done:
dbus_message_unref(reply);
}
dbus_message_unref(reply);
}
-static void append_string(DBusMessageIter *iter, void *user_data)
-{
- dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, user_data);
-}
-
static void append_string_list(DBusMessageIter *iter, void *user_data)
{
char **list = user_data;
int i;
static void append_string_list(DBusMessageIter *iter, void *user_data)
{
char **list = user_data;
int i;
- for (i = 0; list[i]
!= NULL
; i++)
+ for (i = 0; list[i]; i++)
dbus_message_iter_append_basic(iter,
DBUS_TYPE_STRING, &list[i]);
}
dbus_message_iter_append_basic(iter,
DBUS_TYPE_STRING, &list[i]);
}
@@
-104,14
+99,14
@@
static void create_proxy_configuration(void)
const char *str;
char **str_list;
const char *str;
char **str_list;
- if (
default_service == NULL
)
+ if (
!default_service
)
return;
DBG("");
msg = dbus_message_new_method_call(PACRUNNER_SERVICE, PACRUNNER_PATH,
PACRUNNER_INTERFACE, "CreateProxyConfiguration");
return;
DBG("");
msg = dbus_message_new_method_call(PACRUNNER_SERVICE, PACRUNNER_PATH,
PACRUNNER_INTERFACE, "CreateProxyConfiguration");
- if (
msg == NULL
)
+ if (
!msg
)
return;
dbus_message_set_auto_start(msg, FALSE);
return;
dbus_message_set_auto_start(msg, FALSE);
@@
-121,6
+116,7
@@
static void create_proxy_configuration(void)
switch(connman_service_get_proxy_method(default_service)) {
case CONNMAN_SERVICE_PROXY_METHOD_UNKNOWN:
switch(connman_service_get_proxy_method(default_service)) {
case CONNMAN_SERVICE_PROXY_METHOD_UNKNOWN:
+ connman_dbus_dict_close(&iter, &dict);
goto done;
case CONNMAN_SERVICE_PROXY_METHOD_DIRECT:
method= "direct";
goto done;
case CONNMAN_SERVICE_PROXY_METHOD_DIRECT:
method= "direct";
@@
-129,8
+125,10
@@
static void create_proxy_configuration(void)
method = "manual";
str_list = connman_service_get_proxy_servers(default_service);
method = "manual";
str_list = connman_service_get_proxy_servers(default_service);
- if (str_list == NULL)
+ if (!str_list) {
+ connman_dbus_dict_close(&iter, &dict);
goto done;
goto done;
+ }
connman_dbus_dict_append_array(&dict, "Servers",
DBUS_TYPE_STRING, append_string_list,
connman_dbus_dict_append_array(&dict, "Servers",
DBUS_TYPE_STRING, append_string_list,
@@
-138,7
+136,7
@@
static void create_proxy_configuration(void)
g_strfreev(str_list);
str_list = connman_service_get_proxy_excludes(default_service);
g_strfreev(str_list);
str_list = connman_service_get_proxy_excludes(default_service);
- if (
str_list == NULL
)
+ if (
!str_list
)
break;
connman_dbus_dict_append_array(&dict, "Excludes",
break;
connman_dbus_dict_append_array(&dict, "Excludes",
@@
-151,11
+149,13
@@
static void create_proxy_configuration(void)
method = "auto";
str = connman_service_get_proxy_url(default_service);
method = "auto";
str = connman_service_get_proxy_url(default_service);
- if (
str == NULL
) {
+ if (
!str
) {
str = connman_service_get_proxy_autoconfig(
default_service);
str = connman_service_get_proxy_autoconfig(
default_service);
- if (str == NULL)
+ if (!str) {
+ connman_dbus_dict_close(&iter, &dict);
goto done;
goto done;
+ }
}
connman_dbus_dict_append_basic(&dict, "URL",
}
connman_dbus_dict_append_basic(&dict, "URL",
@@
-167,29
+167,25
@@
static void create_proxy_configuration(void)
DBUS_TYPE_STRING, &method);
interface = connman_service_get_interface(default_service);
DBUS_TYPE_STRING, &method);
interface = connman_service_get_interface(default_service);
- if (interface
!= NULL
) {
+ if (interface) {
connman_dbus_dict_append_basic(&dict, "Interface",
DBUS_TYPE_STRING, &interface);
g_free(interface);
}
connman_dbus_dict_append_basic(&dict, "Interface",
DBUS_TYPE_STRING, &interface);
g_free(interface);
}
- str = connman_service_get_domainname(default_service);
- if (str != NULL)
- connman_dbus_dict_append_array(&dict, "Domains",
- DBUS_TYPE_STRING, append_string, &str);
-
str_list = connman_service_get_nameservers(default_service);
str_list = connman_service_get_nameservers(default_service);
- if (str_list
!= NULL
)
+ if (str_list)
connman_dbus_dict_append_array(&dict, "Nameservers",
DBUS_TYPE_STRING, append_string_list,
str_list);
connman_dbus_dict_append_array(&dict, "Nameservers",
DBUS_TYPE_STRING, append_string_list,
str_list);
+ g_strfreev(str_list);
connman_dbus_dict_close(&iter, &dict);
result = dbus_connection_send_with_reply(connection, msg,
&call, DBUS_TIMEOUT);
connman_dbus_dict_close(&iter, &dict);
result = dbus_connection_send_with_reply(connection, msg,
&call, DBUS_TIMEOUT);
- if (
result == FALSE || call == NULL
)
+ if (
!result || !call
)
goto done;
dbus_pending_call_set_notify(call, create_config_reply, NULL, NULL);
goto done;
dbus_pending_call_set_notify(call, create_config_reply, NULL, NULL);
@@
-218,14
+214,14
@@
static void destroy_proxy_configuration(void)
DBusPendingCall *call;
dbus_bool_t result;
DBusPendingCall *call;
dbus_bool_t result;
- if (
current_config == NULL
)
+ if (
!current_config
)
return;
DBG("");
msg = dbus_message_new_method_call(PACRUNNER_SERVICE, PACRUNNER_PATH,
PACRUNNER_INTERFACE, "DestroyProxyConfiguration");
return;
DBG("");
msg = dbus_message_new_method_call(PACRUNNER_SERVICE, PACRUNNER_PATH,
PACRUNNER_INTERFACE, "DestroyProxyConfiguration");
- if (
msg == NULL
)
+ if (
!msg
)
return;
dbus_message_set_auto_start(msg, FALSE);
return;
dbus_message_set_auto_start(msg, FALSE);
@@
-238,7
+234,7
@@
static void destroy_proxy_configuration(void)
dbus_message_unref(msg);
dbus_message_unref(msg);
- if (
result == FALSE || call == NULL
)
+ if (
!result || !call
)
return;
dbus_pending_call_set_notify(call, destroy_config_reply, NULL, NULL);
return;
dbus_pending_call_set_notify(call, destroy_config_reply, NULL, NULL);
@@
-258,7
+254,7
@@
static void default_service_changed(struct connman_service *service)
default_service = service;
default_service = service;
- if (
daemon_running == FALSE
)
+ if (
!daemon_running
)
return;
destroy_proxy_configuration();
return;
destroy_proxy_configuration();
@@
-273,7
+269,7
@@
static void proxy_changed(struct connman_service *service)
if (service != default_service)
return;
if (service != default_service)
return;
- if (
daemon_running == FALSE
)
+ if (
!daemon_running
)
return;
destroy_proxy_configuration();
return;
destroy_proxy_configuration();
@@
-281,7
+277,7
@@
static void proxy_changed(struct connman_service *service)
create_proxy_configuration();
}
create_proxy_configuration();
}
-static struct connman_notifier pacrunner_notifier = {
+static
const
struct connman_notifier pacrunner_notifier = {
.name = "pacrunner",
.default_changed = default_service_changed,
.proxy_changed = proxy_changed,
.name = "pacrunner",
.default_changed = default_service_changed,
.proxy_changed = proxy_changed,
@@
-311,18
+307,18
@@
static char * parse_url(const char *url)
char *scheme, *host, *path, *host_ret;
scheme = g_strdup(url);
char *scheme, *host, *path, *host_ret;
scheme = g_strdup(url);
- if (
scheme == NULL
)
+ if (
!scheme
)
return NULL;
host = strstr(scheme, "://");
return NULL;
host = strstr(scheme, "://");
- if (host
!= NULL
) {
+ if (host) {
*host = '\0';
host += 3;
} else
host = scheme;
path = strchr(host, '/');
*host = '\0';
host += 3;
} else
host = scheme;
path = strchr(host, '/');
- if (path
!= NULL
)
+ if (path)
*(path++) = '\0';
host_ret = g_strdup(host);
*(path++) = '\0';
host_ret = g_strdup(host);
@@
-346,8
+342,8
@@
static void request_lookup_reply(DBusPendingCall *call, void *user_data)
goto done;
}
goto done;
}
- if (
dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &proxy
,
-
DBUS_TYPE_INVALID) == FALSE
)
+ if (
!dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING
,
+
&proxy, DBUS_TYPE_INVALID)
)
proxy = NULL;
done:
proxy = NULL;
done:
@@
-371,24
+367,21
@@
static int request_lookup(struct connman_service *service, const char *url)
DBG("");
DBG("");
- if (daemon_running == FALSE)
- return -EINVAL;
-
msg = dbus_message_new_method_call(PACRUNNER_SERVICE,
PACRUNNER_CLIENT_PATH,
PACRUNNER_CLIENT_INTERFACE,
"FindProxyForURL");
msg = dbus_message_new_method_call(PACRUNNER_SERVICE,
PACRUNNER_CLIENT_PATH,
PACRUNNER_CLIENT_INTERFACE,
"FindProxyForURL");
- if (
msg == NULL
)
+ if (
!msg
)
return -1;
host = parse_url(url);
return -1;
host = parse_url(url);
- if (
host == NULL
) {
+ if (
!host
) {
dbus_message_unref(msg);
return -EINVAL;
}
data = g_try_new0(struct proxy_data, 1);
dbus_message_unref(msg);
return -EINVAL;
}
data = g_try_new0(struct proxy_data, 1);
- if (
data == NULL
) {
+ if (
!data
) {
dbus_message_unref(msg);
g_free(host);
return -ENOMEM;
dbus_message_unref(msg);
g_free(host);
return -ENOMEM;
@@
-397,8
+390,6
@@
static int request_lookup(struct connman_service *service, const char *url)
data->url = g_strdup(url);
data->service = connman_service_ref(service);
data->url = g_strdup(url);
data->service = connman_service_ref(service);
- dbus_message_set_auto_start(msg, FALSE);
-
dbus_message_append_args(msg, DBUS_TYPE_STRING, &url,
DBUS_TYPE_STRING, &host,
DBUS_TYPE_INVALID);
dbus_message_append_args(msg, DBUS_TYPE_STRING, &url,
DBUS_TYPE_STRING, &host,
DBUS_TYPE_INVALID);
@@
-408,7
+399,7
@@
static int request_lookup(struct connman_service *service, const char *url)
dbus_message_unref(msg);
dbus_message_unref(msg);
- if (
result == FALSE || call == NULL
) {
+ if (
!result || !call
) {
g_free(host);
g_free(data->url);
g_free(data);
g_free(host);
g_free(data->url);
g_free(data);
@@
-441,7
+432,7
@@
static guint pacrunner_watch;
static int pacrunner_init(void)
{
connection = connman_dbus_get_connection();
static int pacrunner_init(void)
{
connection = connman_dbus_get_connection();
- if (
connection == NULL
)
+ if (
!connection
)
return -EIO;
pacrunner_watch = g_dbus_add_service_watch(connection,
return -EIO;
pacrunner_watch = g_dbus_add_service_watch(connection,