summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiung Yu <jiung.yu@samsung.com>2017-04-27 08:44:14 (GMT)
committerJiung Yu <jiung.yu@samsung.com>2017-04-27 08:44:24 (GMT)
commit381b4d64dc20981d0019aa9c15692c3fa36e0292 (patch)
tree9848afa5d01ff1fcad4b9c5aec2c6d10cdd22992
parent1664a9129b021a21f4d96abea734a9df9913835c (diff)
downloadconnman-381b4d64dc20981d0019aa9c15692c3fa36e0292.zip
connman-381b4d64dc20981d0019aa9c15692c3fa36e0292.tar.gz
connman-381b4d64dc20981d0019aa9c15692c3fa36e0292.tar.bz2
Change-Id: Ia57fc4f8b8b2740728d6df2972463f66a48b7b67 Signed-off-by: Yu jiung <jiung.yu@samsung.com>
-rwxr-xr-xpackaging/connman.spec2
-rw-r--r--vpn/plugins/ipsec.c12
-rw-r--r--vpn/plugins/vici-client.c10
3 files changed, 15 insertions, 9 deletions
diff --git a/packaging/connman.spec b/packaging/connman.spec
index f9a90f6..241b835 100755
--- a/packaging/connman.spec
+++ b/packaging/connman.spec
@@ -5,7 +5,7 @@
Name: connman
Version: 1.29
-Release: 21
+Release: 22
License: GPL-2.0+
Summary: Connection Manager
Url: http://connman.net
diff --git a/vpn/plugins/ipsec.c b/vpn/plugins/ipsec.c
index 5e34770..e4bbf2b 100644
--- a/vpn/plugins/ipsec.c
+++ b/vpn/plugins/ipsec.c
@@ -719,10 +719,10 @@ static char *load_file_from_path(const char *path)
struct stat st;
FILE *fp = NULL;
int fd = 0;
- unsigned long long file_size = 0;
+ size_t file_size = 0;
char *file_buff = NULL;
- if (file_buff) {
+ if (path) {
connman_error("File path is NULL\n");
return NULL;
}
@@ -839,6 +839,10 @@ static int ipsec_load_cert(struct vpn_provider *provider)
flag = vpn_provider_get_string(provider, "IPsec.CertFlag");
data = load_file_from_path(vpn_provider_get_string(provider, "IPsec.CertData"));
DBG("CertType: %s, CertFalg: %s,CertData: %s", type, flag, data);
+ if (!type || ! flag || !data) {
+ connman_error("invalid certification information");
+ return -EINVAL;
+ }
ret = vici_load_cert(type, flag, data);
if (ret < 0)
@@ -1024,6 +1028,10 @@ static int ipsec_connect(struct vpn_provider *provider,
int err = 0;
data = create_ipsec_private_data(provider, cb, user_data);
+ if (!data) {
+ connman_error("create ipsec private data failed");
+ return -ENOMEM;
+ }
/*
* Start charon daemon using ipsec script of strongSwan.
*/
diff --git a/vpn/plugins/vici-client.c b/vpn/plugins/vici-client.c
index befbd93..c312fed 100644
--- a/vpn/plugins/vici-client.c
+++ b/vpn/plugins/vici-client.c
@@ -264,7 +264,7 @@ static char *load_cert_from_path(const char *path)
struct stat st;
FILE *fp = NULL;
int fd = 0;
- unsigned long long file_size = 0;
+ size_t file_size = 0;
char *file_buff = NULL;
fp = fopen(path, "rb");
@@ -812,7 +812,6 @@ static int handle_vici_result(gboolean success, int cmd, char * err)
if (success)
return 0;
- DBG(" %s failed with %s!\n", vici_cmd_str[cmd], err);
g_free(err);
switch (cmd) {
@@ -838,6 +837,7 @@ static int handle_vici_result(gboolean success, int cmd, char * err)
break;
}
+ DBG(" %s failed with %d!\n", vici_cmd_str[cmd], ret);
return ret;
}
@@ -999,15 +999,13 @@ static gboolean process_reply(GIOChannel *source,
}
ret = process_vici_response(req);
- if (ret != 0)
- vici_client->reply(ret, vici_client->ipsec_user_data);
-
vici_client->request_list = g_slist_remove(vici_client->request_list, req);
destroy_vici_request(req);
/* TODO :remove this after debug */
DBG("left request reply : %d", g_slist_length(vici_client->request_list));
- if(g_slist_length(vici_client->request_list) == 0)
+
+ if (ret!= 0 || g_slist_length(vici_client->request_list) == 0)
vici_client->reply(ret, vici_client->ipsec_user_data);
return TRUE;