[PATCH] Allow RW access to wpa_supplicant config file
Dmitry Shmidt
dimitrysh
Thu Feb 24 17:00:17 PST 2011
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
wpa_supplicant/config_file.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 09c99e3..f64871f 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -23,6 +23,8 @@
#include "base64.h"
#include "uuid.h"
+#include <sys/stat.h>
+
/**
* wpa_config_get_line - Read the next configuration file line
@@ -288,6 +290,11 @@ struct wpa_config * wpa_config_read(const char *name)
return NULL;
}
+ /* When creating the config file, give group read/write access
+ * to allow backup and restoring the file.
+ */
+ chmod(name, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
+
while (wpa_config_get_line(buf, sizeof(buf), f, &line, &pos)) {
if (os_strcmp(pos, "network={") == 0) {
ssid = wpa_config_read_network(f, &line, id++);
--
1.7.3.1
More information about the Hostap
mailing list