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

Use fwrite instead of exec to ensure single quotes can be handled in PSK #36

Merged

Conversation

lachiemurray
Copy link
Contributor

@lachiemurray lachiemurray commented Nov 5, 2020

#6

Variable interpolation was causing the exec argument to expand to something like:

echo 'ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\nupdate_config=1\ncountry=GB\n\n\nnetwork={\n\tssid="MySSID"\n\t#psk="MyPskWithSingleQuote' "\n\tpsk=psketc\n}\n' > /tmp/wifidata

This results in the following error:

sh: 11: Syntax error: Unterminated quoted string

Caused by the extra single quote in the middle of the PSK:

...#psk="MyPskWithSingleQuote' "\n\tp...

Proposed solution is to use fwrite instead of exec.

Tested on my emonpi by connecting in AP mode and then connecting to home WiFi network

@lachiemurray
Copy link
Contributor Author

Just flagging this again @emrysr @glynhudson

@TrystanLea
Copy link
Member

Sorry @lachiemurray to miss your pull request here, I will test and hopefully merge shortly!

@TrystanLea TrystanLea merged commit 12213f5 into emoncms:master Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants