1 From bc75ead8cdd5510afbdceb3627573331c699dae6 Mon Sep 17 00:00:00 2001
2 From: Guillaume Zajac <guillaume.zajac@linux.intel.com>
3 Date: Tue, 23 Oct 2012 14:30:17 +0200
4 Subject: [PATCH 3/3] context: Fix context creation issue
5 Content-Type: text/plain; charset="utf-8"
6 Content-Transfer-Encoding: 8bit
8 New internet context is always set as default internet connection.
9 Check proxy_addr formatting before filling in data base.
11 src/context.c | 23 ++++++++++++++++++++++-
12 1 file changed, 22 insertions(+), 1 deletion(-)
14 diff --git a/src/context.c b/src/context.c
15 index db775a8..152db83 100644
18 @@ -881,6 +881,19 @@ static int __ps_context_insert_profile_to_database(GHashTable *property, int net
23 + * Whether a profile is created with no proxy address and port,
24 + * settings application is passing ':' as proxy_addr value.
25 + * Checking proxy _address creation on application is needed, but
26 + * address:port formatting is also double check in packet service
29 + if (g_strcmp0(proxy_addr, ":") == 0) {
30 + dbg("Invalid proxy address, set it to NULL");
35 dbg("apn (%s), auth_type (%s), auth_id(%s), auth_pwd(%s), proxy_addr(%s), home_url(%s), svc_id(%s)",
36 apn, auth_type, auth_id, auth_pwd, proxy_addr, home_url, svc_id);
38 @@ -899,7 +912,7 @@ static int __ps_context_insert_profile_to_database(GHashTable *property, int net
39 strcat(szQuery," network_info_id, svc_category_id, hidden, editable, default_internet_con) values( ");
40 strcat(szQuery," ?, ?, ?, ?, ?, ?,");//1,2,3,4,5,6
41 strcat(szQuery," 1, ?, ?, 300,");//7,8
42 - strcat(szQuery," ?, ?, 0, 1, 0)");//9,10
43 + strcat(szQuery," ?, ?, 0, 1, ?)");//9,10,11
45 insert_key1 = g_strdup_printf("%d", profile_id);
46 insert_key2 = g_strdup_printf("%d", network_id);
47 @@ -924,6 +937,14 @@ static int __ps_context_insert_profile_to_database(GHashTable *property, int net
48 g_hash_table_insert(in_param, "9", g_strdup(insert_key2));
49 g_hash_table_insert(in_param, "10", g_strdup(svc_id));
51 + /* If profile received is Internet type */
52 + if (g_strcmp0(svc_id, "1") == 0) {
53 + dbg("Set new internet profile as default Internet connection");
54 + g_hash_table_insert(in_param, "11", g_strdup("1"));
55 + /* Profile is MMS or other type don't set it as default */
57 + g_hash_table_insert(in_param, "11", g_strdup("0"));
59 g_free(insert_key1);g_free(insert_key2);g_free(profile_name);
60 g_free(apn);g_free(auth_type);g_free(auth_id);g_free(auth_pwd);
61 g_free(proxy_addr);g_free(home_url);g_free(svc_id);