Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino_ConnectionHandler does not handle open networks correctly #114

Open
thomasvdv opened this issue Mar 5, 2024 · 7 comments
Open
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@thomasvdv
Copy link

thomasvdv commented Mar 5, 2024

At line 101 in Arduino_WiFiConnectionHandler.cpp:

The code should check for an empty password and, if so, call WiFi.begin(_ssid) instead of WiFi.begin(_ssid, _password).

WiFi.begin(_ssid, "") results in a failed connection on open networks that do not require a password to connect. WiFi.begin(_ssid) connects successfully.

@thomasvdv thomasvdv changed the title Arduino_ConnectionHandler does not handle null passwords Arduino_ConnectionHandler does not handle empty passwords correctly Mar 5, 2024
@thomasvdv thomasvdv closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2024
@thomasvdv thomasvdv reopened this Mar 5, 2024
@thomasvdv thomasvdv changed the title Arduino_ConnectionHandler does not handle empty passwords correctly Arduino_ConnectionHandler does not handle open networks correctly Mar 5, 2024
@pennam
Copy link
Contributor

pennam commented Mar 6, 2024

Hi @thomasvdv what board are you using? I thing this should be handled at WiFi class level.

@thomasvdv
Copy link
Author

Hi @pennam . I am using a Arduino UNO R4 Wifi. I can file a ticket with the Wifi library. Would it make sense to also include this check in Arduino_ConnectionHandler?

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Mar 6, 2024
@pennam
Copy link
Contributor

pennam commented Mar 7, 2024

Hi @thomasvdv i thought a bit about your request and i've changed my mind. I think you was right and this issue would be better handled in this library because is not correct for WiFi.begin("ssid", "pwd") to fallback into WiFi.begin("ssid") in case of empty password; that call should fails as is doing.

My proposal is to add a new WiFiConnectionHandler constructor without the "pwd" parameter that will be initialized to nullptr so it chan be handled in the update_handleConnecting function.

@thomasvdv
Copy link
Author

Hi @pennam If you move it to a different constructor, then ArduinoIoTCloud will need to make changes to their thingProperties.h code generation. They currently call WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

Line 38 in https://github.com/arduino-libraries/ArduinoIoTCloud/blob/master/examples/ArduinoIoTCloud-Advanced/thingProperties.h

@pennam
Copy link
Contributor

pennam commented Mar 8, 2024

yes you are right, this would be the correct way to handle it.

@thomasvdv
Copy link
Author

Hi @pennam I am teaching a class in two weeks that depends on this fix. Would it be possible to get the fix release before then? I am happy to work on a patch if that helps.

@pennam
Copy link
Contributor

pennam commented Mar 15, 2024

Hi @thomasvdv If you prepare a pr with the new WiFiConnectionHandler constructor without the pwd parameter i can review it and merge if everything works, but this will not solve your problem until the changes will be adopted in the cloud generated sketch.

For your class you should consider to load a custom Arduino_ConnectionHandler library to the cloud editor that implements the fallback logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants