Tethering: Add open access point support in technology 94/5694/3
authorChengyi Zhao <chengyi1.zhao@archermind.com>
Thu, 11 Jul 2013 01:12:01 +0000 (09:12 +0800)
committerZhang zhengguang <zhengguang.zhang@intel.com>
Thu, 18 Jul 2013 15:18:17 +0000 (23:18 +0800)
src/technology.c

index 0293094..faf5ae0 100644 (file)
@@ -328,8 +328,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;
@@ -890,19 +889,23 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
                        return __connman_error_not_supported(msg);
 
-               if (strlen(str) < 8 || strlen(str) > 63)
-                       return __connman_error_passphrase_required(msg);
-
-               if (g_strcmp0(technology->tethering_passphrase, str) != 0) {
-                       g_free(technology->tethering_passphrase);
-                       technology->tethering_passphrase = g_strdup(str);
-                       technology_save(technology);
-
-                       connman_dbus_property_changed_basic(technology->path,
-                                       CONNMAN_TECHNOLOGY_INTERFACE,
-                                       "TetheringPassphrase",
-                                       DBUS_TYPE_STRING,
-                                       &technology->tethering_passphrase);
+               if (strlen(str) < 8 || strlen(str) > 63) {
+                       if (g_str_equal(str, ""))
+                               technology->tethering_passphrase = NULL;
+                       else
+                               return __connman_error_passphrase_required(msg);
+               } else {
+                       if (g_strcmp0(technology->tethering_passphrase, str) != 0) {
+                               g_free(technology->tethering_passphrase);
+                               technology->tethering_passphrase = g_strdup(str);
+                               technology_save(technology);
+
+                               connman_dbus_property_changed_basic(technology->path,
+                                               CONNMAN_TECHNOLOGY_INTERFACE,
+                                               "TetheringPassphrase",
+                                               DBUS_TYPE_STRING,
+                                               &technology->tethering_passphrase);
+                       }
                }
        } else if (g_str_equal(name, "Powered") == TRUE) {
                connman_bool_t enable;