Commit 8be80d41 authored by Santtu Lakkala's avatar Santtu Lakkala

[connman] Signal cleared properties on service removal. Contributes to JB#45980

parent e3a29406
......@@ -5466,6 +5466,8 @@ static DBusMessage *disconnect_service(DBusConnection *conn,
bool __connman_service_remove(struct connman_service *service)
{
size_t i;
if (service->type == CONNMAN_SERVICE_TYPE_ETHERNET ||
service->type == CONNMAN_SERVICE_TYPE_GADGET)
return false;
......@@ -5492,50 +5494,49 @@ bool __connman_service_remove(struct connman_service *service)
__connman_service_disconnect(service);
g_free(service->passphrase);
service->passphrase = NULL;
g_free(service->identity);
service->identity = NULL;
g_free(service->anonymous_identity);
service->anonymous_identity = NULL;
g_free(service->subject_match);
service->subject_match = NULL;
g_free(service->altsubject_match);
service->altsubject_match = NULL;
g_free(service->domain_suffix_match);
service->domain_suffix_match = NULL;
g_free(service->domain_match);
service->domain_match = NULL;
g_free(service->agent_identity);
service->agent_identity = NULL;
g_free(service->ca_cert);
service->ca_cert = NULL;
g_free(service->ca_cert_file);
service->ca_cert_file = NULL;
g_free(service->client_cert);
service->client_cert = NULL;
#define SVC_PROP(name, member, access) \
{ name, G_STRUCT_OFFSET(struct connman_service, member), access }
struct {
const char *name;
size_t offset;
enum connman_access default_access;
} cleared_properties[] = {
SVC_PROP(PROP_PASSPHRASE, passphrase, GET_PASSPHRASE_ACCESS),
SVC_PROP(PROP_IDENTITY, identity, GET_IDENTITY_ACCESS),
SVC_PROP("AnonymousIdentity", anonymous_identity,
GET_IDENTITY_ACCESS),
SVC_PROP("SubjectMatch", subject_match, GET_ACCESS_ACCESS),
SVC_PROP("AltSubjectMatch", altsubject_match,
GET_ACCESS_ACCESS),
SVC_PROP("DomainSuffixMatch", domain_suffix_match,
GET_ACCESS_ACCESS),
SVC_PROP("DomainMatch", domain_match, GET_ACCESS_ACCESS),
SVC_PROP("AgentIdentity", agent_identity,
GET_IDENTITY_ACCESS),
SVC_PROP("CACert", ca_cert, GET_ACCESS_ACCESS),
SVC_PROP("CACertFile", ca_cert_file, GET_ACCESS_ACCESS),
SVC_PROP("ClientCert", client_cert, GET_ACCESS_ACCESS),
SVC_PROP("ClientCertFile", client_cert_file,
GET_ACCESS_ACCESS),
SVC_PROP("PrivateKey", private_key, GET_PASSPHRASE_ACCESS),
SVC_PROP("PrivateKeyFile", private_key_file,
GET_PASSPHRASE_ACCESS),
SVC_PROP("PrivateKeyPassphrase", private_key_passphrase,
GET_PASSPHRASE_ACCESS),
};
#undef SVC_PROP
g_free(service->client_cert_file);
service->client_cert_file = NULL;
for (i = 0; i < G_N_ELEMENTS(cleared_properties); i++) {
char **member = &G_STRUCT_MEMBER(char *, service,
cleared_properties[i].offset);
g_free(service->private_key);
service->private_key = NULL;
g_free(*member);
*member = NULL;
g_free(service->private_key_file);
service->private_key_file = NULL;
g_free(service->private_key_passphrase);
service->private_key_passphrase = NULL;
restricted_string_changed(service,
cleared_properties[i].name, NULL,
cleared_properties[i].default_access);
}
service->error = CONNMAN_SERVICE_ERROR_UNKNOWN;
......
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