diff mbox series

storage: warn user on badly named provisioning file

Message ID 20220614233529.714721-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series storage: warn user on badly named provisioning file | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR PASS
prestwoj/iwd-ci-gitlint success Gitlint PASS
prestwoj/iwd-ci-fetch success Fetch PR PASS
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck PASS
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-makedistcheck success Make Distcheck PASS
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-build success Build Configuration PASS
prestwoj/iwd-ci-build success Build Configuration PASS
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check PASS
prestwoj/iwd-alpine-ci-makecheck success Make Check PASS
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheckvalgrind success Make Check PASS
prestwoj/iwd-ci-makecheck success Make Check PASS
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood June 14, 2022, 11:35 p.m. UTC
The man pages (iwd.network) have a section about how to name provisioning
files containing non-alphanumeric characters but not everyone reads the
entire man page.

Warning them that the provisioning file was not read and pointing to
'man iwd.network' should lead someone in the right direction.
---
 src/storage.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/storage.c b/src/storage.c
index 2100d08d..528bdbf4 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -321,8 +321,12 @@  const char *storage_network_ssid_from_path(const char *path,
 			if (!isalnum(*c) && !strchr("-_ ", *c))
 				break;
 
-		if (c < end)
+		if (c < end) {
+			l_warn("Provisioning file %s contains non-alphanumeric "
+				"characters in the name. Please hex-encode. "
+				"See man iwd.network", path);
 			return NULL;
+		}
 
 		memcpy(buf, filename, end - filename);
 		buf[end - filename] = '\0';