summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2024-04-24 17:27:27 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2024-04-25 15:56:47 +0900
commit9e316be9ff3ee9b4c009c3e2f1c5d27274a65cd5 (patch)
tree7819ec4f1fe6941ea296775bd721c60179aedd64
parentd62b1b1a6220e4d6b80b4874b9214e74aa64b60f (diff)
downloadconnman-tizen_7.0.tar.gz
connman-tizen_7.0.tar.bz2
connman-tizen_7.0.zip
Change-Id: I8ca4010821194027d95d1b99a9f468b464381a32 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xsrc/service.c79
1 files changed, 78 insertions, 1 deletions
diff --git a/src/service.c b/src/service.c
index e6e4fe3c..18930b19 100755
--- a/src/service.c
+++ b/src/service.c
@@ -7341,13 +7341,90 @@ bool __connman_service_remove(struct connman_service *service)
return true;
}
+#if defined TIZEN_EXT
+static char *__connman_service_get_wpa_id_to_remove(struct connman_service *service)
+{
+ char *identifier;
+ char *ptr;
+
+ if (service->type != CONNMAN_SERVICE_TYPE_WIFI)
+ return NULL;
+
+ if (service->security != CONNMAN_SERVICE_SECURITY_SAE &&
+ service->security != CONNMAN_SERVICE_SECURITY_PSK)
+ return NULL;
+
+ identifier = g_strdup(service->identifier);
+ if (!identifier)
+ return NULL;
+
+ if (service->security == CONNMAN_SERVICE_SECURITY_SAE) {
+ ptr = strstr(identifier, "_sae");
+ if (!ptr) {
+ g_free(identifier);
+ return NULL;
+ }
+
+ memcpy(ptr, "_psk", strlen("_psk"));
+ } else if (service->security == CONNMAN_SERVICE_SECURITY_PSK) {
+ ptr = strstr(identifier, "_psk");
+ if (!ptr) {
+ g_free(identifier);
+ return NULL;
+ }
+
+ memcpy(ptr, "_sae", strlen("_sae"));
+ }
+
+ return identifier;
+}
+
+
+static void __connman_service_remove_wpa_service(struct connman_service *service)
+{
+ gchar *dir;
+ GList *list;
+ char *identifier = __connman_service_get_wpa_id_to_remove(service);
+
+ if (!identifier)
+ return;
+
+ dir = g_strdup_printf("%s/%s", STORAGEDIR, identifier);
+ if (!dir)
+ goto done;
+
+ if (g_file_test(dir, G_FILE_TEST_EXISTS) != TRUE)
+ goto done;
+
+ for (list = service_list; list; list = list->next) {
+ struct connman_service *dst_service = list->data;
+
+ if (dst_service->type != CONNMAN_SERVICE_TYPE_WIFI)
+ continue;
+
+ if (g_strcmp0(dst_service->identifier, identifier) == 0) {
+ __connman_service_remove(dst_service);
+ goto done;
+ }
+ }
+
+ __connman_storage_remove_service(identifier);
+
+done:
+ g_free(identifier);
+ g_free(dir);
+}
+#endif
+
static DBusMessage *remove_service(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
struct connman_service *service = user_data;
DBG("service %p", service);
-
+#if defined TIZEN_EXT
+ __connman_service_remove_wpa_service(service);
+#endif
if (!__connman_service_remove(service))
return __connman_error_not_supported(msg);