void __connman_service_set_identity(struct connman_service *service,
const char *identity);
+void __connman_service_set_agent_identity(struct connman_service *service,
+ const char *agent_identity);
void __connman_service_set_passphrase(struct connman_service *service,
const char* passphrase);
+void __connman_service_set_agent_passphrase(struct connman_service *service,
+ const char *agent_passphrase);
void __connman_service_notify(struct connman_service *service,
unsigned int rx_packets, unsigned int tx_packets,
unsigned short channel;
char *security;
char *passphrase;
+ char *agent_passphrase;
char *eap;
char *identity;
+ char *agent_identity;
char *ca_cert_path;
char *client_cert_path;
char *private_key_path;
g_free(network->wifi.mode);
g_free(network->wifi.security);
g_free(network->wifi.passphrase);
+ g_free(network->wifi.agent_passphrase);
g_free(network->wifi.eap);
g_free(network->wifi.identity);
+ g_free(network->wifi.agent_identity);
g_free(network->wifi.ca_cert_path);
g_free(network->wifi.client_cert_path);
g_free(network->wifi.private_key_path);
} else if (g_str_equal(key, "WiFi.Passphrase") == TRUE) {
g_free(network->wifi.passphrase);
network->wifi.passphrase = g_strdup(value);
+ } else if (g_str_equal(key, "WiFi.AgentPassphrase") == TRUE) {
+ g_free(network->wifi.agent_passphrase);
+ network->wifi.agent_passphrase = g_strdup(value);
} else if (g_str_equal(key, "WiFi.EAP") == TRUE) {
g_free(network->wifi.eap);
network->wifi.eap = g_strdup(value);
} else if (g_str_equal(key, "WiFi.Identity") == TRUE) {
g_free(network->wifi.identity);
network->wifi.identity = g_strdup(value);
+ } else if (g_str_equal(key, "WiFi.AgentIdentity") == TRUE) {
+ g_free(network->wifi.agent_identity);
+ network->wifi.agent_identity = g_strdup(value);
} else if (g_str_equal(key, "WiFi.CACertFile") == TRUE) {
g_free(network->wifi.ca_cert_path);
network->wifi.ca_cert_path = g_strdup(value);
return network->wifi.security;
else if (g_str_equal(key, "WiFi.Passphrase") == TRUE)
return network->wifi.passphrase;
+ else if (g_str_equal(key, "WiFi.AgentPassphrase") == TRUE)
+ return network->wifi.agent_passphrase;
else if (g_str_equal(key, "WiFi.EAP") == TRUE)
return network->wifi.eap;
else if (g_str_equal(key, "WiFi.Identity") == TRUE)
return network->wifi.identity;
+ else if (g_str_equal(key, "WiFi.AgentIdentity") == TRUE)
+ return network->wifi.agent_identity;
else if (g_str_equal(key, "WiFi.CACertFile") == TRUE)
return network->wifi.ca_cert_path;
else if (g_str_equal(key, "WiFi.ClientCertFile") == TRUE)
unsigned int order;
char *name;
char *passphrase;
+ char *agent_passphrase;
char *profile;
connman_bool_t roaming;
connman_bool_t login_required;
/* 802.1x settings from the config files */
char *eap;
char *identity;
+ char *agent_identity;
char *ca_cert_file;
char *client_cert_file;
char *private_key_file;
service->identity);
}
+void __connman_service_set_agent_identity(struct connman_service *service,
+ const char *agent_identity)
+{
+ g_free(service->agent_identity);
+ service->agent_identity = g_strdup(agent_identity);
+
+ if (service->network != NULL)
+ connman_network_set_string(service->network,
+ "WiFi.AgentIdentity",
+ service->agent_identity);
+}
+
void __connman_service_set_passphrase(struct connman_service *service,
const char* passphrase)
{
__connman_storage_save_service(service);
}
+void __connman_service_set_agent_passphrase(struct connman_service *service,
+ const char *agent_passphrase)
+{
+ g_free(service->agent_passphrase);
+ service->agent_passphrase = g_strdup(agent_passphrase);
+
+ if (service->network != NULL)
+ connman_network_set_string(service->network,
+ "WiFi.AgentPassphrase",
+ service->agent_passphrase);
+}
+
static DBusMessage *get_properties(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
return;
if (identity != NULL)
- __connman_service_set_identity(service, identity);
+ __connman_service_set_agent_identity(service, identity);
if (passphrase != NULL)
- __connman_service_set_passphrase(service, passphrase);
+ __connman_service_set_agent_passphrase(service, passphrase);
__connman_service_connect(service);
+
+ /* Never cache agent provided credentials */
+ __connman_service_set_agent_identity(service, NULL);
+ __connman_service_set_agent_passphrase(service, NULL);
}
static DBusMessage *connect_service(DBusConnection *conn,
g_free(service->profile);
g_free(service->name);
g_free(service->passphrase);
+ g_free(service->agent_passphrase);
g_free(service->identifier);
g_free(service->eap);
g_free(service->identity);
+ g_free(service->agent_identity);
g_free(service->ca_cert_file);
g_free(service->client_cert_file);
g_free(service->private_key_file);
if (g_str_equal(service->eap, "tls") == TRUE)
break;
- if (service->immutable != TRUE)
+ /*
+ * Return -ENOKEY if either identity or passphrase is
+ * missing. Agent provided credentials can be used as
+ * fallback if needed.
+ */
+ if ((service->identity == NULL &&
+ service->agent_identity == NULL) ||
+ (service->passphrase == NULL &&
+ service->agent_passphrase == NULL))
return -ENOKEY;
break;