#1 added if else with DROPBEAR_SSH and OPENSSH_SSH

This commit is contained in:
wt committed 2024-12-28 01:41:05 +07:00
1 parent bc17587a15
commit 03f14739cb
5 files changed
+48 -8

No files matched your search

+16 -4
View File
@@ -63,14 +63,26 @@ namespace api
std::string new_ssh_status = json_body["status"];
if (new_ssh_status == "0")
{
system("rc stop ssh");
system("rc del ssh");
if (get_ssh_server() == DROPBEAR_SSH)
{
system("rc stop dropbear");
system("rc del dropbear");
} else if (get_ssh_server() == OPENSSH_SSH) {
system("rc stop ssh");
system("rc del ssh");
}
syslog(LOG_INFO, "%s", "SSH is disabled");
}
else
{
system("rc start ssh");
system("rc add ssh");
if (get_ssh_server() == DROPBEAR_SSH)
{
system("rc start dropbear");
system("rc add dropbear");
} else if (get_ssh_server() == OPENSSH_SSH) {
system("rc start ssh");
system("rc add ssh");
}
syslog(LOG_INFO, "%s", "SSH is enabled");
}
sshfileout << stoi(new_ssh_status);