Commit 68fcd231 authored by Santtu Lakkala's avatar Santtu Lakkala

[connman] Export more service properties. Contributes to JB#45981

parent bce88c4d
......@@ -62,8 +62,12 @@
#define PROP_PASSPHRASE "Passphrase"
#define PROP_IDENTITY "Identity"
#define PROP_EAP "EAP"
#define PROP_PHASE2 "Phase2"
#define PROP_NAME "Name"
#define PROP_SSID "SSID"
#define PROP_CACERT "CACert"
#define PROP_CACERTFILE "CACertFile"
#define PROP_DOMAIN_SUFFIX_MATCH "DomainSuffixMatch"
/* Get/set properties */
#define GET_ACCESS_ACCESS CONNMAN_ACCESS_ALLOW
......@@ -76,6 +80,8 @@
#define SET_IDENTITY_ACCESS CONNMAN_ACCESS_DENY
#define GET_EAP_ACCESS CONNMAN_ACCESS_ALLOW
#define SET_EAP_ACCESS CONNMAN_ACCESS_DENY
#define GET_PHASE2_ACCESS CONNMAN_ACCESS_ALLOW
#define SET_PHASE2_ACCESS CONNMAN_ACCESS_DENY
/* Set properties (Get is always ACCESS_ALLOW for these) */
#define SET_PROXYCONFIG_ACCESS CONNMAN_ACCESS_DENY
......@@ -93,6 +99,7 @@
#define ACCESS_PROP_PASSPHRASE 0x00000004
#define ACCESS_PROP_IDENTITY 0x00000008
#define ACCESS_PROP_EAP 0x00000010
#define ACCESS_PROP_PHASE2 0x00000020
#define ACCESS_METHOD_CLEAR_PROPERTY 0x00000001
#define ACCESS_METHOD_CONNECT 0x00000002
......@@ -141,6 +148,11 @@ static const struct connman_service_property_access {
PROP_EAP,
GET_EAP_ACCESS,
SET_EAP_ACCESS
},{
ACCESS_PROP_PHASE2,
PROP_PHASE2,
GET_PHASE2_ACCESS,
SET_PHASE2_ACCESS
}
};
......@@ -878,7 +890,7 @@ static void service_apply(struct connman_service *service, GKeyFile *keyfile)
&service->private_key);
get_config_string(keyfile, service->identifier, "PrivateKeyPassphrase",
&service->private_key_passphrase);
get_config_string(keyfile, service->identifier, "Phase2",
get_config_string(keyfile, service->identifier, PROP_PHASE2,
&service->phase2);
str = g_key_file_get_string(keyfile,
......@@ -1070,7 +1082,7 @@ static int service_save(struct connman_service *service)
set_config_string(keyfile, service->identifier,
"PrivateKeyPassphrase", service->private_key_passphrase);
set_config_string(keyfile, service->identifier,
"Phase2", service->phase2);
PROP_PHASE2, service->phase2);
/* fall through */
case CONNMAN_SERVICE_TYPE_GADGET:
......@@ -3064,6 +3076,12 @@ static DBusMessage *get_property(DBusConnection *conn,
} else if (!g_strcmp0(name, PROP_EAP)) {
return check_and_reply_string(msg, service, name,
service->eap, GET_EAP_ACCESS);
} else if (!g_strcmp0(name, PROP_PHASE2)) {
return check_and_reply_string(msg, service, name,
service->phase2, GET_PHASE2_ACCESS);
} else if (!g_strcmp0(name, PROP_PHASE2)) {
return check_and_reply_string(msg, service, name,
service->phase2, GET_PHASE2_ACCESS);
}
DBG("%s requested %s - why?", dbus_message_get_sender(msg), name);
......@@ -3146,7 +3164,9 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
append_restricted_string(dict, service, PROP_IDENTITY,
service->identity, GET_IDENTITY_ACCESS);
append_restricted_string(dict, service, PROP_EAP,
service->eap, GET_IDENTITY_ACCESS);
service->eap, GET_EAP_ACCESS);
append_restricted_string(dict, service, PROP_PHASE2,
service->phase2, GET_PHASE2_ACCESS);
break;
case CONNMAN_SERVICE_TYPE_ETHERNET:
case CONNMAN_SERVICE_TYPE_BLUETOOTH:
......@@ -3942,6 +3962,20 @@ static gboolean set_eap_method(struct connman_service *service,
return FALSE;
}
static gboolean set_phase2(struct connman_service *service,
const char *phase2)
{
if (phase2 && !phase2[0])
phase2 = NULL;
if (!g_strcmp0(service->phase2, phase2))
return FALSE;
g_free(service->phase2);
service->phase2 = g_strdup(phase2);
restricted_string_changed(service, PROP_PHASE2,
service->phase2, GET_PHASE2_ACCESS);
return TRUE;
}
static DBusMessage *set_restricted_string(struct connman_service *service,
const char *name, DBusMessageIter *value, DBusMessage *msg,
gboolean (*set)(struct connman_service *, const char *),
......@@ -4670,6 +4704,9 @@ static DBusMessage *set_property(DBusConnection *conn,
} else if (g_str_equal(name, PROP_EAP)) {
return set_restricted_string(service, name, &value, msg,
set_eap_method, SET_EAP_ACCESS);
} else if (g_str_equal(name, PROP_PHASE2)) {
return set_restricted_string(service, name, &value, msg,
set_phase2, SET_PHASE2_ACCESS);
} else
return __connman_error_invalid_property(msg);
......@@ -6714,7 +6751,7 @@ void __connman_service_set_string(struct connman_service *service,
} else if (g_str_equal(key, "PrivateKeyPassphrase")) {
g_free(service->private_key_passphrase);
service->private_key_passphrase = g_strdup(value);
} else if (g_str_equal(key, "Phase2")) {
} else if (g_str_equal(key, PROP_PHASE2)) {
g_free(service->phase2);
service->phase2 = g_strdup(value);
} else if (g_str_equal(key, PROP_PASSPHRASE))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment