syslog warning fix
This commit is contained in:
1 parent
f8f0a22f85
commit
0da818838c
13 files changed
+19
-19
No files matched your search
@@ -60,11 +60,11 @@ namespace settings {
|
|||||||
if (new_dns_enabled == "0") {
|
if (new_dns_enabled == "0") {
|
||||||
system("rc stop dnsmasq");
|
system("rc stop dnsmasq");
|
||||||
system("rc del dnsmasq");
|
system("rc del dnsmasq");
|
||||||
syslog(LOG_INFO, "DNS is disabled");
|
syslog(LOG_INFO, "%s", "DNS is disabled");
|
||||||
} else {
|
} else {
|
||||||
system("rc restart dnsmasq");
|
system("rc restart dnsmasq");
|
||||||
system("rc add dnsmasq");
|
system("rc add dnsmasq");
|
||||||
syslog(LOG_INFO, "DNS is enabled");
|
syslog(LOG_INFO, "%s", "DNS is enabled");
|
||||||
}
|
}
|
||||||
dnsfileout << stoi(new_dns_enabled);
|
dnsfileout << stoi(new_dns_enabled);
|
||||||
dnsfileout.close();
|
dnsfileout.close();
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace settings {
|
|||||||
}
|
}
|
||||||
domainsfile.close();
|
domainsfile.close();
|
||||||
system("rc restart dnsmasq");
|
system("rc restart dnsmasq");
|
||||||
syslog(LOG_INFO, "DNS local domains changed");
|
syslog(LOG_INFO, "%s", "DNS local domains changed");
|
||||||
std::string responsedata = R"({"success":"true"})";
|
std::string responsedata = R"({"success":"true"})";
|
||||||
response.set_content(responsedata, JSON_TYPE);
|
response.set_content(responsedata, JSON_TYPE);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace settings {
|
|||||||
if (authenticate(json_body["token"])) {
|
if (authenticate(json_body["token"])) {
|
||||||
std::ofstream dnsserversfile("/etc/dnsmasq.conf.d/resolv.conf");
|
std::ofstream dnsserversfile("/etc/dnsmasq.conf.d/resolv.conf");
|
||||||
nlohmann::json servers = json_body["servers"];
|
nlohmann::json servers = json_body["servers"];
|
||||||
for (const nlohmann::json_abi_v3_11_3::json server : servers) {
|
for (const nlohmann::json_abi_v3_11_3::json &server : servers) {
|
||||||
std::string srv = server;
|
std::string srv = server;
|
||||||
if (server.empty()) {
|
if (server.empty()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -70,7 +70,7 @@ namespace settings {
|
|||||||
}
|
}
|
||||||
dnsserversfile.close();
|
dnsserversfile.close();
|
||||||
system("rc restart dnsmasq");
|
system("rc restart dnsmasq");
|
||||||
syslog(LOG_INFO, "DNS servers changed");
|
syslog(LOG_INFO, "%s", "DNS servers changed");
|
||||||
std::string responsedata = R"({"success":"true"})";
|
std::string responsedata = R"({"success":"true"})";
|
||||||
response.set_content(responsedata, JSON_TYPE);
|
response.set_content(responsedata, JSON_TYPE);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ namespace settings {
|
|||||||
if (new_ftp_enabled == "0") {
|
if (new_ftp_enabled == "0") {
|
||||||
system("rc stop ftp");
|
system("rc stop ftp");
|
||||||
system("rc del ftp");
|
system("rc del ftp");
|
||||||
syslog(LOG_INFO, "Ftp is disabled");
|
syslog(LOG_INFO, "%s", "Ftp is disabled");
|
||||||
} else {
|
} else {
|
||||||
system("rc start ftp");
|
system("rc start ftp");
|
||||||
system("rc add ftp");
|
system("rc add ftp");
|
||||||
syslog(LOG_INFO, "Ftp is enabled");
|
syslog(LOG_INFO, "%s", "Ftp is enabled");
|
||||||
}
|
}
|
||||||
ftpfileout << stoi(new_ftp_enabled);
|
ftpfileout << stoi(new_ftp_enabled);
|
||||||
ftpfileout.close();
|
ftpfileout.close();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace settings {
|
|||||||
}
|
}
|
||||||
keysfile.close();
|
keysfile.close();
|
||||||
system("rc restart ssh");
|
system("rc restart ssh");
|
||||||
syslog(LOG_INFO, "SSH keys changed");
|
syslog(LOG_INFO, "%s", "SSH keys changed");
|
||||||
std::string responsedata = R"({"success":"true"})";
|
std::string responsedata = R"({"success":"true"})";
|
||||||
response.set_content(responsedata, JSON_TYPE);
|
response.set_content(responsedata, JSON_TYPE);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace settings {
|
|||||||
system(systemrequest.str().c_str());
|
system(systemrequest.str().c_str());
|
||||||
system("rc restart ssh");
|
system("rc restart ssh");
|
||||||
std::string syslogstring = "SSH port changed to " + new_ssh_port;
|
std::string syslogstring = "SSH port changed to " + new_ssh_port;
|
||||||
syslog(LOG_INFO, syslogstring.c_str());
|
syslog(LOG_INFO, "%s", syslogstring.c_str());
|
||||||
std::ifstream sshportfile(SSH_PORT_PATH);
|
std::ifstream sshportfile(SSH_PORT_PATH);
|
||||||
int ssh_port;
|
int ssh_port;
|
||||||
sshportfile >> ssh_port;
|
sshportfile >> ssh_port;
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ namespace settings {
|
|||||||
if (new_ssh_status == "0") {
|
if (new_ssh_status == "0") {
|
||||||
system("rc stop ssh");
|
system("rc stop ssh");
|
||||||
system("rc del ssh");
|
system("rc del ssh");
|
||||||
syslog(LOG_INFO, "SSH is disabled");
|
syslog(LOG_INFO, "%s", "SSH is disabled");
|
||||||
} else {
|
} else {
|
||||||
system("rc start ssh");
|
system("rc start ssh");
|
||||||
system("rc add ssh");
|
system("rc add ssh");
|
||||||
syslog(LOG_INFO, "SSH is enabled");
|
syslog(LOG_INFO, "%s", "SSH is enabled");
|
||||||
}
|
}
|
||||||
sshfileout << stoi(new_ssh_status);
|
sshfileout << stoi(new_ssh_status);
|
||||||
sshfileout.close();
|
sshfileout.close();
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ namespace settings {
|
|||||||
if (new_telnet_enabled == "0") {
|
if (new_telnet_enabled == "0") {
|
||||||
system("rc stop telnet");
|
system("rc stop telnet");
|
||||||
system("rc del telnet");
|
system("rc del telnet");
|
||||||
syslog(LOG_INFO, "Telnet is disabled");
|
syslog(LOG_INFO, "%s", "Telnet is disabled");
|
||||||
} else {
|
} else {
|
||||||
system("rc start telnet");
|
system("rc start telnet");
|
||||||
system("rc add telnet");
|
system("rc add telnet");
|
||||||
syslog(LOG_INFO, "Telnet is enabled");
|
syslog(LOG_INFO, "%s", "Telnet is enabled");
|
||||||
}
|
}
|
||||||
telnetfileout << stoi(new_telnet_enabled);
|
telnetfileout << stoi(new_telnet_enabled);
|
||||||
telnetfileout.close();
|
telnetfileout.close();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace settings {
|
|||||||
telnetportfileout.close();
|
telnetportfileout.close();
|
||||||
system("rc restart telnet");
|
system("rc restart telnet");
|
||||||
std::string syslogstring = "Telnet port changed to " + new_telnet_port;
|
std::string syslogstring = "Telnet port changed to " + new_telnet_port;
|
||||||
syslog(LOG_INFO, syslogstring.c_str());
|
syslog(LOG_INFO, "%s", syslogstring.c_str());
|
||||||
std::ifstream telnetportfile("/etc/openrouter/telnet/port");
|
std::ifstream telnetportfile("/etc/openrouter/telnet/port");
|
||||||
int telnet_port;
|
int telnet_port;
|
||||||
telnetportfile >> telnet_port;
|
telnetportfile >> telnet_port;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace settings {
|
|||||||
system(systemrequest.str().c_str());
|
system(systemrequest.str().c_str());
|
||||||
system("rc restart hostapd");
|
system("rc restart hostapd");
|
||||||
std::string syslogstring = "WIFI channel changed to " + new_channel;
|
std::string syslogstring = "WIFI channel changed to " + new_channel;
|
||||||
syslog(LOG_INFO, syslogstring.c_str());
|
syslog(LOG_INFO, "%s", syslogstring.c_str());
|
||||||
|
|
||||||
std::ifstream changedwifisettingsfile(WIFI_SETTINGS_PATH);
|
std::ifstream changedwifisettingsfile(WIFI_SETTINGS_PATH);
|
||||||
std::string wifi_channel;
|
std::string wifi_channel;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace settings {
|
|||||||
system(systemrequest.str().c_str());
|
system(systemrequest.str().c_str());
|
||||||
system("rc restart hostapd");
|
system("rc restart hostapd");
|
||||||
std::string syslogstring = "WIFI name changed to " + new_wifi_name;
|
std::string syslogstring = "WIFI name changed to " + new_wifi_name;
|
||||||
syslog(LOG_INFO, syslogstring.c_str());
|
syslog(LOG_INFO, "%s", syslogstring.c_str());
|
||||||
|
|
||||||
std::ifstream changedwifisettingsfile(WIFI_SETTINGS_PATH);
|
std::ifstream changedwifisettingsfile(WIFI_SETTINGS_PATH);
|
||||||
std::string wifi_name;
|
std::string wifi_name;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace settings {
|
|||||||
system(systemrequest.str().c_str());
|
system(systemrequest.str().c_str());
|
||||||
system("rc restart hostapd");
|
system("rc restart hostapd");
|
||||||
std::string syslogstring = "WIFI password changed";
|
std::string syslogstring = "WIFI password changed";
|
||||||
syslog(LOG_INFO, syslogstring.c_str());
|
syslog(LOG_INFO, "%s", syslogstring.c_str());
|
||||||
std::stringstream responsedata;
|
std::stringstream responsedata;
|
||||||
responsedata << R"({"success":"ok"})";
|
responsedata << R"({"success":"ok"})";
|
||||||
response.set_content(responsedata.str(), JSON_TYPE);
|
response.set_content(responsedata.str(), JSON_TYPE);
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ namespace settings {
|
|||||||
if (new_wifi_status == "0") {
|
if (new_wifi_status == "0") {
|
||||||
system("rc stop hostapd");
|
system("rc stop hostapd");
|
||||||
system("rc del hostapd");
|
system("rc del hostapd");
|
||||||
syslog(LOG_INFO, "WIFI is disabled");
|
syslog(LOG_INFO, "%s", "WIFI is disabled");
|
||||||
} else {
|
} else {
|
||||||
system("rc start hostapd");
|
system("rc start hostapd");
|
||||||
system("rc add hostapd");
|
system("rc add hostapd");
|
||||||
syslog(LOG_INFO, "WIFI is enabled");
|
syslog(LOG_INFO, "%s", "WIFI is enabled");
|
||||||
}
|
}
|
||||||
wififileout << stoi(new_wifi_status);
|
wififileout << stoi(new_wifi_status);
|
||||||
wififileout.close();
|
wififileout.close();
|
||||||
|
|||||||
Reference in new issue
Block a user