aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--check-routeros-update.rsc15
-rw-r--r--hotspot-to-wpa-cleanup.capsman.rsc3
-rw-r--r--hotspot-to-wpa-cleanup.template.rsc3
-rw-r--r--hotspot-to-wpa-cleanup.wifi.rsc3
-rw-r--r--mod/ssh-keys-import.rsc3
5 files changed, 18 insertions, 9 deletions
diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc
index 84849ea..0624808 100644
--- a/check-routeros-update.rsc
+++ b/check-routeros-update.rsc
@@ -55,11 +55,18 @@
/system/package/update/check-for-updates without-paging as-value;
:local Update [ /system/package/update/get ];
- :if ([ $ScriptFromTerminal $ScriptName ] = true && ($Update->"installed-version") = ($Update->"latest-version")) do={
- $LogPrint info $ScriptName ("System is already up to date.");
+ :if (($Update->"installed-version") = ($Update->"latest-version")) do={
+ :if ([ $ScriptFromTerminal $ScriptName ] = true) do={
+ $LogPrint info $ScriptName ("System is already up to date.");
+ }
:error true;
}
+ :if ([ :len ($Update->"latest-version") ] = 0) do={
+ $LogPrint info $ScriptName ("Received an empty version string from server.");
+ :error false;
+ }
+
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
:local NumLatest [ $VersionToNum ($Update->"latest-version") ];
:local BitMask [ $VersionToNum "255.255zero0" ];
@@ -67,8 +74,8 @@
:local NumLatestFeature ($NumLatest & $BitMask);
:local Link ("https://mikrotik.com/download/changelogs/" . $Update->"channel" . "-release-tree");
- :if ($NumLatest < 117505792) do={
- $LogPrint info $ScriptName ("The version '" . ($Update->"latest-version") . "' is not a valid version.");
+ :if ($NumLatest < [ $VersionToNum "7.0" ]) do={
+ $LogPrint warning $ScriptName ("The version '" . ($Update->"latest-version") . "' is not a valid version.");
:error false;
}
diff --git a/hotspot-to-wpa-cleanup.capsman.rsc b/hotspot-to-wpa-cleanup.capsman.rsc
index 45ea72b..e935850 100644
--- a/hotspot-to-wpa-cleanup.capsman.rsc
+++ b/hotspot-to-wpa-cleanup.capsman.rsc
@@ -61,8 +61,9 @@
}
:foreach Server,Timeout in=$DHCPServers do={
+ :local TimeoutExtra ($Timeout + [ /system/clock/get time ]);
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic status="waiting" \
- server=$Server last-seen>$Timeout comment~"^hotspot-to-wpa:" ] do={
+ server=$Server last-seen>$TimeoutExtra comment~"^hotspot-to-wpa:" ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];
$LogPrint info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
" was not seen for " . ($LeaseVal->"last-seen") . ", removing.");
diff --git a/hotspot-to-wpa-cleanup.template.rsc b/hotspot-to-wpa-cleanup.template.rsc
index 081f3d0..fa99b5d 100644
--- a/hotspot-to-wpa-cleanup.template.rsc
+++ b/hotspot-to-wpa-cleanup.template.rsc
@@ -67,8 +67,9 @@
}
:foreach Server,Timeout in=$DHCPServers do={
+ :local TimeoutExtra ($Timeout + [ /system/clock/get time ]);
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic status="waiting" \
- server=$Server last-seen>$Timeout comment~"^hotspot-to-wpa:" ] do={
+ server=$Server last-seen>$TimeoutExtra comment~"^hotspot-to-wpa:" ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];
$LogPrint info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
" was not seen for " . ($LeaseVal->"last-seen") . ", removing.");
diff --git a/hotspot-to-wpa-cleanup.wifi.rsc b/hotspot-to-wpa-cleanup.wifi.rsc
index 23f773f..d3f859e 100644
--- a/hotspot-to-wpa-cleanup.wifi.rsc
+++ b/hotspot-to-wpa-cleanup.wifi.rsc
@@ -61,8 +61,9 @@
}
:foreach Server,Timeout in=$DHCPServers do={
+ :local TimeoutExtra ($Timeout + [ /system/clock/get time ]);
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic status="waiting" \
- server=$Server last-seen>$Timeout comment~"^hotspot-to-wpa:" ] do={
+ server=$Server last-seen>$TimeoutExtra comment~"^hotspot-to-wpa:" ] do={
:local LeaseVal [ /ip/dhcp-server/lease/get $Lease ];
$LogPrint info $ScriptName ("Client with mac address " . ($LeaseVal->"mac-address") . \
" was not seen for " . ($LeaseVal->"last-seen") . ", removing.");
diff --git a/mod/ssh-keys-import.rsc b/mod/ssh-keys-import.rsc
index f67c0fc..d6b3b3f 100644
--- a/mod/ssh-keys-import.rsc
+++ b/mod/ssh-keys-import.rsc
@@ -16,7 +16,6 @@
:local Key [ :tostr $1 ];
:local User [ :tostr $2 ];
- :global CharacterReplace;
:global GetRandom20CharAlNum;
:global LogPrint;
:global MkDir;
@@ -32,7 +31,7 @@
:return false;
}
- :local KeyVal [ :toarray [ $CharacterReplace $Key " " "," ] ];
+ :local KeyVal ([ :deserialize $Key delimiter=" " from=dsv options=dsv.plain ]->0);
:if (!($KeyVal->0 = "ssh-ed25519" || $KeyVal->0 = "ssh-rsa")) do={
$LogPrint warning $0 ("SSH key of type '" . $KeyVal->0 . "' is not supported.");
:return false;