Skip to content

Commit 682de55

Browse files
Christian Korberrobimarko
authored andcommitted
hostapd: fix logging of configuration content
As discussed in openwrt#17517, there are contents of hostapd's configuration file logged in syslog. This includes critical information like `passphrase`. To circumvent this condition, this commit logs only "inline" if config_fname is inline data. Otherwise the upstream logic of hostapd applies. Fixes: openwrt#14049 Signed-off-by: Christian Korber <ck@dev.tdt.de> Link: openwrt/openwrt#17718 Signed-off-by: Robert Marko <robimarko@gmail.com>
1 parent 765d642 commit 682de55

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

package/network/services/hostapd/patches/701-reload_config_inline.patch

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ as adding/removing interfaces.
88

99
--- a/hostapd/config_file.c
1010
+++ b/hostapd/config_file.c
11-
@@ -4981,7 +4981,12 @@ struct hostapd_config * hostapd_config_r
11+
@@ -4981,7 +4981,14 @@ struct hostapd_config * hostapd_config_r
1212
int errors = 0;
1313
size_t i;
1414

@@ -19,6 +19,8 @@ as adding/removing interfaces.
1919
+ } else {
2020
+ f = fopen(fname, "r");
2121
+ }
22+
+ wpa_printf(MSG_INFO, "Configuration file: Reading configuration file '%s'",
23+
+ fname);
2224
if (f == NULL) {
2325
wpa_printf(MSG_ERROR, "Could not open configuration file '%s' "
2426
"for reading.", fname);
@@ -39,3 +41,36 @@ as adding/removing interfaces.
3941
if (f == NULL) {
4042
wpa_printf(MSG_ERROR, "Failed to open config file '%s', "
4143
"error: %s", name, strerror(errno));
44+
--- a/hostapd/main.c
45+
+++ b/hostapd/main.c
46+
@@ -406,7 +406,11 @@ hostapd_interface_init(struct hapd_inter
47+
struct hostapd_iface *iface;
48+
int k;
49+
50+
- wpa_printf(MSG_DEBUG, "Configuration file: %s", config_fname);
51+
+ if (!strncmp(config_fname, "data:", 5)) {
52+
+ wpa_printf(MSG_DEBUG, "Configuration file: %s", "<inline>");
53+
+ } else {
54+
+ wpa_printf(MSG_DEBUG, "Configuration file: %s", config_fname);
55+
+ }
56+
iface = hostapd_init(interfaces, config_fname);
57+
if (!iface)
58+
return NULL;
59+
--- a/src/ap/hostapd.c
60+
+++ b/src/ap/hostapd.c
61+
@@ -3380,8 +3380,13 @@ hostapd_interface_init_bss(struct hapd_i
62+
}
63+
}
64+
65+
- wpa_printf(MSG_INFO, "Configuration file: %s (phy %s)%s",
66+
- config_fname, phy, iface ? "" : " --> new PHY");
67+
+ if (!strncmp(config_fname, "data:", 5)) {
68+
+ wpa_printf(MSG_INFO, "Configuration file: %s (phy %s)%s",
69+
+ "<inline>", phy, iface ? "" : " --> new PHY");
70+
+ } else {
71+
+ wpa_printf(MSG_INFO, "Configuration file: %s (phy %s)%s",
72+
+ config_fname, phy, iface ? "" : " --> new PHY");
73+
+ }
74+
75+
conf = interfaces->config_read_cb(config_fname);
76+
if (!conf)

0 commit comments

Comments
 (0)