Sometimes users need create the open Wi-Fi Access Point

---
 include/technology.h |    2 ++
 plugins/wifi.c       |    1 +
 src/technology.c     |   17 +++++++++++++++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/technology.h b/include/technology.h
index 9fe994c..1d9b333 100644
--- a/include/technology.h
+++ b/include/technology.h
@@ -36,6 +36,8 @@ extern "C" {
 
 struct connman_technology;
 
+void connman_technology_reset_tethering_properties(
+                               struct connman_technology *technology);
 void connman_technology_tethering_notify(struct connman_technology *technology,
                                                        connman_bool_t enabled);
 int connman_technology_set_regdom(const char *alpha2);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 5f07869..7960da3 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2035,6 +2035,7 @@ static int tech_set_tethering(struct connman_technology 
*technology,
                }
 
                connman_technology_tethering_notify(technology, FALSE);
+               connman_technology_reset_tethering_properties(technology);
 
                return 0;
        }
diff --git a/src/technology.c b/src/technology.c
index f210859..949496d 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -282,6 +282,20 @@ static void tethering_changed(struct connman_technology 
*technology)
        technology_save(technology);
 }
 
+void connman_technology_reset_tethering_properties(struct connman_technology
+                                                  *technology)
+{
+       if (technology->tethering_ident != NULL) {
+               g_free(technology->tethering_ident);
+               technology->tethering_ident = NULL;
+       }
+
+       if (technology->tethering_passphrase != NULL) {
+               g_free(technology->tethering_passphrase);
+               technology->tethering_passphrase = NULL;
+       }
+}
+
 void connman_technology_tethering_notify(struct connman_technology *technology,
                                                        connman_bool_t enabled)
 {
@@ -328,8 +342,7 @@ static int set_tethering(struct connman_technology 
*technology,
        if (bridge == NULL)
                return -EOPNOTSUPP;
 
-       if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
-           (ident == NULL || passphrase == NULL))
+       if (technology->type == CONNMAN_SERVICE_TYPE_WIFI && ident == NULL)
                return -EINVAL;
 
        for (tech_drivers = technology->driver_list; tech_drivers != NULL;
-- 
1.7.9.5

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to