Merge tag 'upstream/1.40' into tizen.
[platform/upstream/connman.git] / vpn / vpn-config.c
index 2fe0307..e412b89 100755 (executable)
@@ -234,11 +234,11 @@ static int load_provider(GKeyFile *keyfile, const char *group,
        host = get_string(config_provider, "Host");
        domain = get_string(config_provider, "Domain");
 #if !defined TIZEN_EXT
-       if (host && domain) {
+       if (host) {
                char *id = __vpn_provider_create_identifier(host, domain);
 #else
        name = get_string(config_provider, "Name");
-       if (host && domain && name) {
+       if (host && name) {
                char *id = __vpn_provider_create_identifier(host, domain, name);
 #endif
 
@@ -265,7 +265,7 @@ static int load_provider(GKeyFile *keyfile, const char *group,
 #if !defined TIZEN_EXT
                DBG("invalid values host %s domain %s", host, domain);
 #else
-               DBG("invalid values host %s domain %s name %s", host, domain, name);
+               DBG("invalid configuration: no host specified");
 #endif
                err = -EINVAL;
                goto err;
@@ -594,3 +594,18 @@ char **__vpn_config_get_string_list(GKeyFile *key_file,
 
        return strlist;
 }
+
+bool __vpn_config_get_boolean(GKeyFile *key_file, const char *group_name,
+                       const char *key, bool default_value)
+{
+       GError *error = NULL;
+       bool val;
+
+       val = g_key_file_get_boolean(key_file, group_name, key, &error);
+       if (error) {
+               g_error_free(error);
+               return default_value;
+       }
+
+       return val;
+}